Jump to content
  • Advertisement
Sign in to follow this  
GearTreeEntertaiment

Smoothing me some normals.

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

Best way to smooth normals. I know of one method, not sure if it's very memory efficient.

I just want a general method to smooth the lighting normals of a mesh.

 

Thanks for the answers if I get any...

Edited by ?GTE?

Share this post


Link to post
Share on other sites
Advertisement

Best way to smooth normals. I know of one method, not sure if it's very memory efficient.

The informations you gave us are very sparse.

 

1. Which criterion do you use to qualify what good, better, and best is in this context?

2. What does "smooth normals" mean? An average of normals as it occurs when computing a vertex normal from the normals of surrounding faces? Or an interpolation of normals as it occur to fill gaps between samples? Or realigning existing normals to appear smoothly arranged? Or something else?

3. Which method is the one you know?

4. How is normal "smoothing" meant to be memory efficient / inefficient?

Edited by haegarr

Share this post


Link to post
Share on other sites

 


Best way to smooth normals. I know of one method, not sure if it's very memory efficient.

The informations you gave us are very sparse.

 

1. Which criterion do you use to qualify what good, better, and best is in this context?

2. What does "smooth normals" mean? An average of normals as it occurs when computing a vertex normal from the normals of surrounding faces? Or an interpolation of normals as it occur to fill gaps between samples? Or realigning existing normals to appear smoothly arranged? Or something else?

3. Which method is the one you know?

4. How is normal "smoothing" meant to be memory efficient / inefficient?

 

 

Most memory efficient way I mean. Sorry for not clarifying at first. 

Share this post


Link to post
Share on other sites

My suggestion is just to try it and see if it meets your needs. Unless you are calculating normals every frame for a lot of geometry the performance and memory usage doesn't have to be optimal.

Share this post


Link to post
Share on other sites
// set all normals to zero
for each vertex normal (n)
  n = 0,0,0

// add in each face normal to each vertex normal
for each face
  fn = calculate face normal 
  for each vertex normal in face (vn)
     vn += fn

// normalize normals
for each vertex normal (n)
  normalize(n)

Share this post


Link to post
Share on other sites
// set all normals to zero
for each vertex normal (n)
  n = 0,0,0

// add in each face normal to each vertex normal
for each face
  fn = calculate face normal 
  for each vertex normal in face (vn)
     vn += fn

// normalize normals
for each vertex normal (n)
  normalize(n)

This algorithm calculates a vertex normal by averaging normals of surrounding faces. While there is nothing inherently wrong with it, one usually wants to consider a weight so that the face normals have differently rated influence. A typical weights are the face areas, another is the angle of the face at the vertex of interest.

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!