Sign in to follow this  
serious_learner07

per pixel normals

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this