- Home /
Shader offset to prevent z-fighting ignores ambient light. Please help.
My game utilises 2D sprites in a 3D environment and it's necessary to have various sprites on the same layer. In an ideal world, i'd be able to tell the game to use z-depth to render everything, and where things are at the same depth (where the z-fighting occurs), use sorting layers. However I cant figure that one out, and so decided instead to use the shader's offset ability. This way I can add an offset to the sprite so while its in the same layer technically, the camera renders it infront if necessary.
The only problem with this, is that for some reason any sprites that make use of any offset (to bring it infront) end up ignoring ambient light. This makes the sprites unnaturally dark at night and looks very off. Does anyone have any suggestions as to why this could be? Thanks guys
Your answer
![](https://koobas.hobune.stream/wayback/20220612124755im_/https://answers.unity.com/themes/thub/images/avi.jpg)