# Smoothing me some normals.

This topic is 800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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

Edited by haegarr

##### 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 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 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 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 on other sites

Okay thanks guys. For my models I'm just using assimp to smooth them for me. I have self-made heightmap-to-model class. That's what I needed to smooth them for.

##### Share on other sites

This topic is 800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.