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...
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...
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?
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.
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.
// 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)
// 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.