6.6 Automated Z-buffer ranges

Here we made an easy setup with two effectors to control the fog ranges in the world objects Fog/Ambient/BG tab. This can be used to automatically adjust Z-buffer values for compositing and depth of field effects. If your camera is moving, the fog ranges will be adjusted dynamically - you can have an object always in focus of your
Z-buffer. Or you use the effectors to animate the focus of the Z-buffer. You have perfect control.

Click the image to get a larger view.

We have created two effectors and named them "Far" and "Near". Since the fog values in Animator are always the distance to the camera you are currently using we will use the effectors positions to calculate the distance to the camera position and feed the result into the fog channels.

World.Fog.FogInsideRadius = distance( Camera_1.Position, Near.Position );

World.Fog.FogOutsideRadius = distance( Camera_1.Position, Far.Position );

The distance function uses two vector arguments and returns the current distance between the two vectors. The distance between the Near effector and the Camera will be assigned to the Inside Fog Radius. The distance between the Far effector and the Camera will be assigned to the Outside Fog Radius.

get project file zbuffer_ranges.prj

Xpressionist 3.5