Z fighting, what options do I have?

Hi guys. Nice scene. Mostly problems where terrain meets building… but some problems on roofs, too.

Over in another thread, I used some “rays” to get measurements from one mesh… to the surface of another. The ray’s pickingInfo object, besides knowing distance to “hit”, also reports the hit mesh (pickedMesh).

SOOooo… imagine this: Move a box (iterate/step) along every vertex-point of the ground, but 5 units below it. Shoot a ray upward into the ground. IF the pickedMesh !== ground, then a building/model is lower than the terrain AT THAT POINT. (a z-fighting causer).

IF a bad point is found… create a red sphere and place it at that terrain position/vert. (a marker, for where terrainpoint.y work… needs to be done)

IF you use multi-pick… maybe you can get a “pick hit” from BOTH the building AND the terrain, and you can determine how much difference between their Y-positions… and lower the terrainPoint.y THAT amount. It’s sort of a like… “Auto-Contour-Terrain-To-Building-Foundations”… the legend begins. :slight_smile:

Ok, it’s probably a bad idea… but it sounds easier than hauling it all back into the modeler and tweaking stuff in there. :open_mouth: