Game Development Community

RenderTranslucentMgr always renders backfaces

by Tom Spilman · in Torque Game Engine Advanced · 11/20/2006 (6:18 pm) · 1 replies

Simple bug in RenderTranslucentMgr::render(). How it is now it always renders backfaces for translucent materials... which is wrong. It should obey the double sided flag like any other material. The fix is simple...

U32 binSize = mElementList.size();
   for( U32 j=0; j<binSize; )
   {
      RenderInst *ri = mElementList[j].inst;
      MatInstance *mat = ri->matInst;
      
      // NEW CHECK!
      if ( !mat || mat->getMaterial()->doubleSided )
         GFX->setCullMode( GFXCullNone );
      else
         GFX->setCullMode( GFXCullCCW );

      U32 matListEnd = j;

      // etc...

With this in place it will render double sided for things without materials (particles) or when requested by the material only.

About the author

Tom is a programmer and co-owner of Sickhead Games, LLC.