Godot Version
4.4.1
Question
I am trying to rewrite a shader I originally made in Unity that used a projected texture to cull pixels, similar to how its done in L4D2.
Tried to recreate it the exact same way it was done in Unity but so far it hasn’t produced ideal results. I can get the culling to work via length() and see where the ellipse shows up, but its not in the position it should be.
In unity I get the ellipsoids WorldToLocalMatrix but in Godot I can’t seem to find an equivalent, so I’ve been using the objects transform instead. This may be where I’m falling short with this.
This is the shader:
This is the temporary code I’m using to send the ellipse transform into the shader:
This is the result:
This is the part of the original Unity shader that handled culling.
UNITY_ACCESS_INSTANCED_PROP is meaningless.
i.worldPos is just preskinned vertex positions that were passed into the UV3 channel via script. I’ll figure that out later.
_CullerSpace is just a list of matrices dumped from ellipsoids via script and _CullerPosition is a list of positions from the same ellipsoids.
This is the original code that sent the matrices and positions to the shader:
This is the result:
I’d like to replicate the Unity shader as close as possible. Right now I’m not worried about multiple cullers, I’ll figure that out later.