Hello everyone! I hope y’all are doing great! I need some of your wisdom since I’m not very good with shaders. What we are trying to do is using 2D sprites and a depth texture (Black & White) so we can fake depth per pixel in order to solve sorting issues in a 3D world. Kinda of what the Sims 1 did back in the day with the 2D pre-rendered objects and the 3D model of the sim. We have a shader with two passes, one is the ShadowCaster pass that what it does is read data from a depth texture in the fragment shader using uv input and returning that depth value. The other pass is just for rendering the actual sprite and color.
As you can see in the Sims 1 picture when the player moves the bed in a position that intersects with the Sim, the Sim doesn’t get fully covered by the bed sprite, is like the bed sprite only cuts the sim in half.
PD: Also that depth texture view seems to only appear in the frame debugger if I have a script that sets the camera depthTextureMode to “DepthTextureMode.Depth”.
According to that depth texture view the upper right cube should be rendered on top of the other cubes, but when rendering the opaque geometry it seems to skip the depth data. I don’t know if we are doing something wrong.
Any help is super appreciated. Thanks in advance.