Jump to content
  • Advertisement
Sign in to follow this  
TheDmD

OpenGL Confused about per-pixel lighting and tangent space

This topic is 4329 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, Per pixel lighting is simple and popular technique. Unfortunately I'm no lucky. I have done many test and even more shaders. Results always were other than I expect. There are any 'standard' approach do deal with? I always had problems with generating tangent space matrix for vertices. Actually, I don't know this correct or not. I can check that one vector is prependicular to second but results still do not satisfy me. I think, the mesh has some 'internal' bugs, because is looks absoluely different in 3D Studio and in my viewer. I have tried write 3DS file reader to avoid whole model system but I'm stuck in tangent space generation again! So I have a few questions: 1) How to propertly calculate tangent space form simple mesh (ie. triangles)? 2) From where can I know that results are correct? 3) Is it depdendent of RH camera? 4) Effect depends form hadrware (aka. results are this same on nVIDIA and ATI)? 5) Where is the difference between D3D and OpenGL? I hear about different UV mappings, but there is something more? Lighting depends form tangent stuff, so it cannot be correct until problem is not solved. I think, my shaders are correct. Thanks for are replies. TheDmD

Share this post


Link to post
Share on other sites
Advertisement
AFAIK you don't need tangent space to compute lighting at all. I'm quite confident that I wrote a shader once that did that without using tangent space. You would like to use tangent space for some effects like normal mapping (a way to perform bump mapping).
this is a link to a 3ds loader I wrote a while ago that computes tangents, normals and and bitangents. I never updated the documentation of the lib, but the sources is quite simple and short (only one cpp file, IIRC).
Hope this helps.

Share this post


Link to post
Share on other sites
Actually I need tangent space exacly for normal maps. :)

Thanks for source. I will use it to compare results. After that I will post some more informations.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!