Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Need Help calcualting Tangent and Bi-normals using normals  (Read 589 times)
0 Members and 1 Guest are viewing this topic.
Offline Vorax

Senior Member


Projects: 1


System shutting down in 5..4..3...


« Posted 2005-06-05 01:22:58 »

I am having difficulties implementing bump maps on 3D objects.

I want to use the plane's smoothed normals to calculate the tangent and then do a crossproduct to get the bi-normal.

I have been over the entire web (or it feels like it), looking for an equation that will do this, but have found nothing Sad  All the tutorials and source everywhere that I have found use either the TBN loaded from the model (like POF models, which mine aren't, nor do i have SMax), or calculate the TB.N while calculating the geometry.

If I take the standard approach of delta p1->p2 cross delta p1->p3, I loose the smoothed normal and end up with flat looking surfaces.

Cas, if your out there... you said this was easy (and I agreed)...I correct us (or at least me)...XY plane parallel bump mapping with generated quads or triangles is easy  - complex surface bump mapping with accurate normals is not the same.  Cry

Can anyone help?


Offline Spasi
« Reply #1 - Posted 2005-06-05 16:20:29 »

The tangent is calculated per triangle (just like the normal). It depends on the vertex positions and their UVs. You've apparently found how to calculate this and it's what gives the triangulated look of your objects. Then, just like normals, you have to calculate the average tangent for each vertex, by averaging the tangents of the surrounding triangles. Same for the binormal, unless you calculate it on the fly (using a cross in a vertex shader). The difficult part is to decide how to smooth your tangents (e.g. the problem with mirrored UVs).
Offline Vorax

Senior Member


Projects: 1


System shutting down in 5..4..3...


« Reply #2 - Posted 2005-06-05 18:30:21 »

Thanks for your reply Spasi, but I have figured out what's gong on.

It was a 12-IFK (12 inches from the keyboard)... me.

I am embarrased to say that I having been using the WRONG crossproduct method for a WEEK!  My vector class has several cross product versions, they all work correctly, but they each do different assignments to either the vector itself, or the vectors sent to the them as parameters.  The one I was using stores the result back into the first parameter and I thought I was using the one that stores it back into the vector itself!   DOH!!! 

This exaplains why I was having so many  unexplainable problems.   I relearned an old lesson - don't take anything for granted, especially when debugging.


Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Try the Free Demo of Revenge of the Titans

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (84 views)
2013-05-17 21:29:12

alaslipknot (92 views)
2013-05-16 21:24:48

gouessej (123 views)
2013-05-16 00:53:38

gouessej (115 views)
2013-05-16 00:17:58

theagentd (127 views)
2013-05-15 15:01:13

theagentd (114 views)
2013-05-15 15:00:54

StreetDoggy (158 views)
2013-05-14 15:56:26

kutucuk (180 views)
2013-05-12 17:10:36

kutucuk (180 views)
2013-05-12 15:36:09

UnluckyDevil (187 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.094 seconds with 20 queries.