   volume rendering and local illumination
  For local illumination of volume rendering, we assume the lightreflects at the isosurfaces.  And the common way to get the normal ata point on the isosurface is from the gradient.However, I have a question: How do we know if the gradient vector willbe an inward or outward facing normal?  I noticed that I was notgetting correct lighting, but when I reversed the direction of thegradient, the lighting came out correct.   
  The gradient of a function always points in the direction in which the function increases. If your function is positive inside objects and negative outside, then the gradient faces inward. Otherwise it faces outward.   