Houdini 12 VEX VEX contexts

Define a displacement shader with a program that moves a point on a surface before the surface is rendered.

Displacement shading can be used to move the position of the surface before the surface gets rendered. This lets you add fine detail to a surface, but is not intended for modeling.

After moving a surface, you must typically re-compute the normals of the surface. For surfaces which have interpolated normals (smooth shaded polygons), you can use the computenormal(vector P, N, Ng) function to approximate the “smooth” displaced normal.

Globals

Pz (read-only)

Z component of the point being shaded.

Time (read-only)

The time at which the shading occurs, as a number from 0 (shutter open) to 1 (shutter close).

dPdt (read-only)

Change in position with respect to the parametric t.

t (read-only)

Parametric t (sometimes called v) coordinate of the surface being shaded.

dPdz (read-only)

Floating point step size for volume rendering.

N

Shading normal for the surface.

Cl

...

P

Position of the point on the surface being shaded. In light or shadow shaders, the P variable contains the point on the light source.

L (read-only)

...

Ng (read-only)

Geometric normal for the surface. This normal represents the “true” normal of the surface being shaded. For example, with Phong shading, the N variable represents the interpolated normal, while the Ng variable represents the true polygon normal.

s (read-only)

Parametric s (sometimes called u) coordinate of the surface being shaded.

dPds (read-only)

Change in position with respect to the parametric s.