Shaders


simpleFace - A procedural shader for a face

This Renderman shader paints a simple face on an object, consisting of two eyes and a mouth. It should map onto most surfaces okay, but may require some experimentation to get the desired results. In this image, the simpleFace shader is applied to a sphere.

VIDI Presenter can animate several parameters, e. g. the size and shape of the mouth, the direction the eyes are looking, etc. A sample model is included.

The basic mapping strategy is to apply the shader to the desired object. Render the scene with the default parameters to establish a starting point.

If the face appears sideways on the head, change the "mapCode" parameter to swap s and t coordinates. This will rotate the face 90 degrees on the head.

If the face is upside down, try using the "mapCode" parameter to invert s or t.

If the face is not properly centered on the head, adjust the "faceCenter" parameter.

If the aspect ratio of the eyes and mouth need adjustment, use the "scaleS" parameter.

The "eyeLevel" and "mouthLevel" move the eyes and mouth up or down on the head.


After the basic positioning of the face is done, use these parameters to animate the face:

Use "mouthOffset" to move the edges of the mouth up and down with respect to the center of the mouth. A negative "mouthOffset" value gives a frown, a positive "mouthOffset" value gives a smile.

Use the "mouthOpen" to set the size of the mouth opening. This can be used for talking motion.

Pupil movement is controlled by specifying the distance from the center of the eye to the center of the pupil, and the angle of the pupil with respect to the eye center. This works well for making the eyes roll.


Parameter

Data Type

Usage

Example

mouthLevel

float 0.0 to 1.0

Vertical placement of center of the mouth.

mouthLevel = 0.35

mouthWidth

float 0.0 to 1.0

The width of the mouth

mouthWidth = 0.5

mouthOffset

float 0.0 to 1.0

The vertical offset of the edges of the mouth from the center. Positive values give a smile, negative values give a frown.

mouthOffset = 0.05

mouthOpen

float 0.0 to 1.0

The vertical opening size of the mouth.

mouthOpen = 0.02

eyeLevel

float 0.0 to 1.0

Vertical placement of the center of the eyes

eyeLevel = 0.55

eyeOffset

float 0.0 to 1.0

The horizontal distance from faceCenter to center of each eye

eyeOffset = 0.09

eyeRadius

float 0.0 to 1.0

The radius of the ring around each eye

eyeRadius = 0.05

pupilAngle

float 0.0 to pi * 2

The pupil rotation in radians

pupilAngle = 3.14159

pupilOffset

float 0.0 to eyeRadius

The distance between center of pupil and center of eye

pupilOffset = 0.02

mouthColor

RGB color

The color of the mouth

mouthColor = color(0, 0, 0)

pupilColor

RGB color

The color of the pupil

pupilColor = color(0, 0, 0)

eyeColor

RGB color

The color of the eye around the pupil

pupilColor = color(1, 1, 1)

ringColor

RGB color

The color of the ring around the ey

ringColor = color(0, 1, 0)

faceCenter

float 0.0 to 1.0

The horizontal center of the face

faceCenter = 0.5

mapCode

integer 0 to 7

Controls s,t mapping:

0 = default
1 = invert s
2 = invert t
3 = invert s and t
4 = swap s and t
5 = swap s and t, invert s
6 = swap s and t, invert t
7 = swap s and t, invert s and t

mapCode = 0

scaleS

float

scaling factor for aspect ratio, may be greater than 1.0

scaleS = 2.0

fuzz

float 0.0 to 1.0

The fuzz factor for anti-aliasing

fuzz = 0.0025

Ka

float 0.0 to 1.0

The usual meaning for matte shading

Ka = 1.0

Ks

float 0.0 to 1.0

The usual meaning for matte shading

Ks = 1.0

 


View the simpleFace5.sl shader source

Download the simpleFace5 package for Presenter 3D

 


HOME

NEW

LINKS

GALLERY

ARTICLES

PLUG-INS

RENDERMAN

Switch to Frame View




Copyright © 1997 by WebNation
All trademarks are the property of their respective holders