Tips and Techniques/Particles/Soft Clipping

From VFXPedia

< Tips and Techniques
Revision as of 09:08, 17 April 2009 by Gringo (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Soft particle clipping with pCustom

Summary

Soft particle clipping with pCustom (Last Updated: Month 7th, 2006)

Particles just disappear when they intersect the clipping plane of the camera. This causes a visible pop in the image which can be distracting. This tip demonstrates how the pCustom tool can be used to create a soft clip region for the camera, by fading out the particles before they reach the clipping plane.

Contents


Inspired by this discussion at the Pigsfly Web Forums

Resources

Tip_particle_clip_clipped.mov
Quicktime example of a clipped particle system.
Tip_particle_clip_notclipped.mov
Quicktime of same particle system, soft clipped using pCustom.
Download the Fusion 5 Composition

Description

Download Fusion 5.0 and 5.1 Composition and open it with Fusion 5.0 or later.

Image:Tip_particle_clip_comp.png

View the Render3D1 tool in any display and press play in the composition. Observe how the particles fade as they reach the camera. Now click on the pClip tool and press CTRL-P to set this tool to pass-through mode. Play the result again and note how the particles 'pop' out of view when they reach the camera.

The pClip tool calculated the distance between each particle and fades the particle out if it is between the cameras near clip and a soft clip limit. The section below describes the exact settings for the pClip tool.

Number Tab


Number In 1
The n1 variable is connected to Camera3D1's Near Clip via a simple expression.
Number In 2
The n2 variable is set to 0.2. This value will be added to n1 to determine the distance from the camera where particles will begin fading out. We will call this the soft clip limit.


Position Tab


Position 1
The X, Y and Z positions [p1x, p1y, p1z] are connected to the position of Camera3D1 via simple expressions.


Intermediate Tab


Intermediate 1
Intermediate calculations run once per frame for each particle. The calculation in the Intermediate 1 field of the pClip tool determines the distance between the Camera and the particle.
 sqrt( (px-p1x)^2 + (py-p1y)^2 + (pz-p1z)^2 )
Intermediate 2
We use Intermediate 2 [i2] to determine how much we should fade out the particle as it approaches the camera. We can use the distance [i1] here, because i2 calculates after i1 is completed.
This clever equation subtracts the clipping plane [n1] from the particles distance from the camera [i1], and then divides the result by the soft clip limit [n2]. Since the result of this equation will be greater than 1 if the particle is further away from the camera than the soft clip limit, our expression uses the min() function which will return the smallest of two values.
 min ( 1, (i1-n1) / n2 )


Particle Tab


Red, Green, Blue and Alpha Expressions
These expressions are very simple. The color values of the pixels are multiplied against Intermediate 2 [i2].
r * i2
g * i2
b * i2
a * i2