Click to go Home  
 
REALSOFT 3D
About
History
News
Screenshots
Articles
Render times
User Profiles
Newsletters
LEARNING
Tutorials
Reviews
Glossary
Beginners
Links
DATABASE
Models
Macros / Scripts
Materials / VSL
Environments
Plugins
RENDERS
User images
Image Contest
Realsoft images
VRgrafix images
EX IMAGE:
Factory
By BTgrafik
 
tutorials

Depth of Field - Controlling the depth channel in Realsoft3D

Tutorial by Noodles (aka Helmut). Note: This tutorial is in Alpha release.

First, make a new float type channel and rename it to myDistance.
A new shader for the sphere. Note that only the Z channel is bound to the input of the curve object.

ok, now this is one boring scene. Classic checkerfloor with classic CSG clutterpieces.

A point and a distant light shall cast some light on the world.
The white sphere is a mapping object using the myDistance shader centered to the viewpoint of the camera. 

A sideview of the whole thing.

Create a new output object  of type Window.

Edit the channel bindings so the myDistance channel writes into the R, G and B channels of the render window.

Now you can abuse the file renderer's render button to display your custom channel  on it's own:


A second camera object gives the overview.
The shader gives black at the camera viewpoint, or zero Z distance to put it the other way round.

At Z=1, or the diameter of the sphere, the value is 1 (white). The value increases beyond the sphere but this is not interesting here.

Playing with the gradient allows you to adjust the sharp zone and the falloff.

The diameter of the sphere corresponds to X=1 on the curve coord system.


This curve leaves everything within the area of the sphere black, and fades to white beyond it gradually.
You could now render out the channel to a separate image or use a multichannel format for that matter to generate the mythical Z-buffer needed for compositing.
To quickly fake DOF it serves either to key a blurred version over an original image, or to use the depth information to control the strength of a blur or defocus effect.

Both methods can be done in Realsoft3d itself. I will show the latter here.

In Post Effects, create a blur effect.

Duplicate the Default Effects object and rename it to "Default Effects + myBlur".

Replace the Camera defined DOF with the newly created myBlur object.

Create a new View Window, set the Effect/Image to "Default Effects + myBlur"
Function test. The blur post effect obviously works.
Set the Threshold Channel of the Blur post effect to the myDistance channel.
The brighter the value in myDistance the stronger the blur effect is applied.

Rounding the curve gives us a smooth transition from blurred to unblurred image:

 

Page updated on Tuesday, 25 February, 2003 . For feedback / model submissions or articles - please email us.
Site proudly sponsored by VR.grafix
Goto Sponsors Site (VRgrafix)