Game Development Community

[Beta 4 Bug] Sun Shadows and Static Shapes

by Jason Parker · in Torque 3D Professional · 06/24/2009 (6:09 pm) · 8 replies

In beta 3 I've started getting some odd lines in the space between a sun shadow cast on a static shape by a short wall on the shape, and the next wall.

The test object is the stock Station asset. The location is the upper balcony.

Screenshot:
www.tairisnadur.com/themi/demos/screenshots/beta3/beta3_sunshadow_on_shape.jpg
This did not occur in beta 2. This only seems to affect static shapes so far, can't seem to find it anywhere else. This does not occur with higher sun angles.

I've also noticed that the lighting has become blown out again at the same settings that seemed to work well in beta 2. Not a bug, can be tweaked. Just thought I'd mention it.

#1
06/26/2009 (2:55 pm)
Logged as THREED-529
#2
06/26/2009 (6:37 pm)
I noticed a screen shot showing what appears to be the same issue in this thread.
#3
07/21/2009 (2:40 pm)
Still exists in beta 4. Re-tagging.
#4
07/28/2009 (3:15 pm)
@Jason - Please give this fix a try ASAP.

In lightingadvancedhlslgBufferConditionerHLSL.cpp in function GBufferConditionerHLSL::_conditionOutput() around line 252 replace this else-if block:

else if ( mBufferFormat == GFXFormatR16G16B16A16 ||
             mBufferFormat == GFXFormatR16G16B16A16F )
   {
      const U32 maxValPerChannel = 1 << 16;
      meta->addStatement( new GenOp( "   \r\n   // Encode depth into hi/lo\r\n" ) );
      meta->addStatement( new GenOp( avar( "   @.zw = frac(@.a * (%d.0 / %d) * float2(1, %d));\r\n\r\n", maxValPerChannel - 1, maxValPerChannel, maxValPerChannel - 1 ), 
         retVar, unconditionedOutput ) );
   }

And a little below in function GBufferConditionerHLSL::_unconditionInput() around line 310:

else if ( mBufferFormat == GFXFormatR16G16B16A16 ||
             mBufferFormat == GFXFormatR16G16B16A16F )
   {
      const U32 maxValPerChannel = 1 << 16;
      meta->addStatement( new GenOp( "   \r\n   // Decode depth\r\n" ) );
      meta->addStatement( new GenOp( avar( "   @.w = dot( @.zw * (%d.0/%d), float2(1, 1/%d));\r\n\r\n", maxValPerChannel, maxValPerChannel - 1, maxValPerChannel - 1 ), 
         retVar, conditionedInput ) );
   }

Let me know if those changes solve this for you.
#5
07/28/2009 (3:37 pm)
Adding and compiling now, I'll report back in a few.
#6
07/28/2009 (3:51 pm)
Bah... doesn't look like it fixed it.

Regardless that change should have fixed some precision issues with shadow and postfx depth on Geforce cards. It also should reduce the fillrate hit in reading and writing from the gbuffer depth.
#7
07/28/2009 (3:53 pm)
Sorry, no change with the issue. Double checked that the changes were saved in the .cpp, and double checked that the EXE I ran was the one just compiled.
#8
07/30/2009 (5:04 pm)
Ok... a real fix.