In the early steps of development, I test my game (that is running quiet nicely in Editor) on my Ipad device and there starts the troubles.
It seems like there is a Z-Fighting issue on device.
Solutions I tried to fix the issue :
1 - Change all materials used to : Mobile/Unlit
2 - Verify that there is no alpha on any png texture
3 - Turn texture to 24 png (no alpha)
4 - Turn texture to tga (no alpha)
5 - Change Camera settings
→ Increase Near clipping plane up to 2 (can’t go up that without loosing some of my scene)
→ Decrease Far clipping plane down to 20 (can’t go under without loosing some of my scene)
→ Changed Rendering Path to “Forward”
→ Activated / Deactivated Occlusion Culling
I’m kinda out of idea to solve this issue. Could you help me please ?
See image joined.
Character should be hidden by trees. Same for the little green tree next to the character, it should be 100% hidden by the big dark green tree.
Your issue looks like a simple layering/z depth problem. The closer to the camera the higher the Z value. 10 being closer than 9, and so on. What is the Z value of your trees? What is the Z value of your player? The player Z value should be lower than your tree Z value. If that’s not the issue, check your layers, if you are using them. They should be on different layers.
So the prefab instance definitly use a z position, but the true tree mesh is alway with Vector(0, 0, 0), cause it’s local position from the parent I guess. Of corse, each instance of prefab as a different position on the map. Considering layers, all trees are on one layer, and player is on is own layer.
Note that there is no issue when debuging on my computer, only zhen i run on IOS device.
So following your idea, I changed my camera orientation, so now objects closers to the camera have higher Z values, and objects far from camera have lower Z value.
But this does not resolve my issue, this is two screenshot, one in debug mode on my computer :
As you can see , there is no Z fighting and all textures looks good.
Hmm… I’ve noticed a lot of texture fighting issues when I have textures on the same layers or same Z-index. So, instead of changing the camera. Check if any textures are on the same layers or same z-index. Check all the trees. I’ve noticed that if I have (2 trees) on the same z-index, they will start fighting.
I tried to separate trees and character on two different layers, no luck there.
I tried to place each single tree on a separate layer, but seems there is only 31 different layers available.
Here is a little progress on this issue. I managed to resolve a part of the display issue by creating my own shader. Basically, the main thing that resolved the issue is turning the queue to Transparent, wich looks against documentation as my mesh does not contains alpha, but I guess this force to consider Z-Depth. Now, there is not more Z-Depth issue from one mesh to another, as you can see trees in forest are not overlapping to each other.
But there is still some poly not displayed or with wrong normals, like eyes of the character or darkest zone in trees foliages.
Yeah, let’s say it’s “fixed” between quotations marks, because my little finger says it’s probably very bad for performances to render all objects in transparent passes.
This is some screenshots, with the expected rendering on left (the one I get on Mac) and the final rendering on the device (the one I get on Ios). basically, looks like some polys are missing on the front or are rendered in background instead of being rendered in front.
The tree :
Some single leaves are missing
Left big leaves zone seems rendered behind middle leaves mesh
Rock at the bottom right is rendered behind the trunk instead of in front
Ok got it fixed by creating a new project from scratch. All is working well now and I can use shaders given zith unity without any trouble. All mesh are rendered correctly. All Z-Fighting is gone.