Game Development Community

[1.1 Beta 1 Bug] Water with fullreflect does not reflect terrain - RESOLVED

by Ryan Mounts · in Torque 3D Professional · 03/02/2010 (12:23 pm) · 10 replies

The title is pretty self explanatory. I know the water shader got updated for Beta 1.1, and it looks much better, especially the specular. But turning on full reflections no longer reflects the terrain. Is this a bug, or was it intentional?

i291.photobucket.com/albums/ll284/rmounts/WaterReflect.jpg
i291.photobucket.com/albums/ll284/rmounts/WaterNoReflect.jpg

#1
03/02/2010 (1:47 pm)
I found an fixed this just yesterday. In engine/source/math/util/frustum.cpp around line 94:

void Frustum::set( const Frustum& frustum )
{
   mNearLeft = frustum.mNearLeft;
   mNearRight = frustum.mNearRight;
   mNearTop = frustum.mNearTop;
   mNearBottom = frustum.mNearBottom;
   mNearDist = frustum.mNearDist;
   mFarDist = frustum.mFarDist;
   mIsOrtho = frustum.mIsOrtho;

   mTransform = frustum.mTransform;
   mBounds = frustum.mBounds;

   mNumTiles = frustum.mNumTiles;
   mCurrTile = frustum.mCurrTile;
   mTileOverlap = frustum.mTileOverlap;

   // ADDED!
   dMemcpy( mPoints, frustum.mPoints, sizeof( mPoints ) );
   dMemcpy( mPlanes, frustum.mPlanes, sizeof( mPlanes ) );
   mDirty = frustum.mDirty;
}

That sould fix that for you.
#2
03/02/2010 (3:11 pm)
Alas, I'm not seeing a fix with this, Tom. I'll just recheck I did it right

Also objects placed by ForestEditor don't appear to reflect either.

EDIT:
Hold the frontpage, I did mess up the code! Will repost shortly.

Edit Part2:
No, don't see a difference.
#3
03/02/2010 (3:43 pm)
Yeah, that didn't fix it for me either.
#4
03/03/2010 (4:35 pm)
Ah... missed one other part of that fix. In the same file:

void Frustum::invert()
{
   _updatePlanes(); // ADDED!
   for( U32 i = 0; i < PlaneCount; i++ )
      mPlanes[i].invert();
}

Those two fixes combined should fix terrain and forest.
#5
03/03/2010 (5:13 pm)
Terrain shows up now, but forest doesn't.
#6
03/04/2010 (6:46 am)
That fixed it! Terrain and forest both reflect properly for me... don't know why the forest wouldn't be working for you, Steve. I have noticed, however, that decals do not reflect.

i291.photobucket.com/albums/ll284/rmounts/decal_reflect.jpg
#7
03/04/2010 (8:15 am)
Aha ...

ReflectTexSize=256; no forest reflection

ReflectTexSize=512; forest reflects

In fact with 256 objects don't reflect at all.

EDIT
Double Aha!!

ReflectTexSize is rendering LODs of objects! 256 is lowest LOD and mine are empty/blank to force non-rendering of object at distance. Set to 512 and the BillBoards of my trees render. Set to 1024 and the next LOD up renders.

That's really smart thinking for performance.

:)
#8
03/09/2010 (10:55 pm)
@Steve

Yea... since DTS lod is screen space based a lower resolution reflection texture will cause some things to LOD out.

But you can compensate for that. The 'reflectDetailAdjust' field on the water will allow you to reduce or increase the LOD selection in the reflection.

#9
08/21/2010 (7:49 am)
Logged as TQA-867.
#10
08/22/2010 (6:33 am)
FYI... this bug was fixed in 1.1 beta 2.