GeometryInstance

Inherits: VisualInstance < CullInstance < Spatial < Node < Object

Inherited By: CPUParticles, CSGShape, ImmediateGeometry, Label3D, MeshInstance, MultiMeshInstance, Particles, SpriteBase3D

Base node for geometry-based visual instances.

Description

Base node for geometry-based visual instances. Shares some common functionality like visibility and custom materials.

Properties

ShadowCastingSetting

cast_shadow

1

float

extra_cull_margin

0.0

bool

generate_lightmap

true

LightmapScale

lightmap_scale

0

float

lod_max_distance

0.0

float

lod_max_hysteresis

0.0

float

lod_min_distance

0.0

float

lod_min_hysteresis

0.0

Material

material_overlay

Material

material_override

bool

use_in_baked_light

false

Methods

bool

get_flag ( Flags flag ) const

void

set_custom_aabb ( AABB aabb )

void

set_flag ( Flags flag, bool value )


Enumerations

enum LightmapScale:

LightmapScale LIGHTMAP_SCALE_1X = 0

The generated lightmap texture will have the original size.

LightmapScale LIGHTMAP_SCALE_2X = 1

The generated lightmap texture will be twice as large, on each axis.

LightmapScale LIGHTMAP_SCALE_4X = 2

The generated lightmap texture will be 4 times as large, on each axis.

LightmapScale LIGHTMAP_SCALE_8X = 3

The generated lightmap texture will be 8 times as large, on each axis.

LightmapScale LIGHTMAP_SCALE_MAX = 4


enum ShadowCastingSetting:

ShadowCastingSetting SHADOW_CASTING_SETTING_OFF = 0

Will not cast any shadows.

ShadowCastingSetting SHADOW_CASTING_SETTING_ON = 1

Will cast shadows from all visible faces in the GeometryInstance.

Will take culling into account, so faces not being rendered will not be taken into account when shadow casting.

ShadowCastingSetting SHADOW_CASTING_SETTING_DOUBLE_SIDED = 2

Will cast shadows from all visible faces in the GeometryInstance.

Will not take culling into account, so all faces will be taken into account when shadow casting.

ShadowCastingSetting SHADOW_CASTING_SETTING_SHADOWS_ONLY = 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.


enum Flags:

Flags FLAG_USE_BAKED_LIGHT = 0

Will allow the GeometryInstance to be used when baking lights using a GIProbe or BakedLightmap.

Flags FLAG_DRAW_NEXT_FRAME_IF_VISIBLE = 1

Unused in this class, exposed for consistency with InstanceFlags.

Flags FLAG_MAX = 2

Represents the size of the Flags enum.


Property Descriptions

ShadowCastingSetting cast_shadow = 1

The selected shadow casting flag. See ShadowCastingSetting for possible values.


float extra_cull_margin = 0.0

  • void set_extra_cull_margin ( float value )

  • float get_extra_cull_margin ( )

The extra distance added to the GeometryInstance's bounding box (AABB) to increase its cull box.


bool generate_lightmap = true

  • void set_generate_lightmap ( bool value )

  • bool get_generate_lightmap ( )

When disabled, the mesh will be taken into account when computing indirect lighting, but the resulting lightmap will not be saved. Useful for emissive only materials or shadow casters.


LightmapScale lightmap_scale = 0

Scale factor for the generated baked lightmap. Useful for adding detail to certain mesh instances.


float lod_max_distance = 0.0

  • void set_lod_max_distance ( float value )

  • float get_lod_max_distance ( )

The GeometryInstance's max LOD distance.

Note: This property currently has no effect.


float lod_max_hysteresis = 0.0

  • void set_lod_max_hysteresis ( float value )

  • float get_lod_max_hysteresis ( )

The GeometryInstance's max LOD margin.

Note: This property currently has no effect.


float lod_min_distance = 0.0

  • void set_lod_min_distance ( float value )

  • float get_lod_min_distance ( )

The GeometryInstance's min LOD distance.

Note: This property currently has no effect.


float lod_min_hysteresis = 0.0

  • void set_lod_min_hysteresis ( float value )

  • float get_lod_min_hysteresis ( )

The GeometryInstance's min LOD margin.

Note: This property currently has no effect.


Material material_overlay

  • void set_material_overlay ( Material value )

  • Material get_material_overlay ( )

The material overlay for the whole geometry.

If a material is assigned to this property, it will be rendered on top of any other active material for all the surfaces.


Material material_override

  • void set_material_override ( Material value )

  • Material get_material_override ( )

The material override for the whole geometry.

If a material is assigned to this property, it will be used instead of any material set in any material slot of the mesh.


bool use_in_baked_light = false

If true, this GeometryInstance will be used when baking lights using a GIProbe or BakedLightmap.


Method Descriptions

bool get_flag ( Flags flag ) const

Returns the Flags that have been set for this object.


void set_custom_aabb ( AABB aabb )

Overrides the bounding box of this node with a custom one. To remove it, set an AABB with all fields set to zero.


void set_flag ( Flags flag, bool value )

Sets the Flags specified. See Flags for options.