Skip to main content

Pass

Class

Controls how a mesh will get rendered.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Controls how a mesh will get rendered. Each Pass acts as an interface for the shader it's associated with. Any properties on a Pass's shader will automatically become properties on that Pass. For example, if the shader defines a variable named baseColor, a script would be able to access that property as material.mainPass.baseColor.

Index

Example

var sprite = script.getSceneObject().getFirstComponent(SpriteVisual.getTypeName());
var pass = sprite.mainPass;

pass.baseTex.control.play(-1,0.0);

Extends

Indexable

[index: string]: any

Properties

blendMode

blendMode: BlendMode

The blend mode used for rendering. Possible values:

BlendModeValueExpression
Normal0SrcAlpha, OneMinusSrcAlpha
MultiplyLegacy [DEPRECATED]1DstColor, OneMinusSrcAlpha
AddLegacy [DEPRECATED]2One, One
Screen3One, OneMinusSrcColor
PremultipliedAlpha4One, OneMinusSrcAlpha
AlphaToCoverage5Blend Disabled
Disabled6Blend Disabled
Add7SrcAlpha, One
AlphaTest8Blend Disabled
ColoredGlass9Blend Disabled
Multiply10DstColor, Zero
Min11One, One
Max12One, One
// Sets the blend mode of the main pass for a material to Screen
//@input Asset.Material material

script.material.mainPass.blendMode = 3;

Default Value

BlendMode.Disabled

colorMask

colorMask: vec4b

Controls the masking of color channels with a vec4b representing each channel with a boolean.

Default Value

(true, true, true, false)

cullMode

cullMode: CullMode

The cull mode used for rendering.

Default Value

CullMode.Back

depthTest

depthTest: boolean

Enables depth-sorting.

Default Value

true

depthWrite

depthWrite: boolean

Enables writing pixels to the depth buffer.

Default Value

true

frustumCullMax

frustumCullMax: vec3

Set max corner of aabb. It only applys when user selects FrustumCullMode.UserDefinedAABB

Default Value

(-Infinity, -Infinity, -Infinity)

frustumCullMin

frustumCullMin: vec3

Set min corner of aabb. It only applys when user selects FrustumCullMode.UserDefinedAABB

Default Value

(Infinity, Infinity, Infinity)

frustumCullMode

frustumCullMode: FrustumCullMode

Mode for setting frustum culling on Pass

Default Value

FrustumCullMode.Auto

frustumCullPad

frustumCullPad: number

Extend render object's aabb to (1 + value). Only applys when user select FrustumCullMode.Extend

Since

Lens Scripting Version 153

Default Value

0

instanceCount

instanceCount: number

Number of times the pass will be rendered. Useful with the Instance ID node in Material Editor.

Default Value

1

lineWidth

lineWidth: number

Line width used for rendering.

Default Value

1

name

name: string

The name of the Pass.

Default Value

""

polygonOffset

polygonOffset: vec2

Changes the position that each polygon gets drawn.

Default Value

(0, 0)

samplers

readonly samplers: SamplerWrappers

Returns texture samplers used by this pass to set filtering and wrap modes.


stencilState

stencilState: StencilState

The stencil test state for Pass.


twoSided

twoSided: boolean

Whether the material renders on both sides of a mesh face.

Default Value

false

Methods

getTypeName()

static getTypeName(): TypeName<Pass>

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<Pass>

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame