I need to compute normals for volume analytically. Unfortunately I do not know what that exactly means. I know the method of computing the normal of a voxel using the central difference, but am not sure what is meant by computing normals ‘analytically’. Can someone please help.
Moving to math and algorithms.
Calculating analytically means calculating an exact solution by analysing the formula that is used to define the volume, opposed to calculating polygons and then calculating the normals of these, which is only an approximation…
In general you have to take the parametric representation of the surface f(u,v) = (x(u,v), y(u,v), z(u,v)). Then take the partial derivatives of this function df/du and df/dv. The normal vector is the cross product of these two.
This can become quite complex for arbitrary surfaces. I suggest taking a calculus course (or is this a homework of a calculus course? )
For simple surfaces like nurbs I’m sure you can find formulas on the net. Also for really simple ones it might be a lot easier to just “guess” the correct solution by logical reasoning. For example, the normal of a sphere is always the same as the vector from the center to the surface, for a cylinder it’s the shortest vector from the axis to the surface, and so on… But I wouldn’t recommend this if this is a homework
Thanks for the reply. I understand how to compute normals using formulas and that for a sphere, the normal on the surface is an outward vector from the center to the point on the sphere. But I wanted to know about what ‘finding normals analytically’ means for a volume. I need it for lighting in volume rendering.
The normal for an implicit surface F=0 is the gradient of the function F.
You can’t really find a normal of a volume, you can only find a normal for the surface of a volume (assuming we’re talking about 3D space here). For that you have to find some representation for the surface.
You could generalize that to finding the normal of the isosurfaces of a scalar field F, that is, find the normal of the implicit surface F=c (c being an arbitrary constant). You could call that a normal of a volume, but I’m not sure if that’s what you want…
Like gumby said, the normal of the isosurface is the gradient of F (c=0 is only a special case…).