Vizard 8 » Command Index » Vizard modules » vizfx » <vizfx>.addLightingModel
8.1

<vizfx>.addLightingModel

Create lighting model effect

<vizfx>.addLightingModel(  
diffuse = vizfx.DIFFUSE_LAMBERT  
specular = vizfx.SPECULAR_PHONG  
diffuseRamp = None  
)  
diffuse = vizfx.DIFFUSE_LAMBERT
The diffuse shading model. Can be one of the following flags:

Flag

Description

vizfx.DIFFUSE_LAMBERT

Use the standard Lambert diffuse model.

vizfx.DIFFUSE_HALFLAMBERT

Use the Half-Lambert diffuse model popularized by Valve. This produces a wider falloff which results in softer shading.

specular = vizfx.SPECULAR_PHONG
The specular reflectance model. Can be one of the following flags:

Flag

Description

vizfx.SPECULAR_OFF

Disable specular lighting.

vizfx.SPECULAR_BLINNPHONG

Use the Blinn-Phong specular model.

vizfx.SPECULAR_PHONG

Use the Phong specular model.

diffuseRamp = None
An optional <texture> object for ramped diffuse lighting. The computed diffuse intensity will be used as a lookup into the ramp texture, and the resulting color sample is applied to the diffuse lighting color. The ramp texture is typically a 256x1 image, where the left side represents the color when the surface is facing away from the light, and the right side represents the color when the surface is facing the light.

Remarks

Creates a lighting model effect that can be applied to a <composer> or <node>.

Return Value

<effect> object

Example

# Create Half-Lambert lighting model effect 
effect = vizfx.addLightingModel(diffuse=vizfx.DIFFUSE_HALFLAMBERT)

# Apply to default composer (replaces default lighting model effect)
vizfx.getComposer().addEffect(effect)

See also

<vizfx>.getComposer