Game Development Community

[BUG 1.1Beta1] Bad Terrain Shadowing (too much) - LOGGED

by Steve Acaster · in Torque 3D Professional · 02/13/2010 (12:34 pm) · 25 replies

I'd been thinking that there was too much shadowing on terrains, and back ported a test level from 1.1b1 to 1.0.1.

img691.imageshack.us/img691/2518/terrainshadowbeta1.jpg

Pic uses same values for both versions - sun is in same position, camera is at ground level, in same (as close as I could get it) place, and the terrain in 1.1b1 can see the sun and thus should not be in shadow. It appears to overcompensate quite dramatically for lightly sloping terrain.

Everything stock except for player model.
Page«First 1 2 Next»
#21
06/11/2010 (5:25 pm)
Apologies if this is already covered (Steve did mention it in the "requesting bugs" thread)... I hate to flood the new forum updates page with old stuff, but considering the current QA push I wanted to bump this issue and make sure they're taking a look at it since we haven't heard anything in a while.

There's a lot of back and forth (and plenty of me being long-winded) in this thread, but basically it appears that on some (???) systems the terrain lighting is ignoring the "squaresize" scaling element, lighting the terrain as though it were always set to squaresize 1 and producing exaggerated light&dark shading based on elevation changes. Does not impact cast shadows, only terrain lighting. Did not exist in version 1.0.1.

Again, sorry to bump, just didn't see anyone QA-tag this and it is a fairly notable visual bug.
#22
07/14/2010 (1:48 am)
Logged: TQA-561
#23
08/27/2010 (8:04 pm)
Looked a bit into it and talked to Tom. Steve, he says to make the following change and let him or I know if that solves the problem. I'll put the thread on watch.


Line#568 of EnginesourceterrainterData.cpp:
Quote:Line 550 for the commoners without repo.

bool TerrainBlock::getSmoothNormal( const Point2F &pos, 
                                    Point3F *normal, 
                                    bool normalize,
                                    bool skipEmpty ) const
{
	PROFILE_SCOPE( TerrainBlock_getSmoothNormal );

   F32 invSquareSize = 1.0f / mSquareSize;
   F32 xp = pos.x * invSquareSize;
   F32 yp = pos.y * invSquareSize;
   S32 x = S32(xp);
   S32 y = S32(yp);
   
   const U32 blockMask = mFile->mSize - 1;

   if ( x & ~blockMask || y & ~blockMask )
      return false;
   
   x &= blockMask;
   y &= blockMask;
   
   const TerrainSquare *sq = mFile->findSquare( 0, x, y );
   if ( skipEmpty && sq->flags & TerrainSquare::Empty )
      return false;

   F32 h1 = fixedToFloat( mFile->getHeight( x + 1, y ) );
   F32 h2 = fixedToFloat( mFile->getHeight( x, y + 1 ) );
   F32 h3 = fixedToFloat( mFile->getHeight( x - 1, y ) );
   F32 h4 = fixedToFloat( mFile->getHeight( x, y - 1 ) );

   normal->set( h3 - h1, h4 - h2, mSquareSize * 2.0f );//CHANGE LINE HERE
#24
08/27/2010 (10:11 pm)
Yep, I think that's done the trick. :)

My grass and inclines are now shadowing the same.

[edit]
yeah that's great. Line 550 for us commoners without repo :P
if Sickhead were a lady I'd send her chocolates ... and vodka!
#25
08/27/2010 (10:20 pm)
Awesome, let me know if it makes anything else explode.
Page«First 1 2 Next»