GeometryInstance3D
Base node for geometry-based visual instances.
Base node for geometry-based visual instances.
Base node for geometry-based visual instances. Shares some common functionality like visibility and custom materials.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
GeometryInstance3DConstructor
public GeometryInstance3D();Properties16
CastShadowProperty
public GeometryInstance3D.ShadowCastingSetting CastShadow { get; set; }Controls geometry shadow casting, not ordinary visibility or shadow reception. Off removes the object shadow; the light also needs ShadowEnabled. The example verifies DirectionalLight3D in Compatibility.
CustomAabbProperty
public Aabb CustomAabb { get; set; }Custom local bounds for culling the rendering instance. A nonzero Aabb replaces computed bounds; default(Aabb) removes the override. ExtraCullMargin is then applied before transforming the result to world space. Does not change vertices, Mesh.GetAabb(), VisualInstance3D.GetAabb() or collision. An excessively large box weakens culling and is not a general switch disabling visibility tests.
ExtraCullMarginProperty
public float ExtraCullMargin { get; set; }Additional geometry-culling bounds margin. Useful when a vertex shader moves vertices outside the original AABB. Does not modify CPU vertices, the original Mesh.GetAabb or CollisionShape3D. Choose it for the maximum possible displacement; the example uses 2.
GILightmapScaleProperty · Deprecated
public GeometryInstance3D.LightmapScale GILightmapScale { get; set; }The texel density to use for lightmapping in LightmapGI.
GILightmapTexelScaleProperty
public float GILightmapTexelScale { get; set; }The texel density to use for lightmapping in LightmapGI. Greater scale values provide higher resolution in the lightmap, which can result in sharper shadows for lights that have both direct and indirect light baked. However, greater scale values will also increase the space taken by the mesh in the lightmap texture, which increases the memory, storage, and bake time requirements. When using a single mesh at different scales, consider adjusting this value to keep the lightmap texel density consistent across meshes.
For example, doubling GeometryInstance3D.GILightmapTexelScale doubles the lightmap texture resolution for this object on each axis, so it will quadruple the texel count.
GIModeProperty
public GeometryInstance3D.GIModeEnum GIMode { get; set; }The global illumination mode to use for the whole geometry. To avoid inconsistent results, use a mode that matches the purpose of the mesh during gameplay (static/dynamic).
Note: Lights' bake mode will also affect the global illumination rendering. See Light3D.LightBakeMode.
IgnoreOcclusionCullingProperty
public bool IgnoreOcclusionCulling { get; set; }Bypasses occlusion culling for this geometry. The test restores the hidden sphere to the render list behind a wall; it does not make it visible through the opaque wall or disable every other culling mechanism.
LodBiasProperty
public float LodBias { get; set; }Instance mesh-LOD selection multiplier. Increasing 1 to 8 preserves more distant primitives in the test. Does not create missing LOD data, modify physics or specify a fixed switching distance.
MaterialOverlayProperty
public Material MaterialOverlay { get; set; }Additional material rendered over the base in another pass. Does not replace MaterialOverride and is not returned by GetActiveMaterial. A transparent Alpha overlay is verified; configure transparency, depth and extra-pass cost separately.
MaterialOverrideProperty
public Material MaterialOverride { get; set; }Base material overriding all instance surfaces, ahead of surface overrides and Mesh materials. Assigning an existing resource does not make it unique. null restores surface-material selection.
TransparencyProperty
public float Transparency { get; set; }The transparency applied to the whole geometry (as a multiplier of the materials' existing transparency). 0.0 is fully opaque, while 1.0 is fully transparent. Values greater than 0.0 (exclusive) will force the geometry's materials to go through the transparent pipeline, which is slower to render and can exhibit rendering issues due to incorrect transparency sorting. However, unlike using a transparent material, setting GeometryInstance3D.Transparency to a value greater than 0.0 (exclusive) will not disable shadow rendering.
In spatial shaders, 1.0 - transparency is set as the default value of the ALPHA built-in.
Note: GeometryInstance3D.Transparency is clamped between 0.0 and 1.0, so this property cannot be used to make transparent materials more opaque than they originally are.
Note: Only supported when using the Forward+ rendering method. When using the Mobile or Compatibility rendering method, GeometryInstance3D.Transparency is ignored and is considered as always being 0.0.
VisibilityRangeBeginProperty
public float VisibilityRangeBegin { get; set; }Lower visibility-distance bound, measured from the camera to the transformed AABB center. Zero disables this bound. Range culling does not stop _Process, physics or unload resources. With zero margins both adjacent models can be visible at an exact shared threshold.
VisibilityRangeBeginMarginProperty
public float VisibilityRangeBeginMargin { get; set; }Margin around the lower bound. With fading disabled it supplies state-dependent switching hysteresis, not automatic transparency. Coordinate it with the neighboring model’s upper range.
VisibilityRangeEndProperty
public float VisibilityRangeEnd { get; set; }Upper visibility-distance bound; zero disables it. Measured to the transformed AABB center, not necessarily the entity origin. Selects visible geometry; does not stream resources or automatically simplify triangles.
VisibilityRangeEndMarginProperty
public float VisibilityRangeEndMargin { get; set; }Margin around the upper bound. With fading disabled it contributes to hysteresis; fade modes use it as a transition band. The value alone does not enable transparency or stop entity processing.
VisibilityRangeFadeModeProperty
public GeometryInstance3D.VisibilityRangeFadeModeEnum VisibilityRangeFadeMode { get; set; }Range-transition mode. Disabled switches visibility without transparent fading. Source configuration requires Forward+ for transparent Self/Dependencies fading; do not rely on it in Compatibility or Mobile. The native example verifies only Disabled with zero margins.
Methods34
GetCastShadowsSettingGeometryInstance3D.ShadowCastingSetting
public GeometryInstance3D.ShadowCastingSetting GetCastShadowsSetting();GeometryInstance3D.ShadowCastingSettingGetCustomAabbAabb
public Aabb GetCustomAabb();Returns the stored CustomAabb value, not final server-side culling bounds. Calling RenderingServer.InstanceSetCustomAabb directly does not update this wrapper value.
AabbThe configured local Aabb, or default(Aabb) when no override is set through the wrapper. This does not query automatically computed bounds.
GetExtraCullMarginfloat
public float GetExtraCullMargin();Returns the stored extra local-bounds margin. A direct RenderingServer.InstanceSetExtraVisibilityMargin call changes server state but does not update this wrapper value.
floatThe configured ExtraCullMargin, initially 0. This is neither the complete bounds size nor a world-space distance after scaling.
GetGIModeGeometryInstance3D.GIModeEnum
public GeometryInstance3D.GIModeEnum GetGIMode();GeometryInstance3D.GIModeEnumGetInstanceShaderParameterVariant
public Variant GetInstanceShaderParameter(StringName name);Reads the effective instance-uniform value for this geometry. After a Nil reset, the verified example returns the shader default White. This differs from ShaderMaterial.GetShaderParameter, which returns Nil without a stored override.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
nameCase-sensitive name of a declared instance uniform.
VariantVariant containing the current parameter value. Color White is verified after resetting surface_tint; do not assume the same default for unknown names.
GetLightmapScaleGeometryInstance3D.LightmapScale
public GeometryInstance3D.LightmapScale GetLightmapScale();GeometryInstance3D.LightmapScaleGetLightmapTexelScalefloat
public float GetLightmapTexelScale();floatGetLodBiasfloat
public float GetLodBias();floatGetMaterialOverlayMaterial
public Material GetMaterialOverlay();Additional material for another draw pass. It neither replaces base MaterialOverride nor appears as GetActiveMaterial. Its queue, blending and depth still apply: an opaque overlay is not guaranteed on top. The check verifies a transparent alpha overlay blending with the base.
MaterialAssigned Material, or null, without cloning.
GetMaterialOverrideMaterial
public Material GetMaterialOverride();Base material for the entire instance, ahead of surface overrides and Mesh materials. Assignment does not clone the resource. null restores per-surface selection; MaterialOverlay remains a separate pass.
MaterialAssigned Material, or null, without cloning.
GetTransparencyfloat
public float GetTransparency();floatGetVisibilityRangeBeginfloat
public float GetVisibilityRangeBegin();floatGetVisibilityRangeBeginMarginfloat
public float GetVisibilityRangeBeginMargin();floatGetVisibilityRangeEndfloat
public float GetVisibilityRangeEnd();floatGetVisibilityRangeEndMarginfloat
public float GetVisibilityRangeEndMargin();floatGetVisibilityRangeFadeModeGeometryInstance3D.VisibilityRangeFadeModeEnum
public GeometryInstance3D.VisibilityRangeFadeModeEnum GetVisibilityRangeFadeMode();GeometryInstance3D.VisibilityRangeFadeModeEnumIsIgnoringOcclusionCullingbool
public bool IsIgnoringOcclusionCulling();boolSetCastShadowsSettingvoid
public void SetCastShadowsSetting(GeometryInstance3D.ShadowCastingSetting shadowCastingSetting);| Name | Type | Default |
|---|---|---|
shadowCastingSetting | GeometryInstance3D.ShadowCastingSetting | — |
SetCustomAabbvoid
public void SetCustomAabb(Aabb aabb);Stores CustomAabb and forwards it to the RenderingServer instance. The box uses local coordinates. For wind or other GPU deformation, cover every vertex position: the engine does not infer this displacement from shader code.
| Name | Type | Default |
|---|---|---|
aabb | Aabb | — |
aabbCustom local bounds; default(Aabb) restores automatic bounds selection. This value is not written into the source Mesh.
SetExtraCullMarginvoid
public void SetExtraCullMargin(float margin);Grows local rendering bounds on every side before the instance transform is applied. Useful for vertex-shader displacement; reducing scale also reduces the world-space margin. Does not change source vertices, GetAabb() or collision. A negative value is rejected with an engine error and leaves the prior setting unchanged.
| Name | Type | Default |
|---|---|---|
margin | float | — |
marginNonnegative padding in local units; 0 removes the extra growth. For world-space displacement, account for scale and rotation rather than copying the amplitude alone.
SetGIModevoid
public void SetGIMode(GeometryInstance3D.GIModeEnum mode);| Name | Type | Default |
|---|---|---|
mode | GeometryInstance3D.GIModeEnum | — |
SetIgnoreOcclusionCullingvoid
public void SetIgnoreOcclusionCulling(bool ignoreCulling);| Name | Type | Default |
|---|---|---|
ignoreCulling | bool | — |
SetInstanceShaderParametervoid
public void SetInstanceShaderParameter(StringName name, Variant value);Sets an instance uniform on this geometry while other meshes retain a shared ShaderMaterial. The parameter must be declared as instance uniform. Nil removes the override and restores that parameter’s shader default.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
value | Variant | — |
nameExact instance-uniform name, such as surface_tint. The example regular uniform height_scale is assigned on ShaderMaterial.
valueCompatible Variant value; the example passes Color for vec4 with source_color. default(Variant) removes the individual override without removing the shared material.
SetLightmapScalevoid
public void SetLightmapScale(GeometryInstance3D.LightmapScale scale);| Name | Type | Default |
|---|---|---|
scale | GeometryInstance3D.LightmapScale | — |
SetLightmapTexelScalevoid
public void SetLightmapTexelScale(float scale);| Name | Type | Default |
|---|---|---|
scale | float | — |
SetLodBiasvoid
public void SetLodBias(float bias);| Name | Type | Default |
|---|---|---|
bias | float | — |
SetMaterialOverlayvoid
public void SetMaterialOverlay(Material material);Additional material for another draw pass. It neither replaces base MaterialOverride nor appears as GetActiveMaterial. Its queue, blending and depth still apply: an opaque overlay is not guaranteed on top. The check verifies a transparent alpha overlay blending with the base.
| Name | Type | Default |
|---|---|---|
material | Material | — |
materialMaterial to assign; null clears this override/overlay. Keep the resource alive while used.
SetMaterialOverridevoid
public void SetMaterialOverride(Material material);Base material for the entire instance, ahead of surface overrides and Mesh materials. Assignment does not clone the resource. null restores per-surface selection; MaterialOverlay remains a separate pass.
| Name | Type | Default |
|---|---|---|
material | Material | — |
materialMaterial to assign; null clears this override/overlay. Keep the resource alive while used.
SetTransparencyvoid
public void SetTransparency(float transparency);| Name | Type | Default |
|---|---|---|
transparency | float | — |
SetVisibilityRangeBeginvoid
public void SetVisibilityRangeBegin(float distance);| Name | Type | Default |
|---|---|---|
distance | float | — |
SetVisibilityRangeBeginMarginvoid
public void SetVisibilityRangeBeginMargin(float distance);| Name | Type | Default |
|---|---|---|
distance | float | — |
SetVisibilityRangeEndvoid
public void SetVisibilityRangeEnd(float distance);| Name | Type | Default |
|---|---|---|
distance | float | — |
SetVisibilityRangeEndMarginvoid
public void SetVisibilityRangeEndMargin(float distance);| Name | Type | Default |
|---|---|---|
distance | float | — |
SetVisibilityRangeFadeModevoid
public void SetVisibilityRangeFadeMode(GeometryInstance3D.VisibilityRangeFadeModeEnum mode);| Name | Type | Default |
|---|---|---|
mode | GeometryInstance3D.VisibilityRangeFadeModeEnum | — |
GeometryInstance3D.GIModeEnum
| Value | Description |
|---|---|
Disabled = 0 | Disabled global illumination mode. Use for dynamic objects that do not contribute to global illumination (such as characters). When using |
Dynamic = 2 | Dynamic global illumination mode. Use for dynamic objects that contribute to global illumination. This GI mode is only effective when using |
Static = 1 | Baked global illumination mode. Use for static objects that contribute to global illumination (such as level geometry). This GI mode is effective when using |
GeometryInstance3D.LightmapScale
| Value | Description |
|---|---|
Max = 4 | Represents the size of the |
Scale1X = 0 | The standard texel density for lightmapping with |
Scale2X = 1 | Multiplies texel density by 2× for lightmapping with |
Scale4X = 2 | Multiplies texel density by 4× for lightmapping with |
Scale8X = 3 | Multiplies texel density by 8× for lightmapping with |
GeometryInstance3D.ShadowCastingSetting
| Value | Description |
|---|---|
DoubleSided = 2 | Will cast shadows from all visible faces in the GeometryInstance3D. Will not take culling into account, so all faces will be taken into account when shadow casting. |
Off = 0 | Will not cast any shadows. Use this to improve performance for small geometry that is unlikely to cast noticeable shadows (such as debris). |
On = 1 | Will cast shadows from all visible faces in the GeometryInstance3D. Will take culling into account, so faces not being rendered will not be taken into account when shadow casting. |
ShadowsOnly = 3 | Will only show the shadows casted from this object. In other words, the actual mesh will not be visible, only the shadows casted from the mesh will be. |
GeometryInstance3D.VisibilityRangeFadeModeEnum
| Value | Description |
|---|---|
Dependencies = 2 | Will fade-in its visibility dependencies (see |
Disabled = 0 | Will not fade itself nor its visibility dependencies, hysteresis will be used instead. This is the fastest approach to manual LOD, but it can result in noticeable LOD transitions depending on how the LOD meshes are authored. See |
Self = 1 | Will fade-out itself when reaching the limits of its own visibility range. This is slower than |