Jump to content

Controlling the render order of translucent objects


photo

Recommended Posts

Posted

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. post-225-0-64951600-1318854505_thumb.png

 

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?

Posted

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.

Posted

I had tried making the overlay a decal, even then the Rendering Order did not have an effect. It was looking like thispost-225-0-26700800-1319101776_thumb.png even after converting the overlay into a decal.

Posted

You need to set Materials -> States-> Ambient to Transparent in order to change the rendering order of material.

×
×
  • Create New...