Jump to content
  • Advertisement
Sign in to follow this  
serious_learner07

per pixel normals

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

I assume that normals are computed from the given vertices. Suppose v1,v2 and v3 are the vertices, then normals of the vertices are calculated by taking the cross products of the edge vectors.i.e cross_product((v1-v2),(v2-v3)) for vertex v2 and so on. Then where is the necessity for computing per pixels normals.

Share this post


Link to post
Share on other sites
Advertisement
First assumption is usualy incorrect in practice.

The vertex normals are usualy the weighted average of the face normals of each face which shares a vertex.

Per-pixel normals are usualy from an interpolation across the polygon of those averaged vertex normals.

Share this post


Link to post
Share on other sites
Quote:

Then where is the necessity for computing per pixels normals.

To make it short: for better looking, more physically correct shading of curved surfaces.

What you describe is called flat shading since you'd get the same normal for all 3 vertices (they all lie in the same plane).
Per pixel normals are - like Rockoon1 said - interpolated across the polygon to provide for smoother shading (no hard edges as with flat shading). For correct results you'd also have to adjust the length of the interpolation results.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!