Example—creating depth of field
In film and photography depth of field is the region in the image that is sharp or in focus. A common trick in portrait photography is to focus on the subject and make the background blurred, drawing the viewer's attention to the subject. A similar effect can be achieved in Papervision3D.
Suppose you have a number of objects in your scene and you want them more in focus the closer they are to the camera. When you put each particle in a viewport layer, you can add a blur filter to each layer. Based on the screen depth of the layer, you can update the strength of the blur at every frame, which will suggest depth of field. Let's apply this idea in a simple example. We create 200 particles with a movie asset particle material and give them a random position. We also add some mouse interaction that makes the camera move. This example assumes that you have an assets folder inside your src folder with the glassBall.png in it, which can be found in the code download...