Game Development Community

T3D 1.1 Beta 3 - bad quad uv mapping [+FIX] - RESOLVED

by Fyodor -bank- Osokin · in Torque 3D Professional · 03/15/2011 (10:28 am) · 7 replies

Build: T3D 1.1 Beta 3 Pro

Platform: Windows (not sure about Mac/Linux)

Target: quad uv mapping

Issues: It looks like the "Wild Magic" doesn't work as it should
(from Engine/source/math/util/quadTransforms.*), as it does some "magic" calculations inside BiQuadToSqr::BiQuadToSqr().
If we change (from debugger) m_kD (x or y) to something else from 0.f or 3.78e-7 (or some other crazy "diagonal dist") like 1.f -- it renders fine.

This easily can be seen with short roads - those rendered in a bad way:

nVidia (looks like those are just rendering what it have, while ATI skips the rendering of bad data).
www.dedicatedlogic.net/_files/t3d11b3_quad_uv_bug_nvidia_1.jpgATI
www.dedicatedlogic.net/_files/t3d11b3_quad_uv_bug_ati.jpg
Another creativeness from nVidia:
www.dedicatedlogic.net/_files/t3d11b3_quad_uv_bug_nvidia_2.jpg
Steps to Repeat:
Place one-segment road or use mission file from this archive.

Thread with discussion of the similar problem: UV mapping a quad.

Suggested Fix:
Change BiQuadToSqr::BiQuadToSqr so it looks like this:
BiQuadToSqr::BiQuadToSqr(  const Point2F &p00, 
                           const Point2F &p10, 
                           const Point2F &p11, 
                           const Point2F &p01 )
   : m_kP00( p00 )
{
   m_kB = p10 - p00;   // width
   m_kC = p01 - p00;   // height
   m_kD = p11 + p00 - p10 - p01; // diagonal dist

   if(mFabs(m_kD.x) < POINT_EPSILON) m_kD.x = 0.f;
   if(mFabs(m_kD.y) < POINT_EPSILON) m_kD.y = 0.f;

   m_fBC = mDotPerp( m_kB, m_kC );
   m_fBD = mDotPerp( m_kB, m_kD );   
   m_fCD = mDotPerp( m_kC, m_kD );
}
Added check for "zero".

#1
03/15/2011 (10:46 am)
Just got a nice values while debugging: linky
#2
03/16/2011 (12:10 am)
Greetings!

Logged as THREED-1482. Thanks!

- Dave
#3
03/16/2011 (6:17 am)
Original post updated with the fix.
#4
03/31/2011 (2:03 pm)
@Fyodor - I've tried to repo this case both by creating a single segment decal road, and by loading the level that you've provided. Wasn't able to get a repo in either case, but there's a couple of interesting things about the level you posted. Would you mind including the terrain, materials, ect in the .zip so that I can confirm that we are looking at the same thing?
#5
04/01/2011 (1:56 am)
Weird..
I had it logged as a bug since July 2010, and only recently we've come back to it.

Just tried to apply my fix to rev.30444 (when we first got this) -- and it DOES NOT fix issue for ATI, but with NVidia works fine.

Than...
Checked the latest rev I have (rev.33279) -- bug still there, and my changes does fix the issue for both -- the ATI and NVidia.

re: I'm using stock "Full" template -- materials, terrain and everything else is unmodified. I can easily reproduce it just by creating a 1 segment road in stock full template.
#6
04/01/2011 (4:35 pm)
Cool, thanks for that information. Got the fix checked in, so thanks for that too!
#7
04/24/2011 (3:20 pm)
Fixed in 1.1 Final and Preview.