Surface/Vertice Normals and Scene Placement
I was just working on some Terrain generation code, and was about to start writing in some code to calculate surface/vertice normals. I was just reviewing some of the stuff I know about normals in my head when a little voice inside of me said...
"The vectors are based around the origin... objects move!"
Oh. It's true, objects move around the origin, as does the origin itself (in a sense).
So I said to myself... well, for my MD2s it's not so bad. I'll just use the precalc'd ones for for now, but what If I wanted to load a map or terrain and position it somewhere *other* than the origin? What if it had to *gasp* move?
Would I have to recalculate the surface normals every time the surface/meshes moved?
Or am I thinking about this wrong? Wait a minute... does the position of the object in question even matter?
Argh... brain block. Someone slap me please.
"The vectors are based around the origin... objects move!"
Oh. It's true, objects move around the origin, as does the origin itself (in a sense).
So I said to myself... well, for my MD2s it's not so bad. I'll just use the precalc'd ones for for now, but what If I wanted to load a map or terrain and position it somewhere *other* than the origin? What if it had to *gasp* move?
Would I have to recalculate the surface normals every time the surface/meshes moved?
Or am I thinking about this wrong? Wait a minute... does the position of the object in question even matter?
Argh... brain block. Someone slap me please.
Normals would only change if the mesh rotated or was scaled unevenly (more on one axis than the others.)
"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Leisure Suit Lurie Wrote:Normals would only change if the mesh rotated or was scaled unevenly (more on one axis than the others.)
Ahh, thanks for freeing me of that worry.

Today is not a healthy-brain day for me.
To elaborate a bit, normals are invariant under translation (as LSL indicated), and for other transforms (such as rotation and scaling) can be transformed by applying the inverse transpose of the original matrix. For pure rotation the inverse transpose is the same as the original matrix, which simplifies things somewhat. Also, depending on what type of transform you need to apply, and how often, there are shortcuts you can take to speed things up a bit.
Depending on what you need the transformed normals for, it also may be that they needn't be transformed at all. For example, lighting calculations can be performed in local model space, eliminating the need for transformation of the model's geometry.
Depending on what you need the transformed normals for, it also may be that they needn't be transformed at all. For example, lighting calculations can be performed in local model space, eliminating the need for transformation of the model's geometry.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| texture no square surface | kendric | 7 | 3,858 |
Mar 20, 2009 05:26 PM Last Post: kendric |
|
| surface rendering from data points | mc1961 | 6 | 4,207 |
Nov 15, 2007 03:37 PM Last Post: TomorrowPlusX |
|
| Trouble turning an SDL surface into an OpenGL texture | Joseph Duchesne | 4 | 5,004 |
May 22, 2007 05:14 PM Last Post: Joseph Duchesne |
|
| glNormal - Surface/Vertex normals | Jones | 19 | 12,900 |
Jul 18, 2006 12:45 PM Last Post: imikedaman |
|
| Getting surface x & y coords? | Jones | 4 | 2,851 |
May 7, 2006 04:29 PM Last Post: Jones |
|

