So, I’ve read that for fixing mesh overlaps you guys mostly suggest using:
material.polygonOffset = true;
material.polygonOffsetFactor = value;
But this might only apply for scenes where you understand and know the sources you are going to add.
In a unknown scene, where users can upload their own objects, there’s no way to tell which materials should have these values turned on to avoid mesh overlaps.
I’ve found a good approach that works perfectly for this: scaling the camera
Here are some examples of how it works:
Camera Scale (1,1,1)
, clothes overlap too easily thru the user.
But as soon as I change the Camera Scale to be i.g. (10,10,10)
, the mesh stops overlapping. I’m guessing that by increasing the camera scale, depth buffer is more precise?
This approach has worked for me very good, until I start adding more complex scenes to the renderer, such as effects, composer, passes, etc. I suppose, some relay on the camera matrix and lead to glitches.
Is there a better way to avoid overlapping for unknown scenes?
Thanks in advance.