Jump to content
  • Advertisement
Sign in to follow this  
d000hg

Pre-calculating Dot3 Light vectors?

This topic is 4865 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

Hi there. I've always assumed this is something I could do but when I refreshed myself on the details of Dot3 I think maybe I misunderstood... A Dot3/Normal map has normals stored in the rgb data of the texture. These normals are in the 'triangle space' defined by the orientation of the triangle. At each vertex/pixel, we need a lighting vector, which is the world directional light vector transformed into the 'triangle space'. That part is fine. However, shouldn't the camera position affect things? As you view the same point from different angles, shouldn't the normal-mapping be affected? Or is that only for specualr effects? If so, I can precalculate a transformed light vector for each vertex in my terrain and get full-scene normal-mapping on a GF2MX!

Share this post


Link to post
Share on other sites
Advertisement
Hi there,

First, yes, diffuse lighting is independent of viewing position.

Specular lighting is, but your normal texture is still fine to use with it. To calculate specular you basically take into account these 3 factors:
- per-fragment normal vector
- light position
- viewer position

I'm not sure it's possible to calculate per-pixel specular on GF2MX however.

GL!

Share this post


Link to post
Share on other sites
Quote:
Original post by d000hg
A Dot3/Normal map has normals stored in the rgb data of the texture. These normals are in the 'triangle space' defined by the orientation of the triangle.


The normals are NOT necessarily in 'triangle space' or tangent space. They can be in any space you want. For animated characters, tangent space is probably best since when triangle orientation changes due to animation, you'd get problems with other spaces. But for static terrain other spaces (like object space) might also be fine. The big advantage: You just have to transform the light vector once into object coordinates and not many times into the tangent coordinates of every triangle.

Quote:
...and get full-scene normal-mapping on a GF2MX!

Per-pixel diffuse is no problem. It's even quite fast. From the times I had a GF2MX I remember that specular is possible with register combiners, but you are limited to specular exponents of 2, 4, 8 and 16 (since you compute something like r=specular dot product thing; r=r*r; r=r*r; ...). However, I'm absolutely not sure whether I remember correctly.

Lutz

Share this post


Link to post
Share on other sites
I'm using D3D so I think that option isn't available. I'd be happy to get normal-mapping on my terrain detail textures for a GF2 though. Specular may have to be limited but I can live with that.

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!