NestedTransparentSurfaces         Nesting transparent surfaces using culling tricks
Print

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.


Contributors to this page: jacmoe133512 points  and OgreWikiBot .
Page last modified on Sunday 03 of January, 2010 01:08:27 UTC by jacmoe133512 points .


The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.