VisualInstance3D
Inherited By:Decal,FogVolume,GeometryInstance3D,GPUParticlesAttractor3D,GPUParticlesCollision3D,Light3D,LightmapGI,OccluderInstance3D,OpenXRVisibilityMask,ReflectionProbe,RootMotionView,VisibleOnScreenNotifier3D,VoxelGI
Parent of all visual 3D nodes.
Description
TheVisualInstance3D is used to connect a resource to a visual representation. All visual 3D nodes inherit from theVisualInstance3D. In general, you should not access theVisualInstance3D properties directly as they are accessed and managed by the nodes that inherit fromVisualInstance3D.VisualInstance3D is the node representation of theRenderingServer instance.
Properties
| ||
| ||
Methods
get_layer_mask_value(layer_number:int)const | |
set_layer_mask_value(layer_number:int, value:bool) |
Property Descriptions
intget_layer_mask()
The render layer(s) thisVisualInstance3D is drawn on.
This object will only be visible forCamera3Ds whose cull mask includes any of the render layers thisVisualInstance3D is set to.
ForLight3Ds, this can be used to control whichVisualInstance3Ds are affected by a specific light. ForGPUParticles3D, this can be used to control which particles are effected by a specific attractor. ForDecals, this can be used to control whichVisualInstance3Ds are affected by a specific decal.
To adjustlayers more easily using a script, useget_layer_mask_value() andset_layer_mask_value().
Note:VoxelGI, SDFGI andLightmapGI will always take all layers into account to determine what contributes to global illumination. If this is an issue, setGeometryInstance3D.gi_mode toGeometryInstance3D.GI_MODE_DISABLED for meshes andLight3D.light_bake_mode toLight3D.BAKE_DISABLED for lights to exclude them from global illumination.
floatget_sorting_offset()
The amount by which the depth of thisVisualInstance3D will be adjusted when sorting by depth. Uses the same units as the engine (which are typically meters). Adjusting it to a higher value will make theVisualInstance3D reliably draw on top of otherVisualInstance3Ds that are otherwise positioned at the same spot. To ensure it always draws on top of other objects around it (not positioned at the same spot), set the value to be greater than the distance between thisVisualInstance3D and the other nearbyVisualInstance3Ds.
boolis_sorting_use_aabb_center()
Iftrue, the object is sorted based on theAABB center. The object will be sorted based on the global position otherwise.
TheAABB center based sorting is generally more accurate for 3D models. The position based sorting instead allows to better control the drawing order when working withGPUParticles3D andCPUParticles3D.
Method Descriptions
There is currently no description for this method. Please help us bycontributing one!
Returns theAABB (also known as the bounding box) for thisVisualInstance3D.
Returns the RID of the resource associated with thisVisualInstance3D. For example, if the Node is aMeshInstance3D, this will return the RID of the associatedMesh.
Returns the RID of this instance. This RID is the same as the RID returned byRenderingServer.instance_create(). This RID is needed if you want to callRenderingServer functions directly on thisVisualInstance3D.
boolget_layer_mask_value(layer_number:int)const🔗
Returns whether or not the specified layer of thelayers is enabled, given alayer_number between 1 and 20.
Sets the resource that is instantiated by thisVisualInstance3D, which changes how the engine handles theVisualInstance3D under the hood. Equivalent toRenderingServer.instance_set_base().
voidset_layer_mask_value(layer_number:int, value:bool)🔗
Based onvalue, enables or disables the specified layer in thelayers, given alayer_number between 1 and 20.