Game Development Community

T3D 1.1 Beta 3 - Forest Objects visible through terrain as silhouettes when AdvancedLightmapSupport is enabled - CONFIRMED - FIXED

by Steve Acaster · in Torque 3D Professional · 09/20/2010 (12:57 pm) · 8 replies

T3D 1.1 beta 3 - tested in FPS Example -> Deathball Desert

win7

Lighting - Terrain - World Editor

Issue:
Terrain becomes transparent to Forest objects when AdvancedLightmapSupport is enabled (in dynamic/normal lighting) - terrain also becomes very bright.

Repeat:
Boot up Deathball Desert (or any mission with Forest objects and a terrain), whilst in advanced lighting enable AdvancedLightmapSupport via the world editor -> theLevelInfo object, wait for it to initialize, check out the suddenly bright terrain which you can now see objects through.

Suggest:
Fix the transparency issues for terrain vs Forest objects and dampen the brightness of the terrain in Advanced Lighting when AdvancedLightmapSupport is set ... or put a disclaimer not to use the value when you have a terrain in level.

08 APRIL 2011 - FIXED IN 1.1 PREVIEW

#1
09/20/2010 (2:30 pm)
Logged as TQA-1123 for the QA team to verify.
#2
09/20/2010 (7:58 pm)
Note - this sounds identical to the bug I experienced in 1.1B1, which was logged as TQA-144. I won't be able to integrate 1.1B3 until the AFX integration is complete, but as mentioned in the notes of that bug I stopped seeing this in 1.1B2. YMMV.

Dusty
#3
09/20/2010 (8:08 pm)
Yeah, I remember that and rechecked 1.1beta2 and it only happens with Forest Objects there too ... so maybe there's a typemask needing to be added somewhere ...
#4
09/21/2010 (5:52 pm)
Bug confirmed and thread title updated.
#5
02/15/2011 (2:13 pm)
Here is the fix.

In engine\source\terrain\terrCellMaterial.cpp around line 20:

#include "sceneGraph/sceneState.h"
#include "materials/sceneData.h"
#include "gfx/util/screenspace.h"
#include "lighting/advanced/advancedLightBinManager.h" // ADDED!


AFTER_MODULE_INIT( MaterialManager )
{

... then further down in TerrainCellMaterial::_createPass() around line 281:

// How about parallax?
   const bool disableParallaxMaps = GFX->getPixelShaderVersion() < 3.0f || 
                                    MATMGR->getExclusionFeatures().hasFeature( MFT_Parallax );

   // BEGIN ADDED!
   // Has advanced lightmap support been enabled for prepass.
   bool advancedLightmapSupport = false;
   if ( prePassMat )
   {
      // This sucks... but it works.
      AdvancedLightBinManager *lightBin;
      if ( Sim::findObject( "AL_LightBinMgr", lightBin ) )
         advancedLightmapSupport = lightBin->MRTLightmapsDuringPrePass();
   }
   // END ADDED!

   // Loop till we create a valid shader!
   while( true )
   {


Then right after that around line 304:

if ( prePassMat )
      {
         features.addFeature( MFT_EyeSpaceDepthOut );
         features.addFeature( MFT_PrePassConditioner );

         if ( advancedLightmapSupport ) // ADDED!
            features.addFeature( MFT_RenderTarget1_Zero ); // ADDED!
      }
      else

That should do it... let me know if anyone has any further trouble with this.
#6
02/15/2011 (2:32 pm)
Yay! That seems to work fine and lightmaps look a lot better and the terrain isn't day-glow. Nice fix, Tom. :)
#7
02/15/2011 (5:22 pm)
Appears to be cool - nice work and thanx Tom :)
#8
02/16/2011 (8:04 pm)
Thanks for verifying the fix guys.