Game Development Community

T3D 1.1 Final - more than 1 object with same cubemap render bug? - LOGGED (THREED-2488)

by Fyodor -bank- Osokin · in Torque 3D Professional · 08/24/2011 (2:21 am) · 4 replies

Build: Torque 3D 1.1 (1.0 is affected too)

Platform: Win32

Target: GFX/Cubemap

Real problem: Cubemaps and Instancing are not compatible with each other.

Issues:
1. At some angles, while both shapes in view, the cubemap "resets" when you "looking around" (the first 10 seconds of the video).
2. Two TSStatics with same material (with cubemap enabled) are somehow affecting each other (the rest of the video).

Video:


Steps to Repeat:
Start empty template, drop [meshes]art/shapes/rocks/boulder.dts, switch to Material Editor, set Cubemap to something like "NewLevelSkyCubemap" (which I used for screenshots).
Now, copy the TSStatic and fly around.

Suggested Fix:
No real fix yet, but workaround exists:

The quick-fix (workaround) is:
In processesShaderMaterial.cpp
inside void ProcessedShaderMaterial::_determineFeatures
Before this for loop:
...//skipped
   // Allow features to add themselves.
   for ( U32 i = 0; i < FEATUREMGR->getFeatureCount(); i++ )
...//skipped
Add:
if(fd.features.hasFeature( MFT_CubeMap) && fd.features.hasFeature( MFT_UseInstancing ) )
   fd.features.removeFeature( MFT_UseInstancing );

#1
08/24/2011 (6:09 am)
I'm not seeing that happen on my box, Bank.

Nvidia GTS 250 (512mb).
#2
08/24/2011 (10:08 am)
I was able to reproduce this issue. Logged as THREED-2488.
#3
02/02/2012 (9:22 am)
Looks like it's the instancing being not compatible with cubemap.
The quick-fix (workaround) is:
In processesShaderMaterial.cpp
inside void ProcessedShaderMaterial::_determineFeatures
Before this for loop:
...//skipped
   // Allow features to add themselves.
   for ( U32 i = 0; i < FEATUREMGR->getFeatureCount(); i++ )
...//skipped
Add:
if(fd.features.hasFeature( MFT_CubeMap) && fd.features.hasFeature( MFT_UseInstancing ) )
   fd.features.removeFeature( MFT_UseInstancing );

Edit: updated initial post with workaround.
#4
02/02/2012 (10:59 am)
Well spotted.