Skip to main content

Editor.Assets.DepthFunction

Enum

How a Editor.Assets.PassInfo should determine its depth compared to others.

Index

Example

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const assetManager = model.project.assetManager;

// Find a Material and configure depth testing on its first pass
const materials = assetManager.assets.filter(a => a.isOfType('Material')) as Editor.Assets.Material[];
if (materials.length === 0) return;

const mat = materials[0];
const pass = mat.passInfos[0];

// Enable depth testing with LessEqual (standard for 3D rendering)
pass.depthTest = true;
pass.depthFunction = Editor.Assets.DepthFunction.LessEqual;
console.log(`"${mat.name}" depthTest: on, depthFunction: LessEqual (${pass.depthFunction})`);

// Switch to Always (renders regardless of depth — useful for overlays)
pass.depthFunction = Editor.Assets.DepthFunction.Always;
console.log(`Set to Always (${pass.depthFunction})`);

Enumeration Members

Always

Always: number

Always passes the depth test.


Equal

Equal: number

Passes if fragment depth equals stored depth.


Greater

Greater: number

Passes if fragment depth is greater than stored depth.


GreaterEqual

GreaterEqual: number

Passes if fragment depth is greater than or equal to stored depth.


Less

Less: number

Passes if fragment depth is less than stored depth.


LessEqual

LessEqual: number

Passes if fragment depth is less than or equal to stored depth.


Never

Never: number

Never passes the depth test.


NotEqual

NotEqual: number

Passes if fragment depth does not equal stored depth.