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.

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

pass.baseTex.control.play(-1,0.0);
interface Pass {
    baseColor: vec4;
    baseTex: Texture;
    blendMode: BlendMode;
    colorMask: vec4b;
    cullMode: CullMode;
    depthTest: boolean;
    depthWrite: boolean;
    frustumCullMax: vec3;
    frustumCullMin: vec3;
    frustumCullMode: FrustumCullMode;
    frustumCullPad: number;
    instanceCount: number;
    lineWidth: number;
    name: string;
    polygonOffset: vec2;
    samplers: SamplerWrappers;
    stencilState: StencilState;
    twoSided: boolean;
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
    [index: string]: any;
}

Hierarchy (view full)

Indexable

  • [index: string]: any

Properties

baseColor: vec4
baseTex: Texture
blendMode: BlendMode

The blend mode used for rendering. Possible values:

BlendMode Value Expression
Normal 0 SrcAlpha, OneMinusSrcAlpha
MultiplyLegacy [DEPRECATED] 1 DstColor, OneMinusSrcAlpha
AddLegacy [DEPRECATED] 2 One, One
Screen 3 One, OneMinusSrcColor
PremultipliedAlpha 4 One, OneMinusSrcAlpha
AlphaToCoverage 5 Blend Disabled
Disabled 6 Blend Disabled
Add 7 SrcAlpha, One
AlphaTest 8 Blend Disabled
ColoredGlass 9 Blend Disabled
Multiply 10 DstColor, Zero
Min 11 One, One
Max 12 One, One
// Sets the blend mode of the main pass for a material to Screen
//@input Asset.Material material

script.material.mainPass.blendMode = 3;
colorMask: vec4b

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

cullMode: CullMode

The cull mode used for rendering.

depthTest: boolean

Enables depth-sorting.

depthWrite: boolean

Enables writing pixels to the depth buffer.

frustumCullMax: vec3

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

frustumCullMin: vec3

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

frustumCullMode: FrustumCullMode

Mode for setting frustum culling on Pass

frustumCullPad: number

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

instanceCount: number

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

lineWidth: number

Line width used for rendering.

name: string

The name of the Pass.

polygonOffset: vec2

Changes the position that each polygon gets drawn.

samplers: SamplerWrappers

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

stencilState: StencilState

The stencil test state for Pass.

twoSided: boolean

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

Methods

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

    Parameters

    • type: string

    Returns boolean

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

    Parameters

    Returns boolean