Skip to main content

LCC for Web Manual · v0.6.3 · Page 42 of 68

LCCObject::setRenderState

Sets the RenderState of the LCC model.

Includes depth testing, depth writing, render pass, and other parameters.

Version Requirement

SDK v0.4.0+

Engine Support

CesiumJS

API

LCCObject::setRenderState(renderState: RenderStateParam): void

Parameters

ParameterTypeRequiredDefaultDescription
renderState.depthTestObjectNo-Depth test configuration.
renderState.depthTest.enabledbooleanNotrueWhether to enable depth testing.
renderState.depthTest.funcnumberNo-Depth test function, e.g., Cesium.WebGLConstants.ALWAYS.
renderState.depthMaskbooleanNotrueWhether to write to the depth buffer.
renderState.passIndexnumberNoCesium.Pass.CESIUM_3D_TILECesium render pass.
renderState.stencilTestObjectNo-Stencil test configuration. SDK v0.5.0+

Return Value

void

Usage Example

The LCC model writes to the depth buffer and renders in a higher-priority pass. When subsequent Cesium objects have depth testing enabled, correct occlusion relationships are achieved.

const renderState = {
    depthTest: {
        enabled: true,
        func: Cesium.WebGLConstants.ALWAYS,
    },
    depthMask: true,
    passIndex: Cesium.Pass.CESIUM_3D_TILE
};

lccObject.setRenderState(renderState);

Translucent Object Pass (SDK v0.4.0+)

When using Pass.TRANSLUCENT, occlusion relationships between objects depend on Cesium's sorting of all transparent objects in the scene, based on the distance from the camera to the scene bounding box. In this mode, occlusion results may not match the expectations from raiseToTop() or lowerToBottom().

const renderState = {
    depthTest: {
        enabled: true,
        func: Cesium.WebGLConstants.LESS,
    },
    depthMask: false,
    passIndex: Cesium.Pass.TRANSLUCENT
};

lccObject.setRenderState(renderState);

Using Stencil Test (SDK v0.5.0+)

const renderState = {
    depthTest: {
        enabled: true,
        func: Cesium.WebGLConstants.ALWAYS,
    },
    depthMask: true,
    passIndex: Cesium.Pass.CESIUM_3D_TILE,
    stencilTest: Cesium.StencilConstants.setCesium3DTileBit()
};

lccObject.setRenderState(renderState);

Notes

  • This method can be called synchronously immediately after LCCRender.load().
  • Versions v0.4.0 and v0.4.1 only support depthTest, depthMask, and passIndex parameters.
  • v0.5.0+ supports all RenderState parameters and merges them with existing settings.
  • When using depthMask: false, depth writing is disabled, and occlusion relationships between the LCC model and other transparent objects depend on Cesium's sorting results.
  • LCCObject::lowerToBottom()
  • LCCObject::raiseToTop()

XGRIDS documentation, reproduced as published and captured on October 27, 2026. Read this page on docs.xgrids.com

Stuck on a Step?

QRC supports every scanner and software seat it sells. Send us the page you are on and we will walk you through it.

Contact Us
Request a Quote