Server for anything visible. The visual server is the API backend for everything visible. The whole scene system mounts on it to display.
The visual server is completely opaque, the internals are entirely implementation specific and cannot be accessed.
The visual server can be used to bypass the scene system entirely.
Resources are created using the [code]*_create[/code] functions.
All objects are drawn to a viewport. You can use the [Viewport] attached to the [SceneTree] or you can create one yourself with [method viewport_create]. When using a custom scenario or canvas, the scenario or canvas needs to be attached to the viewport using [method viewport_set_scenario] or [method viewport_attach_canvas].
In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the visual server from a running game, the scenario can be accessed from the scene tree from any [Spatial] node with [method Spatial.get_world]. Otherwise, a scenario can be created with [method scenario_create].
Similarly, in 2D, a canvas is needed to draw all canvas items.
In 3D, all visible objects are comprised of a resource and an instance. A resource can be a mesh, a particle system, a light, or any other 3D object. In order to be visible resources must be attached to an instance using [method instance_set_base]. The instance must also be attached to the scenario using [method instance_set_scenario] in order to be visible.
In 2D, all visible objects are some form of canvas item. In order to be visible, a canvas item needs to be the child of a canvas attached to a viewport, or it needs to be the child of another canvas item that is eventually attached to the canvas.
Sets margin size, where black bars (or images, if [method black_bars_set_images] was used) are rendered.
</description>
</method>
<methodname="camera_create">
<returntype="RID"/>
<description>
Creates a camera and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]camera_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
</description>
</method>
<methodname="camera_set_cull_mask">
<returntype="void"/>
<argumentindex="0"name="camera"type="RID"/>
<argumentindex="1"name="layers"type="int"/>
<description>
Sets the cull mask associated with this camera. The cull mask describes which 3D layers are rendered by this camera. Equivalent to [member Camera.cull_mask].
</description>
</method>
<methodname="camera_set_environment">
<returntype="void"/>
<argumentindex="0"name="camera"type="RID"/>
<argumentindex="1"name="env"type="RID"/>
<description>
Sets the environment used by this camera. Equivalent to [member Camera.environment].
</description>
</method>
<methodname="camera_set_frustum">
<returntype="void"/>
<argumentindex="0"name="camera"type="RID"/>
<argumentindex="1"name="size"type="float"/>
<argumentindex="2"name="offset"type="Vector2"/>
<argumentindex="3"name="z_near"type="float"/>
<argumentindex="4"name="z_far"type="float"/>
<description>
Sets camera to use frustum projection. This mode allows adjusting the [code]offset[/code] argument to create "tilted frustum" effects.
</description>
</method>
<methodname="camera_set_orthogonal">
<returntype="void"/>
<argumentindex="0"name="camera"type="RID"/>
<argumentindex="1"name="size"type="float"/>
<argumentindex="2"name="z_near"type="float"/>
<argumentindex="3"name="z_far"type="float"/>
<description>
Sets camera to use orthogonal projection, also known as orthographic projection. Objects remain the same size on the screen no matter how far away they are.
If [code]true[/code], preserves the horizontal aspect ratio which is equivalent to [constant Camera.KEEP_WIDTH]. If [code]false[/code], preserves the vertical aspect ratio which is equivalent to [constant Camera.KEEP_HEIGHT].
</description>
</method>
<methodname="canvas_create">
<returntype="RID"/>
<description>
Creates a canvas and returns the assigned [RID]. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
</description>
</method>
<methodname="canvas_item_add_circle">
<returntype="void"/>
<argumentindex="0"name="item"type="RID"/>
<argumentindex="1"name="pos"type="Vector2"/>
<argumentindex="2"name="radius"type="float"/>
<argumentindex="3"name="color"type="Color"/>
<description>
Adds a circle command to the [CanvasItem]'s draw commands.
</description>
</method>
<methodname="canvas_item_add_clip_ignore">
<returntype="void"/>
<argumentindex="0"name="item"type="RID"/>
<argumentindex="1"name="ignore"type="bool"/>
<description>
If ignore is [code]true[/code], the VisualServer does not perform clipping.
Adds a triangle array to the [CanvasItem]'s draw commands.
</description>
</method>
<methodname="canvas_item_clear">
<returntype="void"/>
<argumentindex="0"name="item"type="RID"/>
<description>
Clears the [CanvasItem] and removes all commands in it.
</description>
</method>
<methodname="canvas_item_create">
<returntype="RID"/>
<description>
Creates a new [CanvasItem] and returns its [RID]. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_item_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
</description>
</method>
<methodname="canvas_item_set_clip">
<returntype="void"/>
<argumentindex="0"name="item"type="RID"/>
<argumentindex="1"name="clip"type="bool"/>
<description>
Sets clipping for the [CanvasItem].
</description>
</method>
<methodname="canvas_item_set_copy_to_backbuffer">
<returntype="void"/>
<argumentindex="0"name="item"type="RID"/>
<argumentindex="1"name="enabled"type="bool"/>
<argumentindex="2"name="rect"type="Rect2"/>
<description>
Sets the [CanvasItem] to copy a rect to the backbuffer.
If this is enabled, the Z index of the parent will be added to the children's Z index.
</description>
</method>
<methodname="canvas_item_set_z_index">
<returntype="void"/>
<argumentindex="0"name="item"type="RID"/>
<argumentindex="1"name="z_index"type="int"/>
<description>
Sets the [CanvasItem]'s Z index, i.e. its draw order (lower indexes are drawn first).
</description>
</method>
<methodname="canvas_light_attach_to_canvas">
<returntype="void"/>
<argumentindex="0"name="light"type="RID"/>
<argumentindex="1"name="canvas"type="RID"/>
<description>
Attaches the canvas light to the canvas. Removes it from its previous canvas.
</description>
</method>
<methodname="canvas_light_create">
<returntype="RID"/>
<description>
Creates a canvas light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
Attaches a light occluder to the canvas. Removes it from its previous canvas.
</description>
</method>
<methodname="canvas_light_occluder_create">
<returntype="RID"/>
<description>
Creates a light occluder and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_ocluder_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
Sets the Z range of objects that will be affected by this light. Equivalent to [member Light2D.range_z_min] and [member Light2D.range_z_max].
</description>
</method>
<methodname="canvas_occluder_polygon_create">
<returntype="RID"/>
<description>
Creates a new light occluder polygon and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_occluder_polygon_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
A copy of the canvas item will be drawn with a local offset of the mirroring [Vector2].
</description>
</method>
<methodname="canvas_set_modulate">
<returntype="void"/>
<argumentindex="0"name="canvas"type="RID"/>
<argumentindex="1"name="color"type="Color"/>
<description>
Modulates all colors in the given canvas.
</description>
</method>
<methodname="directional_light_create">
<returntype="RID"/>
<description>
Creates a directional light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
To place in a scene, attach this directional light to an instance using [method instance_set_base] using the returned RID.
Draws a frame. [i]This method is deprecated[/i], please use [method force_draw] instead.
</description>
</method>
<methodname="environment_create">
<returntype="RID"/>
<description>
Creates an environment and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]environment_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
</description>
</method>
<methodname="environment_set_adjustment">
<returntype="void"/>
<argumentindex="0"name="env"type="RID"/>
<argumentindex="1"name="enable"type="bool"/>
<argumentindex="2"name="brightness"type="float"/>
<argumentindex="3"name="contrast"type="float"/>
<argumentindex="4"name="saturation"type="float"/>
<argumentindex="5"name="ramp"type="RID"/>
<description>
Sets the values to be used with the "Adjustment" post-process effect. See [Environment] for more details.
Returns [code]true[/code] if changes have been made to the VisualServer's data. [method draw] is usually called if this happens.
As changes are registered as either high or low priority (e.g. dynamic shaders), this function takes an optional argument to query either low or high priority changes, or any changes.
Not yet implemented. Always returns [code]false[/code].
</description>
</method>
<methodname="has_os_feature"qualifiers="const">
<returntype="bool"/>
<argumentindex="0"name="feature"type="String"/>
<description>
Returns [code]true[/code] if the OS supports a certain feature. Features might be [code]s3tc[/code], [code]etc[/code], [code]etc2[/code], [code]pvrtc[/code] and [code]skinning_fallback[/code].
When rendering with GLES2, returns [code]true[/code] with [code]skinning_fallback[/code] in case the hardware doesn't support the default GPU skinning process.
Sets up [ImmediateGeometry] internals to prepare for drawing. Equivalent to [method ImmediateGeometry.begin].
</description>
</method>
<methodname="immediate_clear">
<returntype="void"/>
<argumentindex="0"name="immediate"type="RID"/>
<description>
Clears everything that was set up between [method immediate_begin] and [method immediate_end]. Equivalent to [method ImmediateGeometry.clear].
</description>
</method>
<methodname="immediate_color">
<returntype="void"/>
<argumentindex="0"name="immediate"type="RID"/>
<argumentindex="1"name="color"type="Color"/>
<description>
Sets the color to be used with next vertex. Equivalent to [method ImmediateGeometry.set_color].
</description>
</method>
<methodname="immediate_create">
<returntype="RID"/>
<description>
Creates an immediate geometry and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]immediate_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
To place in a scene, attach this immediate geometry to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
<methodname="immediate_end">
<returntype="void"/>
<argumentindex="0"name="immediate"type="RID"/>
<description>
Ends drawing the [ImmediateGeometry] and displays it. Equivalent to [method ImmediateGeometry.end].
Returns the material assigned to the [ImmediateGeometry].
</description>
</method>
<methodname="immediate_normal">
<returntype="void"/>
<argumentindex="0"name="immediate"type="RID"/>
<argumentindex="1"name="normal"type="Vector3"/>
<description>
Sets the normal to be used with next vertex. Equivalent to [method ImmediateGeometry.set_normal].
</description>
</method>
<methodname="immediate_set_material">
<returntype="void"/>
<argumentindex="0"name="immediate"type="RID"/>
<argumentindex="1"name="material"type="RID"/>
<description>
Sets the material to be used to draw the [ImmediateGeometry].
</description>
</method>
<methodname="immediate_tangent">
<returntype="void"/>
<argumentindex="0"name="immediate"type="RID"/>
<argumentindex="1"name="tangent"type="Plane"/>
<description>
Sets the tangent to be used with next vertex. Equivalent to [method ImmediateGeometry.set_tangent].
</description>
</method>
<methodname="immediate_uv">
<returntype="void"/>
<argumentindex="0"name="immediate"type="RID"/>
<argumentindex="1"name="tex_uv"type="Vector2"/>
<description>
Sets the UV to be used with next vertex. Equivalent to [method ImmediateGeometry.set_uv].
</description>
</method>
<methodname="immediate_uv2">
<returntype="void"/>
<argumentindex="0"name="immediate"type="RID"/>
<argumentindex="1"name="tex_uv"type="Vector2"/>
<description>
Sets the UV2 to be used with next vertex. Equivalent to [method ImmediateGeometry.set_uv2].
</description>
</method>
<methodname="immediate_vertex">
<returntype="void"/>
<argumentindex="0"name="immediate"type="RID"/>
<argumentindex="1"name="vertex"type="Vector3"/>
<description>
Adds the next vertex using the information provided in advance. Equivalent to [method ImmediateGeometry.add_vertex].
</description>
</method>
<methodname="immediate_vertex_2d">
<returntype="void"/>
<argumentindex="0"name="immediate"type="RID"/>
<argumentindex="1"name="vertex"type="Vector2"/>
<description>
Adds the next vertex using the information provided in advance. This is a helper class that calls [method immediate_vertex] under the hood. Equivalent to [method ImmediateGeometry.add_vertex].
</description>
</method>
<methodname="init">
<returntype="void"/>
<description>
Initializes the visual server. This function is called internally by platform-dependent code during engine initialization. If called from a running game, it will not do anything.
</description>
</method>
<methodname="instance_attach_object_instance_id">
<returntype="void"/>
<argumentindex="0"name="instance"type="RID"/>
<argumentindex="1"name="id"type="int"/>
<description>
Attaches a unique Object ID to instance. Object ID must be attached to instance for proper culling with [method instances_cull_aabb], [method instances_cull_convex], and [method instances_cull_ray].
</description>
</method>
<methodname="instance_attach_skeleton">
<returntype="void"/>
<argumentindex="0"name="instance"type="RID"/>
<argumentindex="1"name="skeleton"type="RID"/>
<description>
Attaches a skeleton to an instance. Removes the previous skeleton from the instance.
</description>
</method>
<methodname="instance_create">
<returntype="RID"/>
<description>
Creates a visual instance and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
An instance is a way of placing a 3D object in the scenario. Objects like particles, meshes, and reflection probes need to be associated with an instance to be visible in the scenario using [method instance_set_base].
</description>
</method>
<methodname="instance_create2">
<returntype="RID"/>
<argumentindex="0"name="base"type="RID"/>
<argumentindex="1"name="scenario"type="RID"/>
<description>
Creates a visual instance, adds it to the VisualServer, and sets both base and scenario. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
Sets a material that will be rendered for all surfaces on top of active materials for the mesh associated with this instance. Equivalent to [member GeometryInstance.material_overlay].
Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to [member GeometryInstance.material_override].
</description>
</method>
<methodname="instance_set_base">
<returntype="void"/>
<argumentindex="0"name="instance"type="RID"/>
<argumentindex="1"name="base"type="RID"/>
<description>
Sets the base of the instance. A base can be any of the 3D objects that are created in the VisualServer that can be displayed. For example, any of the light types, mesh, multimesh, immediate geometry, particle system, reflection probe, lightmap capture, and the GI probe are all types that can be set as the base of an instance in order to be displayed in the scenario.
</description>
</method>
<methodname="instance_set_blend_shape_weight">
<returntype="void"/>
<argumentindex="0"name="instance"type="RID"/>
<argumentindex="1"name="shape"type="int"/>
<argumentindex="2"name="weight"type="float"/>
<description>
Sets the weight for a given blend shape associated with this instance.
</description>
</method>
<methodname="instance_set_custom_aabb">
<returntype="void"/>
<argumentindex="0"name="instance"type="RID"/>
<argumentindex="1"name="aabb"type="AABB"/>
<description>
Sets a custom AABB to use when culling objects from the view frustum. Equivalent to [method GeometryInstance.set_custom_aabb].
Sets a margin to increase the size of the AABB when culling objects from the view frustum. This allows you to avoid culling objects that fall outside the view frustum. Equivalent to [member GeometryInstance.extra_cull_margin].
</description>
</method>
<methodname="instance_set_layer_mask">
<returntype="void"/>
<argumentindex="0"name="instance"type="RID"/>
<argumentindex="1"name="mask"type="int"/>
<description>
Sets the render layers that this instance will be drawn to. Equivalent to [member VisualInstance.layers].
</description>
</method>
<methodname="instance_set_scenario">
<returntype="void"/>
<argumentindex="0"name="instance"type="RID"/>
<argumentindex="1"name="scenario"type="RID"/>
<description>
Sets the scenario that the instance is in. The scenario is the 3D world that the objects will be displayed in.
</description>
</method>
<methodname="instance_set_surface_material">
<returntype="void"/>
<argumentindex="0"name="instance"type="RID"/>
<argumentindex="1"name="surface"type="int"/>
<argumentindex="2"name="material"type="RID"/>
<description>
Sets the material of a specific surface. Equivalent to [method MeshInstance.set_surface_material].
Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as [MeshInstance] or [DirectionalLight]. Use [method @GDScript.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
</description>
</method>
<methodname="light_directional_set_blend_splits">
<returntype="void"/>
<argumentindex="0"name="light"type="RID"/>
<argumentindex="1"name="enable"type="bool"/>
<description>
If [code]true[/code], this directional light will blend between shadow map splits resulting in a smoother transition between them. Equivalent to [member DirectionalLight.directional_shadow_blend_splits].
Sets the shadow depth range mode for this directional light. Equivalent to [member DirectionalLight.directional_shadow_depth_range]. See [enum LightDirectionalShadowDepthRangeMode] for options.
Sets the shadow mode for this directional light. Equivalent to [member DirectionalLight.directional_shadow_mode]. See [enum LightDirectionalShadowMode] for options.
Sets whether to use vertical or horizontal detail for this omni light. This can be used to alleviate artifacts in the shadow map. Equivalent to [member OmniLight.omni_shadow_detail].
Sets whether to use a dual paraboloid or a cubemap for the shadow map. Dual paraboloid is faster but may suffer from artifacts. Equivalent to [member OmniLight.omni_shadow_mode].
</description>
</method>
<methodname="light_set_color">
<returntype="void"/>
<argumentindex="0"name="light"type="RID"/>
<argumentindex="1"name="color"type="Color"/>
<description>
Sets the color of the light. Equivalent to [member Light.light_color].
</description>
</method>
<methodname="light_set_cull_mask">
<returntype="void"/>
<argumentindex="0"name="light"type="RID"/>
<argumentindex="1"name="mask"type="int"/>
<description>
Sets the cull mask for this Light. Lights only affect objects in the selected layers. Equivalent to [member Light.light_cull_mask].
</description>
</method>
<methodname="light_set_negative">
<returntype="void"/>
<argumentindex="0"name="light"type="RID"/>
<argumentindex="1"name="enable"type="bool"/>
<description>
If [code]true[/code], light will subtract light instead of adding light. Equivalent to [member Light.light_negative].
Sets the specified light parameter. See [enum LightParam] for options. Equivalent to [method Light.set_param].
</description>
</method>
<methodname="light_set_projector">
<returntype="void"/>
<argumentindex="0"name="light"type="RID"/>
<argumentindex="1"name="texture"type="RID"/>
<description>
Not implemented in Godot 3.x.
</description>
</method>
<methodname="light_set_reverse_cull_face_mode">
<returntype="void"/>
<argumentindex="0"name="light"type="RID"/>
<argumentindex="1"name="enabled"type="bool"/>
<description>
If [code]true[/code], reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double sided shadows with [method instance_geometry_set_cast_shadows_setting]. Equivalent to [member Light.shadow_reverse_cull_face].
</description>
</method>
<methodname="light_set_shadow">
<returntype="void"/>
<argumentindex="0"name="light"type="RID"/>
<argumentindex="1"name="enabled"type="bool"/>
<description>
If [code]true[/code], light will cast shadows. Equivalent to [member Light.shadow_enabled].
</description>
</method>
<methodname="light_set_shadow_color">
<returntype="void"/>
<argumentindex="0"name="light"type="RID"/>
<argumentindex="1"name="color"type="Color"/>
<description>
Sets the color of the shadow cast by the light. Equivalent to [member Light.shadow_color].
</description>
</method>
<methodname="make_sphere_mesh">
<returntype="RID"/>
<argumentindex="0"name="latitudes"type="int"/>
<argumentindex="1"name="longitudes"type="int"/>
<argumentindex="2"name="radius"type="float"/>
<description>
Returns a mesh of a sphere with the given amount of horizontal and vertical subdivisions.
</description>
</method>
<methodname="material_create">
<returntype="RID"/>
<description>
Creates an empty material and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]material_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
Adds a surface generated from the Arrays to a mesh. See [enum PrimitiveType] constants for types.
</description>
</method>
<methodname="mesh_clear">
<returntype="void"/>
<argumentindex="0"name="mesh"type="RID"/>
<description>
Removes all surfaces from a mesh.
</description>
</method>
<methodname="mesh_create">
<returntype="RID"/>
<description>
Creates a new mesh and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]mesh_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
To place in a scene, attach this mesh to an instance using [method instance_set_base] using the returned RID.
Updates a specific region of a vertex buffer for the specified surface. Warning: this function alters the vertex buffer directly with no safety mechanisms, you can easily corrupt your mesh.
Allocates space for the multimesh data. Format parameters determine how the data will be stored by OpenGL. See [enum MultimeshTransformFormat], [enum MultimeshColorFormat], and [enum MultimeshCustomDataFormat] for usage. Equivalent to [member MultiMesh.instance_count].
</description>
</method>
<methodname="multimesh_create">
<returntype="RID"/>
<description>
Creates a new multimesh on the VisualServer and returns an [RID] handle. This RID will be used in all [code]multimesh_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
To place in a scene, attach this multimesh to an instance using [method instance_set_base] using the returned RID.
Sets the custom data for this instance. Custom data is passed as a [Color], but is interpreted as a [code]vec4[/code] in the shader. Equivalent to [method MultiMesh.set_instance_custom_data].
Sets all data related to the instances in one go. This is especially useful when loading the data from disk or preparing the data from GDNative.
All data is packed in one large float array. An array may look like this: Transform for instance 1, color data for instance 1, custom data for instance 1, transform for instance 2, color data for instance 2, etc.
[Transform] is stored as 12 floats, [Transform2D] is stored as 8 floats, [code]COLOR_8BIT[/code] / [code]CUSTOM_DATA_8BIT[/code] is stored as 1 float (4 bytes as is) and [code]COLOR_FLOAT[/code] / [code]CUSTOM_DATA_FLOAT[/code] is stored as 4 floats.
</description>
</method>
<methodname="multimesh_set_mesh">
<returntype="void"/>
<argumentindex="0"name="multimesh"type="RID"/>
<argumentindex="1"name="mesh"type="RID"/>
<description>
Sets the mesh to be drawn by the multimesh. Equivalent to [member MultiMesh.mesh].
</description>
</method>
<methodname="multimesh_set_visible_instances">
<returntype="void"/>
<argumentindex="0"name="multimesh"type="RID"/>
<argumentindex="1"name="visible"type="int"/>
<description>
Sets the number of instances visible at a given time. If -1, all instances that have been allocated are drawn. Equivalent to [member MultiMesh.visible_instance_count].
</description>
</method>
<methodname="omni_light_create">
<returntype="RID"/>
<description>
Creates a new omni light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
To place in a scene, attach this omni light to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
<methodname="reflection_probe_create">
<returntype="RID"/>
<description>
Creates a reflection probe and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]reflection_probe_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
To place in a scene, attach this reflection probe to an instance using [method instance_set_base] using the returned RID.
</description>
</method>
<methodname="reflection_probe_set_as_interior">
<returntype="void"/>
<argumentindex="0"name="probe"type="RID"/>
<argumentindex="1"name="enable"type="bool"/>
<description>
If [code]true[/code], reflections will ignore sky contribution. Equivalent to [member ReflectionProbe.interior_enable].
</description>
</method>
<methodname="reflection_probe_set_cull_mask">
<returntype="void"/>
<argumentindex="0"name="probe"type="RID"/>
<argumentindex="1"name="layers"type="int"/>
<description>
Sets the render cull mask for this reflection probe. Only instances with a matching cull mask will be rendered by this probe. Equivalent to [member ReflectionProbe.cull_mask].
If [code]true[/code], uses box projection. This can make reflections look more correct in certain situations. Equivalent to [member ReflectionProbe.box_projection].
If [code]true[/code], computes shadows in the reflection probe. This makes the reflection much slower to compute. Equivalent to [member ReflectionProbe.enable_shadows].
</description>
</method>
<methodname="reflection_probe_set_extents">
<returntype="void"/>
<argumentindex="0"name="probe"type="RID"/>
<argumentindex="1"name="extents"type="Vector3"/>
<description>
Sets the size of the area that the reflection probe will capture. Equivalent to [member ReflectionProbe.extents].
</description>
</method>
<methodname="reflection_probe_set_intensity">
<returntype="void"/>
<argumentindex="0"name="probe"type="RID"/>
<argumentindex="1"name="intensity"type="float"/>
<description>
Sets the intensity of the reflection probe. Intensity modulates the strength of the reflection. Equivalent to [member ReflectionProbe.intensity].
Sets the energy multiplier for this reflection probes ambient light contribution when set to interior mode. Equivalent to [member ReflectionProbe.interior_ambient_energy].
Sets the contribution value for how much the reflection affects the ambient light for this reflection probe when set to interior mode. Useful so that ambient light matches the color of the room. Equivalent to [member ReflectionProbe.interior_ambient_contrib].
</description>
</method>
<methodname="reflection_probe_set_max_distance">
<returntype="void"/>
<argumentindex="0"name="probe"type="RID"/>
<argumentindex="1"name="distance"type="float"/>
<description>
Sets the max distance away from the probe an object can be before it is culled. Equivalent to [member ReflectionProbe.max_distance].
</description>
</method>
<methodname="reflection_probe_set_origin_offset">
<returntype="void"/>
<argumentindex="0"name="probe"type="RID"/>
<argumentindex="1"name="offset"type="Vector3"/>
<description>
Sets the origin offset to be used when this reflection probe is in box project mode. Equivalent to [member ReflectionProbe.origin_offset].
Creates a scenario and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]scenario_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
The scenario is the 3D world that all the visual instances exist in.
Sets the [enum ScenarioDebugMode] for this scenario. See [enum ScenarioDebugMode] for options.
</description>
</method>
<methodname="scenario_set_environment">
<returntype="void"/>
<argumentindex="0"name="scenario"type="RID"/>
<argumentindex="1"name="environment"type="RID"/>
<description>
Sets the environment that will be used with this scenario.
</description>
</method>
<methodname="scenario_set_fallback_environment">
<returntype="void"/>
<argumentindex="0"name="scenario"type="RID"/>
<argumentindex="1"name="environment"type="RID"/>
<description>
Sets the fallback environment to be used by this scenario. The fallback environment is used if no environment is set. Internally, this is used by the editor to provide a default environment.
</description>
</method>
<methodname="scenario_set_reflection_atlas_size">
<returntype="void"/>
<argumentindex="0"name="scenario"type="RID"/>
<argumentindex="1"name="size"type="int"/>
<argumentindex="2"name="subdiv"type="int"/>
<description>
Sets the size of the reflection atlas shared by all reflection probes in this scenario.
Sets a boot image. The color defines the background color. If [code]scale[/code] is [code]true[/code], the image will be scaled to fit the screen size. If [code]use_filter[/code] is [code]true[/code], the image will be scaled with linear interpolation. If [code]use_filter[/code] is [code]false[/code], the image will be scaled with nearest-neighbor interpolation.
</description>
</method>
<methodname="set_debug_generate_wireframes">
<returntype="void"/>
<argumentindex="0"name="generate"type="bool"/>
<description>
If [code]true[/code], the engine will generate wireframes for use with the wireframe debug mode.
</description>
</method>
<methodname="set_default_clear_color">
<returntype="void"/>
<argumentindex="0"name="color"type="Color"/>
<description>
Sets the default clear color which is used when a specific clear color has not been selected.
</description>
</method>
<methodname="set_shader_async_hidden_forbidden">
<returntype="void"/>
<argumentindex="0"name="forbidden"type="bool"/>
<description>
If asynchronous shader compilation is enabled, this controls whether [constant SpatialMaterial.ASYNC_MODE_HIDDEN] is obeyed.
For instance, you may want to enable this temporarily before taking a screenshot. This ensures everything is visible even if shaders with async mode [i]hidden[/i] are not ready yet.
Reflection probes use this internally to ensure they capture everything regardless the shaders are ready or not.
</description>
</method>
<methodname="set_shader_time_scale">
<returntype="void"/>
<argumentindex="0"name="scale"type="float"/>
<description>
Sets the scale to apply to the passage of time for the shaders' [code]TIME[/code] builtin.
The default value is [code]1.0[/code], which means [code]TIME[/code] will count the real time as it goes by, without narrowing or stretching it.
</description>
</method>
<methodname="set_use_occlusion_culling">
<returntype="void"/>
<argumentindex="0"name="enable"type="bool"/>
<description>
Enables or disables occlusion culling.
</description>
</method>
<methodname="shader_create">
<returntype="RID"/>
<description>
Creates an empty shader and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]shader_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
Sets the [Transform2D] for a specific bone of this skeleton.
</description>
</method>
<methodname="skeleton_create">
<returntype="RID"/>
<description>
Creates a skeleton and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]skeleton_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
Returns the number of bones allocated for this skeleton.
</description>
</method>
<methodname="sky_create">
<returntype="RID"/>
<description>
Creates an empty sky and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]sky_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
Creates a spot light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
To place in a scene, attach this spot light to an instance using [method instance_set_base] using the returned RID.
Creates an empty texture and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]texture_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
Sets a part of the data for a texture. Warning: this function calls the underlying graphics API directly and may corrupt your texture if used improperly.
</description>
</method>
<methodname="texture_set_flags">
<returntype="void"/>
<argumentindex="0"name="texture"type="RID"/>
<argumentindex="1"name="flags"type="int"/>
<description>
Sets the texture's flags. See [enum TextureFlags] for options.
Creates an update link between two textures, similar to how [ViewportTexture]s operate. When the base texture is the texture of a [Viewport], every time the viewport renders a new frame, the proxy texture automatically receives an update.
For example, this code links a generic [ImageTexture] to the texture output of the [Viewport] using the VisualServer API:
[codeblock]
func _ready():
var viewport_rid = get_viewport().get_viewport_rid()
var viewport_texture_rid = VisualServer.viewport_get_texture(viewport_rid)
var proxy_texture = ImageTexture.new()
var viewport_texture_image_data = VisualServer.texture_get_data(viewport_texture_rid)
Copies viewport to a region of the screen specified by [code]rect[/code]. If [member Viewport.render_direct_to_screen] is [code]true[/code], then viewport does not use a framebuffer and the contents of the viewport are rendered directly to screen. However, note that the root viewport is drawn last, therefore it will draw over the screen. Accordingly, you must set the root viewport to an area that does not cover the area that you have attached this viewport to.
For example, you can set the root viewport to not render at all with the following code:
Using this can result in significant optimization, especially on lower-end devices. However, it comes at the cost of having to manage your viewports manually. For a further optimization see, [method viewport_set_render_direct_to_screen].
</description>
</method>
<methodname="viewport_create">
<returntype="RID"/>
<description>
Creates an empty viewport and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all [code]viewport_*[/code] VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer's [method free_rid] static method.
If [code]true[/code], render the contents of the viewport directly to screen. This allows a low-level optimization where you can skip drawing a viewport to the root viewport. While this optimization can result in a significant increase in speed (especially on older devices), it comes at a cost of usability. When this is enabled, you cannot read from the viewport or from the [code]SCREEN_TEXTURE[/code]. You also lose the benefit of certain window settings, such as the various stretch modes. Another consequence to be aware of is that in 2D the rendering happens in window coordinates, so if you have a viewport that is double the size of the window, and you set this, then only the portion that fits within the window will be drawn, no automatic scaling is possible, even if your game scene is significantly larger than the window size.
</description>
</method>
<methodname="viewport_set_scenario">
<returntype="void"/>
<argumentindex="0"name="viewport"type="RID"/>
<argumentindex="1"name="scenario"type="RID"/>
<description>
Sets a viewport's scenario.
The scenario contains information about the [enum ScenarioDebugMode], environment information, reflection atlas etc.
Sets the size of the shadow atlas's images (used for omni and spot lights). The value will be rounded up to the nearest power of 2.
</description>
</method>
<methodname="viewport_set_sharpen_intensity">
<returntype="void"/>
<argumentindex="0"name="viewport"type="RID"/>
<argumentindex="1"name="intensity"type="float"/>
<description>
Sets the sharpening [code]intensity[/code] for the [code]viewport[/code]. If set to a value greater than [code]0.0[/code], contrast-adaptive sharpening will be applied to the 3D viewport. This has a low performance cost and can be used to recover some of the sharpness lost from using FXAA. Values around [code]0.5[/code] generally give the best results. See also [method viewport_set_use_fxaa].
Sets the viewport's 2D/3D mode. See [enum ViewportUsage] constants for options.
</description>
</method>
<methodname="viewport_set_use_debanding">
<returntype="void"/>
<argumentindex="0"name="viewport"type="RID"/>
<argumentindex="1"name="debanding"type="bool"/>
<description>
If [code]true[/code], uses a fast post-processing filter to make banding significantly less visible. In some cases, debanding may introduce a slightly noticeable dithering pattern. It's recommended to enable debanding only when actually needed since the dithering pattern will make lossless-compressed screenshots larger.
[b]Note:[/b] Only available on the GLES3 backend. [member Viewport.hdr] must also be [code]true[/code] for debanding to be effective.
</description>
</method>
<methodname="viewport_set_use_fxaa">
<returntype="void"/>
<argumentindex="0"name="viewport"type="RID"/>
<argumentindex="1"name="fxaa"type="bool"/>
<description>
Enables fast approximate antialiasing for this viewport. FXAA is a popular screen-space antialiasing method, which is fast but will make the image look blurry, especially at lower resolutions. It can still work relatively well at large resolutions such as 1440p and 4K. Some of the lost sharpness can be recovered by enabling contrast-adaptive sharpening (see [method viewport_set_sharpen_intensity]).
</description>
</method>
<methodname="viewport_set_vflip">
<returntype="void"/>
<argumentindex="0"name="viewport"type="RID"/>
<argumentindex="1"name="enabled"type="bool"/>
<description>
If [code]true[/code], the viewport's rendering is flipped vertically.
If [code]false[/code], disables rendering completely, but the engine logic is still being processed. You can call [method force_draw] to draw a frame even with rendering disabled.
</member>
</members>
<signals>
<signalname="frame_post_draw">
<description>
Emitted at the end of the frame, after the VisualServer has finished updating all the Viewports.
</description>
</signal>
<signalname="frame_pre_draw">
<description>
Emitted at the beginning of the frame, before the VisualServer updates all the Viewports.
</description>
</signal>
</signals>
<constants>
<constantname="NO_INDEX_ARRAY"value="-1">
Marks an error that shows that the index array is empty.
</constant>
<constantname="ARRAY_WEIGHTS_SIZE"value="4">
Number of weights/bones per vertex.
</constant>
<constantname="CANVAS_ITEM_Z_MIN"value="-4096">
The minimum Z-layer for canvas items.
</constant>
<constantname="CANVAS_ITEM_Z_MAX"value="4096">
The maximum Z-layer for canvas items.
</constant>
<constantname="MAX_GLOW_LEVELS"value="7">
Max number of glow levels that can be used with glow post-process effect.
Used to set flags [constant ARRAY_COMPRESS_NORMAL], [constant ARRAY_COMPRESS_TANGENT], [constant ARRAY_COMPRESS_COLOR], [constant ARRAY_COMPRESS_TEX_UV], [constant ARRAY_COMPRESS_TEX_UV2], [constant ARRAY_COMPRESS_WEIGHTS], and [constant ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION] quickly.
Draw all objects in a way that displays how much overdraw is occurring. Overdraw occurs when a section of pixels is drawn and shaded and then another object covers it up. To optimize a scene, you should reduce overdraw.
Use the Reinhard tonemapper. Performs a variation on rendered pixels' colors by this formula: [code]color = color / (1 + color)[/code]. This avoids clipping bright highlights, but the resulting image can look a bit dull.
Use the filmic tonemapper. This avoids clipping bright highlights, with a resulting image that usually looks more vivid than [constant ENV_TONE_MAPPER_REINHARD].
Use the legacy Godot version of the Academy Color Encoding System tonemapper. Unlike [constant ENV_TONE_MAPPER_ACES_FITTED], this version of ACES does not handle bright lighting in a physically accurate way. ACES typically has a more contrasted output compared to [constant ENV_TONE_MAPPER_REINHARD] and [constant ENV_TONE_MAPPER_FILMIC].
[b]Note:[/b] This tonemapping operator will be removed in Godot 4.0 in favor of the more accurate [constant ENV_TONE_MAPPER_ACES_FITTED].
Use the Academy Color Encoding System tonemapper. ACES is slightly more expensive than other options, but it handles bright lighting in a more realistic fashion by desaturating it as it becomes brighter. ACES typically has a more contrasted output compared to [constant ENV_TONE_MAPPER_REINHARD] and [constant ENV_TONE_MAPPER_FILMIC].
Registered changes which have low priority can be optionally prevented from causing editor redraws. Examples might include dynamic shaders (typically using the [code]TIME[/code] built-in).