prev index next 
Rendering and Output 
 POV-Ray Tips, 
 Tricks, and Techniques
Tone Based on Distance from Camera? 
 
Daniel Connell asks for a new feature in POV-Ray: Distance based rendering, i.e. creates a greyscale image where the tone is based on the surface's distance from the camera. For use with stereograms and height fields.
 
Ken Cecka replies:
That can pretty much be achieved already.  I haven't played with it in a while, so I couldn't say exactly what all I did, but the general idea is to give every object a pure white pigment, and set the light source way back behind the camera.  That usually does the trick.  Also, a fog can help.  If you play with it a little, you can usually get a good image.
 
Scott Hill has another technique: Another way is to apply a gradient texture to all the objects, getting this exactly right can be a bit fiddly, but, basically you have the gradient starting either at the camera position or just in front of the nearest object and ending just behind to furthest object, if you make the gradient go from white (nearest camera) to black (furthest from camera) it's ideal for stereograms.

I probably haven't explained that very well, but I hope it helps a bit :)
 

Mark Mackey gives an authoritative answer: The easiest way to do this is to:

1) remove all textures from all objects
2) stuff the entire scene in one big union
3) Apply the following texture to the union:

#declare CAMERA_VECTOR=<look_at vector>-<camera location vector>
 // Direction vector for camera
#declare CAMERA_VECTOR=CAMERA_VECTOR/vlength(CAMERA_VECTOR)
 // Normalised
#declare LENGTH=100 // or whatever seem to work. Fiddle with this
 // until the farthest objects are a dim gray.

pigment{
  gradient CAMERA_VECTOR*LENGTH
  color_map {
    0 color White
    1 color Black    // these may be the other way around: I can't
  // remember :)
  }
  translate <camera location vector>
}

Done, and a helluva lot easier and more accurate than faffing around
with fogs.
 

  1