ashwin.sudhir Posted October 17, 2011 Posted October 17, 2011 Hi, This is the scenario :- 1. We have a terrain mesh 2. on top of the terrain is an alpha blended overlay mesh (src_alpha, one_minus_src_alpha) 3. A decal on the terrain (again alpha blended), with a sufficient enough offset to appear on top of the mesh mentioned above The correct result is the terrain is rendered first, then the overlay mesh and finally the terrain decal. Initially we thought Unigine would sort the polygons in back to front order thereby giving us the correct result. But this wasn't the case. Then we decided to explicitly set the render order for these objects Terrain - default Terrain overlay - +1 Terrain decal - +8 Even then, the terrain overlay seems to be getting drawn last. Attached is a sample world that illustrates the problem temp.zip How can we make sure that the decal is drawn last and hence blended correctly with the overlay mesh?
manguste Posted October 19, 2011 Posted October 19, 2011 The cause of such behavior is explained by rendering sequence, i.e. in which order the world is rendered. First comes the pass for opaque meshes, that is, the terrain is rendered. Then decals are rendered (both opaque and transparent ones) and only after that comes the turn of transparent meshes. The material Order parameter controls in what order objects are rendered in ONE group: you can set what decal is rendered last among other decals, but it is not possible to set rendering of transparent mesh before the decal. In your case, you can make the mesh a decal, so you could control their rendering order.
ashwin.sudhir Posted October 20, 2011 Author Posted October 20, 2011 I had tried making the overlay a decal, even then the Rendering Order did not have an effect. It was looking like this even after converting the overlay into a decal.
manguste Posted October 25, 2011 Posted October 25, 2011 You need to set Materials -> States-> Ambient to Transparent in order to change the rendering order of material.
Recommended Posts