dark99 Posted November 21 Posted November 21 (edited) Hi I wonder if there is a way to solve the problem below. First. In the screenshot, there is a blue cube and a pink cube, and since they are in the exact same X, Z position, there is Z-fighting. Is there a way to make a specific cube always render later? (Like a decal) I want to use this as an object modeling guide (so to speak). If the blue cube is a modeling guide and the pink cube is the actual object that the user is creating, I want the blue cube to be displayed as a semi-transparent overlap of the pink cube, but without Z-fighting even when they are in the exact same position and shape. Second. Is it possible to make the blue cube always appear on top of other objects, regardless of its position, like a visualizer or widget? Edited November 21 by dark99
arizmenda Posted November 22 Posted November 22 Hi, dark99! Z-fighting can occur when identical objects share the same coordinates. To minimize this issue, a straightforward and efficient approach is to slightly increase the scale of the object intended to appear on top. Adjusting the scale by as little as 0.00002 is often enough to eliminate the artifact. 2024-11-22 14-51-12.mp4 Will that work for you? Thanks!
Amerio.Stephane Posted November 22 Posted November 22 There a few ways to achieve this, I think. The easiest would be if you are using a material inheriting from the mesh_base material: First solution: Set your material State/Geometry Inflation to "Wire". This will slightly offset the mesh vertices, hence preventing Z-fight altogether. Second solution: Set your material Common/Transparency Preset to "Alpha Blend" (even if your mesh is supposed to be fully opaque). This ensures your mesh is rendered after all opaque meshes Then uncheck Common/Options/Depth Test This ensures nothing can obscure your mesh. In fact, it will always appear above all other meshes. If you have other transparent meshes and still see z-fight, you can play with Common/Options/Rendering Order Independently, if you are trying to emulate the Visualizer, you might want to check Common/Transparency/Overlap along with enabling AlphaBlend. This ensures the mesh is not affected by your lights, and will always have the same appearance (aka unlit material). Also, you may want to duplicate your mesh and assign different materials to each duplicate, for example to be able to have "X-Ray vision" through other objects. 1
dark99 Posted November 22 Author Posted November 22 (edited) Thanks for the reply. Especially, Amerio.Stephane's solutions are exactly what I wanted. Thanks. Edited November 22 by dark99
Recommended Posts