# gouraud shading

I am using a trick to compute normal in gouraud shading with marching algo or nurbs rendering, and I would like to know if it’s a good one, and if it is possible to improve it.
Instead of averaging the normals of the face around the vertex, I make a weighted sum with the inverse a the area of the face. I do that because small faces often occure in region of high curvature (at least for the marching cube algo…).

I think it is a good idea. That means the normals will affect more the largest faces it has. And the small ones will be less lit.

The only problem I could see is if you have small face surrounded by a bunch of large faces, you might get someking of light discrepancy. It just depends what tesselation algorithm you use.

I think it is worth a try

Sounds interesting and should be worth a try.
If you weight the normals with the inverse of the area, the smaller get more influence.
The problem could be that the larger polygons would not occur as flat as they are (thinking of a cube with one rounded edge), but that really depends on the sizes.

The way to generate normals in the marching cube algorithm usually uses central differences on the dendsity values in all three axis. Slow, but works perfect for me.

Hum… could u tell me more about the way u compute normals : what I understood is that u use the gradient (the vector of the partial derivates), is it what u mean
(mathematicaly speaking, it is perfect, since the gradient is orthogonal to the surface, but I don’t know if it give a good result…)
but why do u say that it is slow?? It seems to be much more efficient than my method :
I keep every point in a kind of array [I use a trick to only use a 2d array, hehe ] so that I can know for each vertex which face is around it, and then I use my trick to simulate curvature…

Tell me more about your method, I am so interested, bc I want to make a 3D maths engine (to draw curve and so on… medical application are great), and of course ploting scalar field is an important part of what I have to do!!
keep in touch!

Hey!! I’ve just tried your technique, and it looks so great!!
Thank u so much…
I am so sad I didn’t find it on my own…

Fine

Well, I read the standard article from William Lorensen and Harvey Cline. I think the method for the normals was in there.

With slow, I meant computationally expensive.
You can either calculate the gradients in axis direction for each interpolated point on the cube’s edge, but this needs more calculations of the density. Or you have to interpolate the normals calcalated at the cubes vertices if required and interpolate those linearly along the edge. Both needs lots of normalization. The latter is faster and as in average only three edges get calculated anew, this can be optimized a lot.

But I was on a trip to realtime implicit surfaces and marching cubes with O(n^3) seemed not fast enough. I’ve not finshed my studies on other algorithms.

And there was link with sources on www.opengl.org recently.