NoRenderBans bug
by Tom Spilman · in Torque Game Engine Advanced · 12/28/2004 (1:36 pm) · 7 replies
When noRenderBans is set to true the sky uvs are wrong for the sides of the skybox:

I tested this same thing in TGE and it works just fine. I'm debugging this myself now with hopes to post a fix.

I tested this same thing in TGE and it works just fine. I'm debugging this myself now with hopes to post a fix.
About the author
Tom is a programmer and co-owner of Sickhead Games, LLC.
#2
The older TGE code looks like this:
The TGE code works... the TSE code does not. I'm not even exactly sure what the point of adding 'lowerBanHeight' to the function arguments or the reason for changing how the lower texture coords are calculated are. It seems like an unessasary change.
12/28/2004 (2:04 pm)
The bug is in Sky::calcTexCoords(). The TSE code looks like this:void Sky::calcTexCoords( Point2F* texCoords, Point3F* renderPoints, S32 index, F32 lowerBanHeight )
{
// Initialize the co-ords
for(S32 i = 0; i < 4; ++i)
texCoords[i].set(mTexCoord[i].x, mTexCoord[i].y);
// Update the co-rds for the lower points on the face - have to make sure
// texture stays the same while geometry changes.
// BJGHACK - scaled by two, looks more convincing...
texCoords[2].y = texCoords[3].y = 0.5f - mFabs(renderPoints[3].z / (2*mPoints[3].z));
}The older TGE code looks like this:
void Sky::calcTexCoords(Point2F* texCoords, Point3F* renderPoints, S32 index)
{
for(S32 x = 0; x < 4; ++x)
texCoords[x].set(mTexCoord[x].x, mTexCoord[x].y);
S32 length = (S32)(mFabs(mPoints[index].z) + mFabs(mPoints[index + 5].z));
F32 per = mPoints[index].z - renderPoints[3].z;
texCoords[3].y = texCoords[2].y = (per / length);
}The TGE code works... the TSE code does not. I'm not even exactly sure what the point of adding 'lowerBanHeight' to the function arguments or the reason for changing how the lower texture coords are calculated are. It seems like an unessasary change.
#3
Thanks for finding this fix, Tom. On my todo list (if Brian doesn't beat me to it).
12/28/2004 (2:43 pm)
I think it was mostly me porting the skybox code over in a bumbling manner. Not being clear on what was going on I ripped stuff apart. :)Thanks for finding this fix, Tom. On my todo list (if Brian doesn't beat me to it).
#4
12/29/2004 (10:47 am)
I'm 3000 miles away from fixing it right now ;) If you could get this one that would kick ass Ben.
#5
12/30/2004 (8:47 am)
I'm 120 miles away, but only till Monday. We can race across the country to see who gets it into CVS. ;)
#6
12/30/2004 (1:51 pm)
Lol, race! race!
#7
01/05/2005 (5:28 pm)
OK, checked in. I win, I guess ;)
Associate Tom Spilman
Sickhead Games