Skip to main content

History: NestedTransparentSurfaces

Source of version: 3 (current)

Copy to clipboard
            Nesting transparent surfaces

I thought about this today (someone asked it on IRC) and I think it is an interesting idea to have multiple transparent 'shells' nested within each other (an example is multiple transparent spheres, or a spaceship with transparent windows inside a transparent shield) This is not possible with the normal depth sorting but I think you could do some trick with culling:

* First set culling so that triangles facing away from the viewer are drawn
* Draw the 'shells' from outside to inside
* Then set culling so that triangles facing the viewer are drawn
* Draw the 'shells' from inside to outside

This could be represented in Ogre by using a custom Entity (set of renderables) that uses two materials, one material with front culling (cull_hardware anticlockwise) and one with back culling (cull_hardware clockwise). The renderable would have subrenderables that are 'shells', ordered by their inside-outside relationship.
The renderables would be queued in this order:
* Material cull anticlockwise
** Most outside renderable
** ...
** Most inside renderable
* Material cull clockwise
** Most inside renderable
** ...
** Most outside renderable

This may be achieved by perturbing the getSquaredViewDepth a bit for each of the renderables so that the sorting places them in this order.