Jump to content

  • Log In with Google      Sign In   
  • Create Account

EngineCoder

Member Since 02 May 2009
Offline Last Active Nov 02 2012 09:43 AM

#4940468 What's wrong with my tangent calculation?

Posted by EngineCoder on 15 May 2012 - 11:22 AM

tangent   = (deltaP1 * deltaUV2.v - deltaP2 * deltaUV1.v) / area;
bitangent = (deltaP1 * deltaUV2.u - deltaP2 * deltaUV1.u) / area;
I don't think you can trust your UV coordinates to point in the right direction: deltaUV1 and deltaUV2 and area can have "bad" signs and any sign change determines whether your normal (implicit from the choice of tangent and bitangent) points towards the front or the back.

Can you explain how do you relate UV coordinates to triangle facing?

Most tutorials do it that way, like: http://www.terathon.com/code/tangent.html


#4939322 Camera Intilization in OpenGL ES 2.0

Posted by EngineCoder on 11 May 2012 - 09:43 AM

Here's my lookat() implementation:
void Matrix::makeLookAt( const Vec3& aEye, const Vec3& aCenter, const Vec3& aUp, float* aMatrix )
{
    assert( aMatrix );
    Vec3 forward = aCenter - aEye;
    forward.normalize();
   
    Vec3 right = forward.cross( aUp );
    right.normalize();
   
    const Vec3 up = right.cross( forward );
   
    aMatrix[ 0 ] = right.x;
    aMatrix[ 4 ] = right.y;
    aMatrix[ 8 ] = right.z;
    aMatrix[ 12 ] = 0;
   
    aMatrix[ 1 ] = up.x;
    aMatrix[ 5 ] = up.y;
    aMatrix[ 9 ] = up.z;
    aMatrix[13 ] = 0;
   
    aMatrix[ 2 ] = -forward.x;
    aMatrix[ 6 ] = -forward.y;
    aMatrix[10 ] = -forward.z;
    aMatrix[14 ] = 0;
   
    aMatrix[ 3 ] = aMatrix[ 7 ] = aMatrix[ 11 ] = 0.0f;
    aMatrix[15 ] = 1.0f;
    float translate[ 16 ];
    Matrix::identity( translate );
    translate[ 12 ] = -aEye.x;
    translate[ 13 ] = -aEye.y;
    translate[ 14 ] = -aEye.z;
   
    multiply( translate, aMatrix, aMatrix );
}



#4844925 Difference between Game Engine and APIs

Posted by EngineCoder on 05 August 2011 - 03:44 AM

Is XNA a game engine?
Are drivers the *.dll files which interact with the hardware?




XNA is not a game engine, it's a framework.
DLL files can contain many things, including drivers.


PARTNERS