Skip to content
TREN
Atlıhan Harita

LCC for Web User Manual · API Reference

LCCObject::setRenderState

Chapter 06.34 / 07Manual version v0.6.4English

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()

This chapter is from the official XGRIDS user manual. Official source (opens in a new tab) · Updated:

XGRIDS Türkiye

We're With You During Setup and in the Field

Atlıhan Harita provides training and technical support for device setup, firmware updates, software use, and field applications. Send us your question and our specialist will get back to you.

+90 216 546 0804