Hello, I have this issue where I build a mesh and at certain camera angles, I can see the mesh underneath. Has anyone seen this before / know what the root cause could be?
This is what it looks like:
Starting at a camera position somewhat directly above the top quads:
In local space, the quads are laid flat, the normal facing upward, and 1 are apart in the Y. The same issue occurs with these quads at any level, however.
I am not really sure where to go from here. This is a list of things I have tried in my custom surface shader:
Disable occlusion culling.
ZWrite On/Off.
Queue/RenderType=“Opaque”. Does not work but do need it transparent so switched that back.
Messing with this pragma line #pragma surface surf Standard fullforwardshadows vertex:vert alpha:fade
Creating a gutter in my texture atlas, which did fix texture bleeding but not this.
Three (3) primary ways that Unity draws / stacks / sorts / layers / overlays stuff:
In short, as far as the Standard Rendering Pipeline,
The default 3D Renderers draw stuff according to Z depth - distance from camera.
SpriteRenderers draw according to their Sorting Layer and Sorting Depth properties
UI Canvas Renderers draw in linear transform sequence, like a stack of papers
If you find that you need to mix and match items using these different ways of rendering, and have them appear in ways they are not initially designed for, you need to:
identify what you are using
search online for the combination of things you are doing and how to to achieve what you want.
There may be more than one solution to try.
For instance, you may even use multiple co-located cameras (along with different Layers and LayerMasks drawn to different-depth Cameras) to more-explicitly control apparent draw ordering.
Additional reading in the official docs:
And SortingGroups can also be extremely helpful in certain circumstances:
Other rendering pipelines may have other ways of layering (HDRP and URP). Go see the latest docs for details.
There’s lots of third party open source packages available as well, such as this:
Thanks for the help. I am only using one MeshRenderer here. So I am trying to figure out why dirt vertices behind the top ‘carpet’ quads would be appearing. I am not using the other two in this case if this helps.