Class RenderingServer
Server for anything visible.
- Inheritance
-
RenderingServer
Remarks
The rendering server is the API backend for everything visible. The whole scene system mounts on it to display. The rendering server is completely opaque: the internals are entirely implementation-specific and cannot be accessed.
The rendering server can be used to bypass the scene/Node system entirely. This can improve performance in cases where the scene system is the bottleneck, but won't improve performance otherwise (for instance, if the GPU is already fully utilized).
Resources are created using the *_create
functions. These functions return RIDs which are not references to the objects themselves, but opaque pointers towards these objects.
All objects are drawn to a viewport. You can use the Viewport attached to the SceneTree or you can create one yourself with viewport_create. When using a custom scenario or canvas, the scenario or canvas needs to be attached to the viewport using RenderingServer.viewport_set_scenario or RenderingServer.viewport_attach_canvas.
Scenarios: In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the rendering server from a running game, the scenario can be accessed from the scene tree from any Node3D node with get_world_3d. Otherwise, a scenario can be created with scenario_create.
Similarly, in 2D, a canvas is needed to draw all canvas items.
3D: 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 RenderingServer.instance_set_base. The instance must also be attached to the scenario using RenderingServer.instance_set_scenario in order to be visible. RenderingServer methods that don't have a prefix are usually 3D-specific (but not always).
2D: 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. 2D-specific RenderingServer methods generally start with canvas_*
.
Headless mode: Starting the engine with the --headless
command line argument disables all rendering and window management functions. Most functions from RenderingServer will return dummy values in this case.
See Also
Fields
NO_INDEX_ARRAY
Marks an error that shows that the index array is empty.
const NO_INDEX_ARRAY = -1
ARRAY_WEIGHTS_SIZE
Number of weights/bones per vertex.
const ARRAY_WEIGHTS_SIZE = 4
CANVAS_ITEM_Z_MIN
The minimum Z-layer for canvas items.
const CANVAS_ITEM_Z_MIN = -4096
CANVAS_ITEM_Z_MAX
The maximum Z-layer for canvas items.
const CANVAS_ITEM_Z_MAX = 4096
MAX_GLOW_LEVELS
The maximum number of glow levels that can be used with the glow post-processing effect.
const MAX_GLOW_LEVELS = 7
MAX_CURSORS
const MAX_CURSORS = 8
MAX_2D_DIRECTIONAL_LIGHTS
The maximum number of directional lights that can be rendered at a given time in 2D.
const MAX_2D_DIRECTIONAL_LIGHTS = 8
MAX_MESH_SURFACES
The maximum number of surfaces a mesh can have.
const MAX_MESH_SURFACES = 256
MATERIAL_RENDER_PRIORITY_MIN
The minimum renderpriority of all materials.
const MATERIAL_RENDER_PRIORITY_MIN = -128
MATERIAL_RENDER_PRIORITY_MAX
The maximum renderpriority of all materials.
const MATERIAL_RENDER_PRIORITY_MAX = 127
ARRAY_CUSTOM_COUNT
The number of custom data arrays available (RenderingServer.ARRAY_CUSTOM0, RenderingServer.ARRAY_CUSTOM1, RenderingServer.ARRAY_CUSTOM2, RenderingServer.ARRAY_CUSTOM3).
const ARRAY_CUSTOM_COUNT = 4
PARTICLES_EMIT_FLAG_POSITION
const PARTICLES_EMIT_FLAG_POSITION = 1
PARTICLES_EMIT_FLAG_ROTATION_SCALE
const PARTICLES_EMIT_FLAG_ROTATION_SCALE = 2
PARTICLES_EMIT_FLAG_VELOCITY
const PARTICLES_EMIT_FLAG_VELOCITY = 4
PARTICLES_EMIT_FLAG_COLOR
const PARTICLES_EMIT_FLAG_COLOR = 8
PARTICLES_EMIT_FLAG_CUSTOM
const PARTICLES_EMIT_FLAG_CUSTOM = 16
Properties
render_loop_enabled
If false
, disables rendering completely, but the engine logic is still being processed. You can call RenderingServer.force_draw to draw a frame even with rendering disabled.
var render_loop_enabled : bool
Property Value
Remarks
Methods
bake_render_uv2(RID, RID[], Vector2i)
Bakes the material data of the Mesh passed in the base
parameter with optional material_overrides
to a set of Images of size image_size
. Returns an array of Images containing material properties as specified in BakeChannels.
Image[] bake_render_uv2(RID base, RID[] material_overrides, Vector2i image_size)
Parameters
call_on_render_thread(Callable)
As the RenderingServer actual logic may run on an separate thread, accessing its internals from the main (or any other) thread will result in errors. To make it easier to run code that can safely access the rendering internals (such as RenderingDevice and similar RD classes), push a callable via this function so it will be executed on the render thread.
void call_on_render_thread(Callable callable)
Parameters
callable
Callable
camera_attributes_create
Creates a camera attributes object and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all camera_attributes_
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent resource is CameraAttributes.
RID camera_attributes_create
camera_attributes_set_auto_exposure(RID, bool, float, float, float, float)
Sets the parameters to use with the auto-exposure effect. These parameters take on the same meaning as their counterparts in CameraAttributes and CameraAttributesPractical.
void camera_attributes_set_auto_exposure(RID camera_attributes, bool enable, float min_sensitivity, float max_sensitivity, float speed, float scale)
Parameters
camera_attributes
RIDenable
boolmin_sensitivity
floatmax_sensitivity
floatspeed
floatscale
float
camera_attributes_set_dof_blur(RID, bool, float, float, bool, float, float, float)
Sets the parameters to use with the DOF blur effect. These parameters take on the same meaning as their counterparts in CameraAttributesPractical.
void camera_attributes_set_dof_blur(RID camera_attributes, bool far_enable, float far_distance, float far_transition, bool near_enable, float near_distance, float near_transition, float amount)
Parameters
camera_attributes
RIDfar_enable
boolfar_distance
floatfar_transition
floatnear_enable
boolnear_distance
floatnear_transition
floatamount
float
camera_attributes_set_dof_blur_bokeh_shape(int)
Sets the shape of the DOF bokeh pattern. Different shapes may be used to achieve artistic effect, or to meet performance targets. For more detail on available options see DOFBokehShape.
void camera_attributes_set_dof_blur_bokeh_shape(int shape)
Parameters
shape
int
camera_attributes_set_dof_blur_quality(int, bool)
Sets the quality level of the DOF blur effect to one of the options in DOFBlurQuality. use_jitter
can be used to jitter samples taken during the blur pass to hide artifacts at the cost of looking more fuzzy.
void camera_attributes_set_dof_blur_quality(int quality, bool use_jitter)
Parameters
camera_attributes_set_exposure(RID, float, float)
Sets the exposure values that will be used by the renderers. The normalization amount is used to bake a given Exposure Value (EV) into rendering calculations to reduce the dynamic range of the scene.
The normalization factor can be calculated from exposure value (EV100) as follows:
func get_exposure_normalization(ev100: float):
return 1.0 / (pow(2.0, ev100) * 1.2)
The exposure value can be calculated from aperture (in f-stops), shutter speed (in seconds), and sensitivity (in ISO) as follows:
func get_exposure(aperture: float, shutter_speed: float, sensitivity: float):
return log((aperture * aperture) / shutter_speed * (100.0 / sensitivity)) / log(2)
void camera_attributes_set_exposure(RID camera_attributes, float multiplier, float normalization)
Parameters
camera_create
Creates a 3D camera and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all camera_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent node is Camera3D.
RID camera_create
camera_set_camera_attributes(RID, RID)
Sets the camera_attributes created with camera_attributes_create to the given camera.
void camera_set_camera_attributes(RID camera, RID effects)
Parameters
camera_set_compositor(RID, RID)
Sets the compositor used by this camera. Equivalent to compositor.
void camera_set_compositor(RID camera, RID compositor)
Parameters
camera_set_cull_mask(RID, int)
Sets the cull mask associated with this camera. The cull mask describes which 3D layers are rendered by this camera. Equivalent to cull_mask.
void camera_set_cull_mask(RID camera, int layers)
Parameters
camera_set_environment(RID, RID)
Sets the environment used by this camera. Equivalent to environment.
void camera_set_environment(RID camera, RID env)
Parameters
camera_set_frustum(RID, float, Vector2, float, float)
Sets camera to use frustum projection. This mode allows adjusting the offset
argument to create "tilted frustum" effects.
void camera_set_frustum(RID camera, float size, Vector2 offset, float z_near, float z_far)
Parameters
camera_set_orthogonal(RID, float, float, float)
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.
void camera_set_orthogonal(RID camera, float size, float z_near, float z_far)
Parameters
camera_set_perspective(RID, float, float, float)
Sets camera to use perspective projection. Objects on the screen becomes smaller when they are far away.
void camera_set_perspective(RID camera, float fovy_degrees, float z_near, float z_far)
Parameters
camera_set_transform(RID, Transform3D)
Sets Transform3D of camera.
void camera_set_transform(RID camera, Transform3D transform)
Parameters
camera
RIDtransform
Transform3D
camera_set_use_vertical_aspect(RID, bool)
If true
, preserves the horizontal aspect ratio which is equivalent to Camera3D.KEEP_WIDTH. If false
, preserves the vertical aspect ratio which is equivalent to Camera3D.KEEP_HEIGHT.
void camera_set_use_vertical_aspect(RID camera, bool enable)
Parameters
canvas_create
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 canvas_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
RID canvas_create
canvas_item_add_animation_slice(RID, float, float, float, float)
Subsequent drawing commands will be ignored unless they fall within the specified animation slice. This is a faster way to implement animations that loop on background rather than redrawing constantly.
void canvas_item_add_animation_slice(RID item, float animation_length, float slice_begin, float slice_end, float offset)
Parameters
canvas_item_add_circle(RID, Vector2, float, Color, bool)
Draws a circle on the CanvasItem pointed to by the item
RID. See also CanvasItem.draw_circle.
void canvas_item_add_circle(RID item, Vector2 pos, float radius, Color color, bool antialiased)
Parameters
canvas_item_add_clip_ignore(RID, bool)
If ignore
is true
, ignore clipping on items drawn with this canvas item until this is called again with ignore
set to false
.
void canvas_item_add_clip_ignore(RID item, bool ignore)
Parameters
canvas_item_add_lcd_texture_rect_region(RID, Rect2, RID, Rect2, Color)
See also CanvasItem.draw_lcd_texture_rect_region.
void canvas_item_add_lcd_texture_rect_region(RID item, Rect2 rect, RID texture, Rect2 src_rect, Color modulate)
Parameters
canvas_item_add_line(RID, Vector2, Vector2, Color, float, bool)
Draws a line on the CanvasItem pointed to by the item
RID. See also CanvasItem.draw_line.
void canvas_item_add_line(RID item, Vector2 from, Vector2 to, Color color, float width, bool antialiased)
Parameters
canvas_item_add_mesh(RID, RID, Transform2D, Color, RID)
Draws a mesh created with mesh_create with given transform
, modulate
color, and texture
. This is used internally by MeshInstance2D.
void canvas_item_add_mesh(RID item, RID mesh, Transform2D transform, Color modulate, RID texture)
Parameters
item
RIDmesh
RIDtransform
Transform2Dmodulate
Colortexture
RID
canvas_item_add_msdf_texture_rect_region(RID, Rect2, RID, Rect2, Color, int, float, float)
See also CanvasItem.draw_msdf_texture_rect_region.
void canvas_item_add_msdf_texture_rect_region(RID item, Rect2 rect, RID texture, Rect2 src_rect, Color modulate, int outline_size, float px_range, float scale)
Parameters
item
RIDrect
Rect2texture
RIDsrc_rect
Rect2modulate
Coloroutline_size
intpx_range
floatscale
float
canvas_item_add_multiline(RID, PackedVector2Array, PackedColorArray, float, bool)
Draws a 2D multiline on the CanvasItem pointed to by the item
RID. See also CanvasItem.draw_multiline and CanvasItem.draw_multiline_colors.
void canvas_item_add_multiline(RID item, PackedVector2Array points, PackedColorArray colors, float width, bool antialiased)
Parameters
item
RIDpoints
PackedVector2Arraycolors
PackedColorArraywidth
floatantialiased
bool
canvas_item_add_multimesh(RID, RID, RID)
Draws a 2D MultiMesh on the CanvasItem pointed to by the item
RID. See also CanvasItem.draw_multimesh.
void canvas_item_add_multimesh(RID item, RID mesh, RID texture)
Parameters
canvas_item_add_nine_patch(RID, Rect2, Rect2, RID, Vector2, Vector2, int, int, bool, Color)
Draws a nine-patch rectangle on the CanvasItem pointed to by the item
RID.
void canvas_item_add_nine_patch(RID item, Rect2 rect, Rect2 source, RID texture, Vector2 topleft, Vector2 bottomright, int x_axis_mode, int y_axis_mode, bool draw_center, Color modulate)
Parameters
item
RIDrect
Rect2source
Rect2texture
RIDtopleft
Vector2bottomright
Vector2x_axis_mode
inty_axis_mode
intdraw_center
boolmodulate
Color
canvas_item_add_particles(RID, RID, RID)
Draws particles on the CanvasItem pointed to by the item
RID.
void canvas_item_add_particles(RID item, RID particles, RID texture)
Parameters
canvas_item_add_polygon(RID, PackedVector2Array, PackedColorArray, PackedVector2Array, RID)
Draws a 2D polygon on the CanvasItem pointed to by the item
RID. If you need more flexibility (such as being able to use bones), use RenderingServer.canvas_item_add_triangle_array instead. See also CanvasItem.draw_polygon.
Note: If you frequently redraw the same polygon with a large number of vertices, consider pre-calculating the triangulation with Geometry2D.triangulate_polygon and using CanvasItem.draw_mesh, CanvasItem.draw_multimesh, or RenderingServer.canvas_item_add_triangle_array.
void canvas_item_add_polygon(RID item, PackedVector2Array points, PackedColorArray colors, PackedVector2Array uvs, RID texture)
Parameters
item
RIDpoints
PackedVector2Arraycolors
PackedColorArrayuvs
PackedVector2Arraytexture
RID
canvas_item_add_polyline(RID, PackedVector2Array, PackedColorArray, float, bool)
Draws a 2D polyline on the CanvasItem pointed to by the item
RID. See also CanvasItem.draw_polyline and CanvasItem.draw_polyline_colors.
void canvas_item_add_polyline(RID item, PackedVector2Array points, PackedColorArray colors, float width, bool antialiased)
Parameters
item
RIDpoints
PackedVector2Arraycolors
PackedColorArraywidth
floatantialiased
bool
canvas_item_add_primitive(RID, PackedVector2Array, PackedColorArray, PackedVector2Array, RID)
Draws a 2D primitive on the CanvasItem pointed to by the item
RID. See also CanvasItem.draw_primitive.
void canvas_item_add_primitive(RID item, PackedVector2Array points, PackedColorArray colors, PackedVector2Array uvs, RID texture)
Parameters
item
RIDpoints
PackedVector2Arraycolors
PackedColorArrayuvs
PackedVector2Arraytexture
RID
canvas_item_add_rect(RID, Rect2, Color, bool)
Draws a rectangle on the CanvasItem pointed to by the item
RID. See also CanvasItem.draw_rect.
void canvas_item_add_rect(RID item, Rect2 rect, Color color, bool antialiased)
Parameters
canvas_item_add_set_transform(RID, Transform2D)
Sets a Transform2D that will be used to transform subsequent canvas item commands.
void canvas_item_add_set_transform(RID item, Transform2D transform)
Parameters
item
RIDtransform
Transform2D
canvas_item_add_texture_rect(RID, Rect2, RID, bool, Color, bool)
Draws a 2D textured rectangle on the CanvasItem pointed to by the item
RID. See also CanvasItem.draw_texture_rect and Texture2D.draw_rect.
void canvas_item_add_texture_rect(RID item, Rect2 rect, RID texture, bool tile, Color modulate, bool transpose)
Parameters
canvas_item_add_texture_rect_region(RID, Rect2, RID, Rect2, Color, bool, bool)
Draws the specified region of a 2D textured rectangle on the CanvasItem pointed to by the item
RID. See also CanvasItem.draw_texture_rect_region and Texture2D.draw_rect_region.
void canvas_item_add_texture_rect_region(RID item, Rect2 rect, RID texture, Rect2 src_rect, Color modulate, bool transpose, bool clip_uv)
Parameters
canvas_item_add_triangle_array(RID, PackedInt32Array, PackedVector2Array, PackedColorArray, PackedVector2Array, PackedInt32Array, PackedFloat32Array, RID, int)
Draws a triangle array on the CanvasItem pointed to by the item
RID. This is internally used by Line2D and StyleBoxFlat for rendering. RenderingServer.canvas_item_add_triangle_array is highly flexible, but more complex to use than RenderingServer.canvas_item_add_polygon.
Note: count
is unused and can be left unspecified.
void canvas_item_add_triangle_array(RID item, PackedInt32Array indices, PackedVector2Array points, PackedColorArray colors, PackedVector2Array uvs, PackedInt32Array bones, PackedFloat32Array weights, RID texture, int count)
Parameters
item
RIDindices
PackedInt32Arraypoints
PackedVector2Arraycolors
PackedColorArrayuvs
PackedVector2Arraybones
PackedInt32Arrayweights
PackedFloat32Arraytexture
RIDcount
int
canvas_item_attach_skeleton(RID, RID)
Attaches a skeleton to the CanvasItem. Removes the previous skeleton.
void canvas_item_attach_skeleton(RID item, RID skeleton)
Parameters
canvas_item_clear(RID)
Clears the CanvasItem and removes all commands in it.
void canvas_item_clear(RID item)
Parameters
item
RID
canvas_item_create
Creates a new CanvasItem instance and returns its RID. It can be accessed with the RID that is returned. This RID will be used in all canvas_item_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent node is CanvasItem.
RID canvas_item_create
canvas_item_get_instance_shader_parameter(RID, StringName)
Qualifiers: const
Returns the value of the per-instance shader uniform from the specified canvas item instance. Equivalent to CanvasItem.get_instance_shader_parameter.
Variant canvas_item_get_instance_shader_parameter(RID instance, StringName parameter)
Parameters
instance
RIDparameter
StringName
canvas_item_get_instance_shader_parameter_default_value(RID, StringName)
Qualifiers: const
Returns the default value of the per-instance shader uniform from the specified canvas item instance. Equivalent to CanvasItem.get_instance_shader_parameter.
Variant canvas_item_get_instance_shader_parameter_default_value(RID instance, StringName parameter)
Parameters
instance
RIDparameter
StringName
canvas_item_get_instance_shader_parameter_list(RID)
Qualifiers: const
Returns a dictionary of per-instance shader uniform names of the per-instance shader uniform from the specified canvas item instance.
The returned dictionary is in PropertyInfo format, with the keys name
, class_name
, type
, hint
, hint_string
, and usage
.
Dictionary[] canvas_item_get_instance_shader_parameter_list(RID instance)
Parameters
instance
RID
canvas_item_reset_physics_interpolation(RID)
Prevents physics interpolation for the current physics tick.
This is useful when moving a canvas item to a new location, to give an instantaneous change rather than interpolation from the previous location.
void canvas_item_reset_physics_interpolation(RID item)
Parameters
item
RID
canvas_item_set_canvas_group_mode(RID, int, float, bool, float, bool)
Sets the canvas group mode used during 2D rendering for the canvas item specified by the item
RID. For faster but more limited clipping, use RenderingServer.canvas_item_set_clip instead.
Note: The equivalent node functionality is found in CanvasGroup and clip_children.
void canvas_item_set_canvas_group_mode(RID item, int mode, float clear_margin, bool fit_empty, float fit_margin, bool blur_mipmaps)
Parameters
canvas_item_set_clip(RID, bool)
If clip
is true
, makes the canvas item specified by the item
RID not draw anything outside of its rect's coordinates. This clipping is fast, but works only with axis-aligned rectangles. This means that rotation is ignored by the clipping rectangle. For more advanced clipping shapes, use RenderingServer.canvas_item_set_canvas_group_mode instead.
Note: The equivalent node functionality is found in clip_text, RichTextLabel (always enabled) and more.
void canvas_item_set_clip(RID item, bool clip)
Parameters
canvas_item_set_copy_to_backbuffer(RID, bool, Rect2)
Sets the CanvasItem to copy a rect to the backbuffer.
void canvas_item_set_copy_to_backbuffer(RID item, bool enabled, Rect2 rect)
Parameters
canvas_item_set_custom_rect(RID, bool, Rect2)
If use_custom_rect
is true
, sets the custom visibility rectangle (used for culling) to rect
for the canvas item specified by item
. Setting a custom visibility rect can reduce CPU load when drawing lots of 2D instances. If use_custom_rect
is false
, automatically computes a visibility rectangle based on the canvas item's draw commands.
void canvas_item_set_custom_rect(RID item, bool use_custom_rect, Rect2 rect)
Parameters
canvas_item_set_default_texture_filter(RID, int)
Sets the default texture filter mode for the canvas item specified by the item
RID. Equivalent to texture_filter.
void canvas_item_set_default_texture_filter(RID item, int filter)
Parameters
canvas_item_set_default_texture_repeat(RID, int)
Sets the default texture repeat mode for the canvas item specified by the item
RID. Equivalent to texture_repeat.
void canvas_item_set_default_texture_repeat(RID item, int repeat)
Parameters
canvas_item_set_distance_field_mode(RID, bool)
If enabled
is true
, enables multichannel signed distance field rendering mode for the canvas item specified by the item
RID. This is meant to be used for font rendering, or with specially generated images using msdfgen.
void canvas_item_set_distance_field_mode(RID item, bool enabled)
Parameters
canvas_item_set_draw_behind_parent(RID, bool)
If enabled
is true
, draws the canvas item specified by the item
RID behind its parent. Equivalent to show_behind_parent.
void canvas_item_set_draw_behind_parent(RID item, bool enabled)
Parameters
canvas_item_set_draw_index(RID, int)
Sets the index for the CanvasItem.
void canvas_item_set_draw_index(RID item, int index)
Parameters
canvas_item_set_instance_shader_parameter(RID, StringName, Variant)
Sets the per-instance shader uniform on the specified canvas item instance. Equivalent to CanvasItem.set_instance_shader_parameter.
void canvas_item_set_instance_shader_parameter(RID instance, StringName parameter, Variant value)
Parameters
instance
RIDparameter
StringNamevalue
Variant
canvas_item_set_interpolated(RID, bool)
If interpolated
is true
, turns on physics interpolation for the canvas item.
void canvas_item_set_interpolated(RID item, bool interpolated)
Parameters
canvas_item_set_light_mask(RID, int)
Sets the light mask
for the canvas item specified by the item
RID. Equivalent to light_mask.
void canvas_item_set_light_mask(RID item, int mask)
Parameters
canvas_item_set_material(RID, RID)
Sets a new material
to the canvas item specified by the item
RID. Equivalent to material.
void canvas_item_set_material(RID item, RID material)
Parameters
canvas_item_set_modulate(RID, Color)
Multiplies the color of the canvas item specified by the item
RID, while affecting its children. See also RenderingServer.canvas_item_set_self_modulate. Equivalent to modulate.
void canvas_item_set_modulate(RID item, Color color)
Parameters
canvas_item_set_parent(RID, RID)
Sets a parent CanvasItem to the CanvasItem. The item will inherit transform, modulation and visibility from its parent, like CanvasItem nodes in the scene tree.
void canvas_item_set_parent(RID item, RID parent)
Parameters
canvas_item_set_self_modulate(RID, Color)
Multiplies the color of the canvas item specified by the item
RID, without affecting its children. See also RenderingServer.canvas_item_set_modulate. Equivalent to self_modulate.
void canvas_item_set_self_modulate(RID item, Color color)
Parameters
canvas_item_set_sort_children_by_y(RID, bool)
If enabled
is true
, child nodes with the lowest Y position are drawn before those with a higher Y position. Y-sorting only affects children that inherit from the canvas item specified by the item
RID, not the canvas item itself. Equivalent to y_sort_enabled.
void canvas_item_set_sort_children_by_y(RID item, bool enabled)
Parameters
canvas_item_set_transform(RID, Transform2D)
Sets the transform
of the canvas item specified by the item
RID. This affects where and how the item will be drawn. Child canvas items' transforms are multiplied by their parent's transform. Equivalent to transform.
void canvas_item_set_transform(RID item, Transform2D transform)
Parameters
item
RIDtransform
Transform2D
canvas_item_set_use_parent_material(RID, bool)
Sets if the CanvasItem uses its parent's material.
void canvas_item_set_use_parent_material(RID item, bool enabled)
Parameters
canvas_item_set_visibility_layer(RID, int)
Sets the rendering visibility layer associated with this CanvasItem. Only Viewport nodes with a matching rendering mask will render this CanvasItem.
void canvas_item_set_visibility_layer(RID item, int visibility_layer)
Parameters
canvas_item_set_visibility_notifier(RID, bool, Rect2, Callable, Callable)
Sets the given CanvasItem as visibility notifier. area
defines the area of detecting visibility. enter_callable
is called when the CanvasItem enters the screen, exit_callable
is called when the CanvasItem exits the screen. If enable
is false
, the item will no longer function as notifier.
This method can be used to manually mimic VisibleOnScreenNotifier2D.
void canvas_item_set_visibility_notifier(RID item, bool enable, Rect2 area, Callable enter_callable, Callable exit_callable)
Parameters
canvas_item_set_visible(RID, bool)
Sets the visibility of the CanvasItem.
void canvas_item_set_visible(RID item, bool visible)
Parameters
canvas_item_set_z_as_relative_to_parent(RID, bool)
If this is enabled, the Z index of the parent will be added to the children's Z index.
void canvas_item_set_z_as_relative_to_parent(RID item, bool enabled)
Parameters
canvas_item_set_z_index(RID, int)
Sets the CanvasItem's Z index, i.e. its draw order (lower indexes are drawn first).
void canvas_item_set_z_index(RID item, int z_index)
Parameters
canvas_item_transform_physics_interpolation(RID, Transform2D)
Transforms both the current and previous stored transform for a canvas item.
This allows transforming a canvas item without creating a "glitch" in the interpolation, which is particularly useful for large worlds utilizing a shifting origin.
void canvas_item_transform_physics_interpolation(RID item, Transform2D transform)
Parameters
item
RIDtransform
Transform2D
canvas_light_attach_to_canvas(RID, RID)
Attaches the canvas light to the canvas. Removes it from its previous canvas.
void canvas_light_attach_to_canvas(RID light, RID canvas)
Parameters
canvas_light_create
Creates a canvas light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_light_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent node is Light2D.
RID canvas_light_create
canvas_light_occluder_attach_to_canvas(RID, RID)
Attaches a light occluder to the canvas. Removes it from its previous canvas.
void canvas_light_occluder_attach_to_canvas(RID occluder, RID canvas)
Parameters
canvas_light_occluder_create
Creates a light occluder and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_light_occluder_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent node is LightOccluder2D.
RID canvas_light_occluder_create
canvas_light_occluder_reset_physics_interpolation(RID)
Prevents physics interpolation for the current physics tick.
This is useful when moving an occluder to a new location, to give an instantaneous change rather than interpolation from the previous location.
void canvas_light_occluder_reset_physics_interpolation(RID occluder)
Parameters
occluder
RID
canvas_light_occluder_set_as_sdf_collision(RID, bool)
void canvas_light_occluder_set_as_sdf_collision(RID occluder, bool enable)
Parameters
canvas_light_occluder_set_enabled(RID, bool)
Enables or disables light occluder.
void canvas_light_occluder_set_enabled(RID occluder, bool enabled)
Parameters
canvas_light_occluder_set_interpolated(RID, bool)
If interpolated
is true
, turns on physics interpolation for the light occluder.
void canvas_light_occluder_set_interpolated(RID occluder, bool interpolated)
Parameters
canvas_light_occluder_set_light_mask(RID, int)
The light mask. See LightOccluder2D for more information on light masks.
void canvas_light_occluder_set_light_mask(RID occluder, int mask)
Parameters
canvas_light_occluder_set_polygon(RID, RID)
Sets a light occluder's polygon.
void canvas_light_occluder_set_polygon(RID occluder, RID polygon)
Parameters
canvas_light_occluder_set_transform(RID, Transform2D)
Sets a light occluder's Transform2D.
void canvas_light_occluder_set_transform(RID occluder, Transform2D transform)
Parameters
occluder
RIDtransform
Transform2D
canvas_light_occluder_transform_physics_interpolation(RID, Transform2D)
Transforms both the current and previous stored transform for a light occluder.
This allows transforming an occluder without creating a "glitch" in the interpolation, which is particularly useful for large worlds utilizing a shifting origin.
void canvas_light_occluder_transform_physics_interpolation(RID occluder, Transform2D transform)
Parameters
occluder
RIDtransform
Transform2D
canvas_light_reset_physics_interpolation(RID)
Prevents physics interpolation for the current physics tick.
This is useful when moving a canvas item to a new location, to give an instantaneous change rather than interpolation from the previous location.
void canvas_light_reset_physics_interpolation(RID light)
Parameters
light
RID
canvas_light_set_blend_mode(RID, int)
Sets the blend mode for the given canvas light. See CanvasLightBlendMode for options. Equivalent to blend_mode.
void canvas_light_set_blend_mode(RID light, int mode)
Parameters
canvas_light_set_color(RID, Color)
Sets the color for a light.
void canvas_light_set_color(RID light, Color color)
Parameters
canvas_light_set_enabled(RID, bool)
Enables or disables a canvas light.
void canvas_light_set_enabled(RID light, bool enabled)
Parameters
canvas_light_set_energy(RID, float)
Sets a canvas light's energy.
void canvas_light_set_energy(RID light, float energy)
Parameters
canvas_light_set_height(RID, float)
Sets a canvas light's height.
void canvas_light_set_height(RID light, float height)
Parameters
canvas_light_set_interpolated(RID, bool)
If interpolated
is true
, turns on physics interpolation for the canvas light.
void canvas_light_set_interpolated(RID light, bool interpolated)
Parameters
canvas_light_set_item_cull_mask(RID, int)
The light mask. See LightOccluder2D for more information on light masks.
void canvas_light_set_item_cull_mask(RID light, int mask)
Parameters
canvas_light_set_item_shadow_cull_mask(RID, int)
The binary mask used to determine which layers this canvas light's shadows affects. See LightOccluder2D for more information on light masks.
void canvas_light_set_item_shadow_cull_mask(RID light, int mask)
Parameters
canvas_light_set_layer_range(RID, int, int)
The layer range that gets rendered with this light.
void canvas_light_set_layer_range(RID light, int min_layer, int max_layer)
Parameters
canvas_light_set_mode(RID, int)
The mode of the light, see CanvasLightMode constants.
void canvas_light_set_mode(RID light, int mode)
Parameters
canvas_light_set_shadow_color(RID, Color)
Sets the color of the canvas light's shadow.
void canvas_light_set_shadow_color(RID light, Color color)
Parameters
canvas_light_set_shadow_enabled(RID, bool)
Enables or disables the canvas light's shadow.
void canvas_light_set_shadow_enabled(RID light, bool enabled)
Parameters
canvas_light_set_shadow_filter(RID, int)
Sets the canvas light's shadow's filter, see CanvasLightShadowFilter constants.
void canvas_light_set_shadow_filter(RID light, int filter)
Parameters
canvas_light_set_shadow_smooth(RID, float)
Smoothens the shadow. The lower, the smoother.
void canvas_light_set_shadow_smooth(RID light, float smooth)
Parameters
canvas_light_set_texture(RID, RID)
Sets the texture to be used by a PointLight2D. Equivalent to texture.
void canvas_light_set_texture(RID light, RID texture)
Parameters
canvas_light_set_texture_offset(RID, Vector2)
Sets the offset of a PointLight2D's texture. Equivalent to offset.
void canvas_light_set_texture_offset(RID light, Vector2 offset)
Parameters
canvas_light_set_texture_scale(RID, float)
Sets the scale factor of a PointLight2D's texture. Equivalent to texture_scale.
void canvas_light_set_texture_scale(RID light, float scale)
Parameters
canvas_light_set_transform(RID, Transform2D)
Sets the canvas light's Transform2D.
void canvas_light_set_transform(RID light, Transform2D transform)
Parameters
light
RIDtransform
Transform2D
canvas_light_set_z_range(RID, int, int)
Sets the Z range of objects that will be affected by this light. Equivalent to range_z_min and range_z_max.
void canvas_light_set_z_range(RID light, int min_z, int max_z)
Parameters
canvas_light_transform_physics_interpolation(RID, Transform2D)
Transforms both the current and previous stored transform for a canvas light.
This allows transforming a light without creating a "glitch" in the interpolation, which is particularly useful for large worlds utilizing a shifting origin.
void canvas_light_transform_physics_interpolation(RID light, Transform2D transform)
Parameters
light
RIDtransform
Transform2D
canvas_occluder_polygon_create
Creates a new light occluder polygon and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_occluder_polygon_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent resource is OccluderPolygon2D.
RID canvas_occluder_polygon_create
canvas_occluder_polygon_set_cull_mode(RID, int)
Sets an occluder polygons cull mode. See CanvasOccluderPolygonCullMode constants.
void canvas_occluder_polygon_set_cull_mode(RID occluder_polygon, int mode)
Parameters
canvas_occluder_polygon_set_shape(RID, PackedVector2Array, bool)
Sets the shape of the occluder polygon.
void canvas_occluder_polygon_set_shape(RID occluder_polygon, PackedVector2Array shape, bool closed)
Parameters
occluder_polygon
RIDshape
PackedVector2Arrayclosed
bool
canvas_set_disable_scale(bool)
void canvas_set_disable_scale(bool disable)
Parameters
disable
bool
canvas_set_item_mirroring(RID, RID, Vector2)
A copy of the canvas item will be drawn with a local offset of the mirroring
.
Note: This is equivalent to calling RenderingServer.canvas_set_item_repeat like canvas_set_item_repeat(item, mirroring, 1)
, with an additional check ensuring canvas
is a parent of item
.
void canvas_set_item_mirroring(RID canvas, RID item, Vector2 mirroring)
Parameters
canvas_set_item_repeat(RID, Vector2, int)
A copy of the canvas item will be drawn with a local offset of the repeat_size
by the number of times of the repeat_times
. As the repeat_times
increases, the copies will spread away from the origin texture.
void canvas_set_item_repeat(RID item, Vector2 repeat_size, int repeat_times)
Parameters
canvas_set_modulate(RID, Color)
Modulates all colors in the given canvas.
void canvas_set_modulate(RID canvas, Color color)
Parameters
canvas_set_shadow_texture_size(int)
Sets the rendering/2d/shadow_atlas/size to use for Light2D shadow rendering (in pixels). The value is rounded up to the nearest power of 2.
void canvas_set_shadow_texture_size(int size)
Parameters
size
int
canvas_texture_create
Creates a canvas texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_texture_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method. See also RenderingServer.texture_2d_create.
Note: The equivalent resource is CanvasTexture and is only meant to be used in 2D rendering, not 3D.
RID canvas_texture_create
canvas_texture_set_channel(RID, int, RID)
Sets the channel
's texture
for the canvas texture specified by the canvas_texture
RID. Equivalent to diffuse_texture, normal_texture and specular_texture.
void canvas_texture_set_channel(RID canvas_texture, int channel, RID texture)
Parameters
canvas_texture_set_shading_parameters(RID, Color, float)
Sets the base_color
and shininess
to use for the canvas texture specified by the canvas_texture
RID. Equivalent to specular_color and specular_shininess.
void canvas_texture_set_shading_parameters(RID canvas_texture, Color base_color, float shininess)
Parameters
canvas_texture_set_texture_filter(RID, int)
Sets the texture filter
mode to use for the canvas texture specified by the canvas_texture
RID.
void canvas_texture_set_texture_filter(RID canvas_texture, int filter)
Parameters
canvas_texture_set_texture_repeat(RID, int)
Sets the texture repeat
mode to use for the canvas texture specified by the canvas_texture
RID.
void canvas_texture_set_texture_repeat(RID canvas_texture, int repeat)
Parameters
compositor_create
Creates a new compositor and adds it to the RenderingServer. It can be accessed with the RID that is returned.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
RID compositor_create
compositor_effect_create
Creates a new rendering effect and adds it to the RenderingServer. It can be accessed with the RID that is returned.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
RID compositor_effect_create
compositor_effect_set_callback(RID, int, Callable)
Sets the callback type (callback_type
) and callback method(callback
) for this rendering effect.
void compositor_effect_set_callback(RID effect, int callback_type, Callable callback)
Parameters
compositor_effect_set_enabled(RID, bool)
Enables/disables this rendering effect.
void compositor_effect_set_enabled(RID effect, bool enabled)
Parameters
compositor_effect_set_flag(RID, int, bool)
Sets the flag (flag
) for this rendering effect to true
or false
(set
).
void compositor_effect_set_flag(RID effect, int flag, bool set)
Parameters
compositor_set_compositor_effects(RID, RID[])
Sets the compositor effects for the specified compositor RID. effects
should be an array containing RIDs created with compositor_effect_create.
void compositor_set_compositor_effects(RID compositor, RID[] effects)
Parameters
compositor
RIDeffects
RID[]
create_local_rendering_device
Qualifiers: const
Creates a RenderingDevice that can be used to do draw and compute operations on a separate thread. Cannot draw to the screen nor share data with the global RenderingDevice.
Note: When using the OpenGL rendering driver or when running in headless mode, this function always returns null
.
RenderingDevice create_local_rendering_device
debug_canvas_item_get_rect(RID)
Returns the bounding rectangle for a canvas item in local space, as calculated by the renderer. This bound is used internally for culling.
Warning: This function is intended for debugging in the editor, and will pass through and return a zero Rect2 in exported projects.
Rect2 debug_canvas_item_get_rect(RID item)
Parameters
item
RID
decal_create
Creates a decal and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all decal_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
To place in a scene, attach this decal to an instance using RenderingServer.instance_set_base using the returned RID.
Note: The equivalent node is Decal.
RID decal_create
decal_set_albedo_mix(RID, float)
Sets the albedo_mix
in the decal specified by the decal
RID. Equivalent to albedo_mix.
void decal_set_albedo_mix(RID decal, float albedo_mix)
Parameters
decal_set_cull_mask(RID, int)
Sets the cull mask
in the decal specified by the decal
RID. Equivalent to cull_mask.
void decal_set_cull_mask(RID decal, int mask)
Parameters
decal_set_distance_fade(RID, bool, float, float)
Sets the distance fade parameters in the decal specified by the decal
RID. Equivalent to distance_fade_enabled, distance_fade_begin and distance_fade_length.
void decal_set_distance_fade(RID decal, bool enabled, float begin, float length)
Parameters
decal_set_emission_energy(RID, float)
Sets the emission energy
in the decal specified by the decal
RID. Equivalent to emission_energy.
void decal_set_emission_energy(RID decal, float energy)
Parameters
decal_set_fade(RID, float, float)
Sets the upper fade (above
) and lower fade (below
) in the decal specified by the decal
RID. Equivalent to upper_fade and lower_fade.
void decal_set_fade(RID decal, float above, float below)
Parameters
decal_set_modulate(RID, Color)
Sets the color multiplier in the decal specified by the decal
RID to color
. Equivalent to modulate.
void decal_set_modulate(RID decal, Color color)
Parameters
decal_set_normal_fade(RID, float)
Sets the normal fade
in the decal specified by the decal
RID. Equivalent to normal_fade.
void decal_set_normal_fade(RID decal, float fade)
Parameters
decal_set_size(RID, Vector3)
Sets the size
of the decal specified by the decal
RID. Equivalent to size.
void decal_set_size(RID decal, Vector3 size)
Parameters
decal_set_texture(RID, int, RID)
Sets the texture
in the given texture type
slot for the specified decal. Equivalent to Decal.set_texture.
void decal_set_texture(RID decal, int type, RID texture)
Parameters
decals_set_filter(int)
Sets the texture filter
mode to use when rendering decals. This parameter is global and cannot be set on a per-decal basis.
void decals_set_filter(int filter)
Parameters
filter
int
directional_light_create
Creates a directional light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most light_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
To place in a scene, attach this directional light to an instance using RenderingServer.instance_set_base using the returned RID.
Note: The equivalent node is DirectionalLight3D.
RID directional_light_create
directional_shadow_atlas_set_size(int, bool)
Sets the size
of the directional light shadows in 3D. See also rendering/lights_and_shadows/directional_shadow/size. This parameter is global and cannot be set on a per-viewport basis.
void directional_shadow_atlas_set_size(int size, bool is_16bits)
Parameters
directional_soft_shadow_filter_set_quality(int)
Sets the filter quality
for directional light shadows in 3D. See also rendering/lights_and_shadows/directional_shadow/soft_shadow_filter_quality. This parameter is global and cannot be set on a per-viewport basis.
void directional_soft_shadow_filter_set_quality(int quality)
Parameters
quality
int
environment_bake_panorama(RID, bool, Vector2i)
Generates and returns an Image containing the radiance map for the specified environment
RID's sky. This supports built-in sky material and custom sky shaders. If bake_irradiance
is true
, the irradiance map is saved instead of the radiance map. The radiance map is used to render reflected light, while the irradiance map is used to render ambient light. See also RenderingServer.sky_bake_panorama.
Note: The image is saved in linear color space without any tonemapping performed, which means it will look too dark if viewed directly in an image editor.
Note: size
should be a 2:1 aspect ratio for the generated panorama to have square pixels. For radiance maps, there is no point in using a height greater than radiance_size, as it won't increase detail. Irradiance maps only contain low-frequency data, so there is usually no point in going past a size of 128×64 pixels when saving an irradiance map.
Image environment_bake_panorama(RID environment, bool bake_irradiance, Vector2i size)
Parameters
environment_create
Creates an environment and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all environment_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent resource is Environment.
RID environment_create
environment_glow_set_use_bicubic_upscale(bool)
If enable
is true
, enables bicubic upscaling for glow which improves quality at the cost of performance. Equivalent to rendering/environment/glow/upscale_mode.
void environment_glow_set_use_bicubic_upscale(bool enable)
Parameters
enable
bool
environment_set_adjustment(RID, bool, float, float, float, bool, RID)
Sets the values to be used with the "adjustments" post-process effect. See Environment for more details.
void environment_set_adjustment(RID env, bool enable, float brightness, float contrast, float saturation, bool use_1d_color_correction, RID color_correction)
Parameters
env
RIDenable
boolbrightness
floatcontrast
floatsaturation
floatuse_1d_color_correction
boolcolor_correction
RID
environment_set_ambient_light(RID, Color, int, float, float, int)
Sets the values to be used for ambient light rendering. See Environment for more details.
void environment_set_ambient_light(RID env, Color color, int ambient, float energy, float sky_contribution, int reflection_source)
Parameters
environment_set_background(RID, int)
Sets the environment's background mode. Equivalent to background_mode.
void environment_set_background(RID env, int bg)
Parameters
environment_set_bg_color(RID, Color)
Color displayed for clear areas of the scene. Only effective if using the RenderingServer.ENV_BG_COLOR background mode.
void environment_set_bg_color(RID env, Color color)
Parameters
environment_set_bg_energy(RID, float, float)
Sets the intensity of the background color.
void environment_set_bg_energy(RID env, float multiplier, float exposure_value)
Parameters
environment_set_camera_id(RID, int)
Sets the camera ID to be used as environment background.
void environment_set_camera_id(RID env, int id)
Parameters
environment_set_canvas_max_layer(RID, int)
Sets the maximum layer to use if using Canvas background mode.
void environment_set_canvas_max_layer(RID env, int max_layer)
Parameters
environment_set_fog(RID, bool, Color, float, float, float, float, float, float, float, int)
Configures fog for the specified environment RID. See fog_*
properties in Environment for more information.
void environment_set_fog(RID env, bool enable, Color light_color, float light_energy, float sun_scatter, float density, float height, float height_density, float aerial_perspective, float sky_affect, int fog_mode)
Parameters
env
RIDenable
boollight_color
Colorlight_energy
floatsun_scatter
floatdensity
floatheight
floatheight_density
floataerial_perspective
floatsky_affect
floatfog_mode
int
environment_set_glow(RID, bool, PackedFloat32Array, float, float, float, float, int, float, float, float, float, RID)
Configures glow for the specified environment RID. See glow_*
properties in Environment for more information.
void environment_set_glow(RID env, bool enable, PackedFloat32Array levels, float intensity, float strength, float mix, float bloom_threshold, int blend_mode, float hdr_bleed_threshold, float hdr_bleed_scale, float hdr_luminance_cap, float glow_map_strength, RID glow_map)
Parameters
env
RIDenable
boollevels
PackedFloat32Arrayintensity
floatstrength
floatmix
floatbloom_threshold
floatblend_mode
inthdr_bleed_threshold
floathdr_bleed_scale
floathdr_luminance_cap
floatglow_map_strength
floatglow_map
RID
environment_set_sdfgi(RID, bool, int, float, int, bool, float, bool, float, float, float)
Configures signed distance field global illumination for the specified environment RID. See sdfgi_*
properties in Environment for more information.
void environment_set_sdfgi(RID env, bool enable, int cascades, float min_cell_size, int y_scale, bool use_occlusion, float bounce_feedback, bool read_sky, float energy, float normal_bias, float probe_bias)
Parameters
env
RIDenable
boolcascades
intmin_cell_size
floaty_scale
intuse_occlusion
boolbounce_feedback
floatread_sky
boolenergy
floatnormal_bias
floatprobe_bias
float
environment_set_sdfgi_frames_to_converge(int)
Sets the number of frames to use for converging signed distance field global illumination. Equivalent to rendering/global_illumination/sdfgi/frames_to_converge.
void environment_set_sdfgi_frames_to_converge(int frames)
Parameters
frames
int
environment_set_sdfgi_frames_to_update_light(int)
Sets the update speed for dynamic lights' indirect lighting when computing signed distance field global illumination. Equivalent to rendering/global_illumination/sdfgi/frames_to_update_lights.
void environment_set_sdfgi_frames_to_update_light(int frames)
Parameters
frames
int
environment_set_sdfgi_ray_count(int)
Sets the number of rays to throw per frame when computing signed distance field global illumination. Equivalent to rendering/global_illumination/sdfgi/probe_ray_count.
void environment_set_sdfgi_ray_count(int ray_count)
Parameters
ray_count
int
environment_set_sky(RID, RID)
void environment_set_sky(RID env, RID sky)
Parameters
environment_set_sky_custom_fov(RID, float)
Sets a custom field of view for the background Sky. Equivalent to sky_custom_fov.
void environment_set_sky_custom_fov(RID env, float scale)
Parameters
environment_set_sky_orientation(RID, Basis)
Sets the rotation of the background Sky expressed as a Basis. Equivalent to sky_rotation, where the rotation vector is used to construct the Basis.
void environment_set_sky_orientation(RID env, Basis orientation)
Parameters
environment_set_ssao(RID, bool, float, float, float, float, float, float, float, float)
Sets the variables to be used with the screen-space ambient occlusion (SSAO) post-process effect. See Environment for more details.
void environment_set_ssao(RID env, bool enable, float radius, float intensity, float power, float detail, float horizon, float sharpness, float light_affect, float ao_channel_affect)
Parameters
env
RIDenable
boolradius
floatintensity
floatpower
floatdetail
floathorizon
floatsharpness
floatlight_affect
floatao_channel_affect
float
environment_set_ssao_quality(int, bool, float, int, float, float)
Sets the quality level of the screen-space ambient occlusion (SSAO) post-process effect. See Environment for more details.
void environment_set_ssao_quality(int quality, bool half_size, float adaptive_target, int blur_passes, float fadeout_from, float fadeout_to)
Parameters
quality
inthalf_size
booladaptive_target
floatblur_passes
intfadeout_from
floatfadeout_to
float
environment_set_ssil_quality(int, bool, float, int, float, float)
Sets the quality level of the screen-space indirect lighting (SSIL) post-process effect. See Environment for more details.
void environment_set_ssil_quality(int quality, bool half_size, float adaptive_target, int blur_passes, float fadeout_from, float fadeout_to)
Parameters
quality
inthalf_size
booladaptive_target
floatblur_passes
intfadeout_from
floatfadeout_to
float
environment_set_ssr(RID, bool, int, float, float, float)
Sets the variables to be used with the screen-space reflections (SSR) post-process effect. See Environment for more details.
void environment_set_ssr(RID env, bool enable, int max_steps, float fade_in, float fade_out, float depth_tolerance)
Parameters
environment_set_ssr_roughness_quality(int)
void environment_set_ssr_roughness_quality(int quality)
Parameters
quality
int
environment_set_tonemap(RID, int, float, float)
Sets the variables to be used with the "tonemap" post-process effect. See Environment for more details.
void environment_set_tonemap(RID env, int tone_mapper, float exposure, float white)
Parameters
environment_set_volumetric_fog(RID, bool, float, Color, Color, float, float, float, float, float, bool, float, float, float)
Sets the variables to be used with the volumetric fog post-process effect. See Environment for more details.
void environment_set_volumetric_fog(RID env, bool enable, float density, Color albedo, Color emission, float emission_energy, float anisotropy, float length, float p_detail_spread, float gi_inject, bool temporal_reprojection, float temporal_reprojection_amount, float ambient_inject, float sky_affect)
Parameters
env
RIDenable
booldensity
floatalbedo
Coloremission
Coloremission_energy
floatanisotropy
floatlength
floatp_detail_spread
floatgi_inject
floattemporal_reprojection
booltemporal_reprojection_amount
floatambient_inject
floatsky_affect
float
environment_set_volumetric_fog_filter_active(bool)
Enables filtering of the volumetric fog scattering buffer. This results in much smoother volumes with very few under-sampling artifacts.
void environment_set_volumetric_fog_filter_active(bool active)
Parameters
active
bool
environment_set_volumetric_fog_volume_size(int, int)
Sets the resolution of the volumetric fog's froxel buffer. size
is modified by the screen's aspect ratio and then used to set the width and height of the buffer. While depth
is directly used to set the depth of the buffer.
void environment_set_volumetric_fog_volume_size(int size, int depth)
Parameters
fog_volume_create
Creates a new fog volume and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all fog_volume_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent node is FogVolume.
RID fog_volume_create
fog_volume_set_material(RID, RID)
Sets the Material of the fog volume. Can be either a FogMaterial or a custom ShaderMaterial.
void fog_volume_set_material(RID fog_volume, RID material)
Parameters
fog_volume_set_shape(RID, int)
Sets the shape of the fog volume to either RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID, RenderingServer.FOG_VOLUME_SHAPE_CONE, RenderingServer.FOG_VOLUME_SHAPE_CYLINDER, RenderingServer.FOG_VOLUME_SHAPE_BOX or RenderingServer.FOG_VOLUME_SHAPE_WORLD.
void fog_volume_set_shape(RID fog_volume, int shape)
Parameters
fog_volume_set_size(RID, Vector3)
Sets the size of the fog volume when shape is RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID, RenderingServer.FOG_VOLUME_SHAPE_CONE, RenderingServer.FOG_VOLUME_SHAPE_CYLINDER or RenderingServer.FOG_VOLUME_SHAPE_BOX.
void fog_volume_set_size(RID fog_volume, Vector3 size)
Parameters
force_draw(bool, float)
Forces redrawing of all viewports at once. Must be called from the main thread.
void force_draw(bool swap_buffers, float frame_step)
Parameters
force_sync
Forces a synchronization between the CPU and GPU, which may be required in certain cases. Only call this when needed, as CPU-GPU synchronization has a performance cost.
void force_sync
free_rid(RID)
Tries to free an object in the RenderingServer. To avoid memory leaks, this should be called after using an object as memory management does not occur automatically when using RenderingServer directly.
void free_rid(RID rid)
Parameters
rid
RID
get_current_rendering_driver_name
Qualifiers: const
Returns the name of the current rendering driver. This can be vulkan
, d3d12
, metal
, opengl3
, opengl3_es
, or opengl3_angle
. See also get_current_rendering_method.
The rendering driver is determined by rendering/rendering_device/driver, the --rendering-driver
command line argument that overrides this project setting, or an automatic fallback that is applied depending on the hardware.
String get_current_rendering_driver_name
get_current_rendering_method
Qualifiers: const
Returns the name of the current rendering method. This can be forward_plus
, mobile
, or gl_compatibility
. See also get_current_rendering_driver_name.
The rendering method is determined by rendering/renderer/rendering_method, the --rendering-method
command line argument that overrides this project setting, or an automatic fallback that is applied depending on the hardware.
String get_current_rendering_method
get_default_clear_color
Returns the default clear color which is used when a specific clear color has not been selected. See also RenderingServer.set_default_clear_color.
Color get_default_clear_color
get_frame_setup_time_cpu
Qualifiers: const
Returns the time taken to setup rendering on the CPU in milliseconds. This value is shared across all viewports and does not require RenderingServer.viewport_set_measure_render_time to be enabled on a viewport to be queried. See also RenderingServer.viewport_get_measured_render_time_cpu.
float get_frame_setup_time_cpu
get_rendering_device
Qualifiers: const
Returns the global RenderingDevice.
Note: When using the OpenGL rendering driver or when running in headless mode, this function always returns null
.
RenderingDevice get_rendering_device
get_rendering_info(int)
Returns a statistic about the rendering engine which can be used for performance profiling. See RenderingInfo for a list of values that can be queried. See also RenderingServer.viewport_get_render_info, which returns information specific to a viewport.
Note: Only 3D rendering is currently taken into account by some of these values, such as the number of draw calls.
Note: Rendering information is not available until at least 2 frames have been rendered by the engine. If rendering information is not available, RenderingServer.get_rendering_info returns 0
. To print rendering information in _ready()
successfully, use the following:
func _ready():
for _i in 2:
await get_tree().process_frame
print(RenderingServer.get_rendering_info(RENDERING_INFO_TOTAL_DRAW_CALLS_IN_FRAME))
int get_rendering_info(int info)
Parameters
info
int
get_shader_parameter_list(RID)
Qualifiers: const
Returns the parameters of a shader.
Dictionary[] get_shader_parameter_list(RID shader)
Parameters
shader
RID
get_test_cube
Returns the RID of the test cube. This mesh will be created and returned on the first call to get_test_cube, then it will be cached for subsequent calls. See also RenderingServer.make_sphere_mesh.
RID get_test_cube
get_test_texture
Returns the RID of a 256×256 texture with a testing pattern on it (in Image.FORMAT_RGB8 format). This texture will be created and returned on the first call to get_test_texture, then it will be cached for subsequent calls. See also get_white_texture.
Example: Get the test texture and apply it to a Sprite2D node:
var texture_rid = RenderingServer.get_test_texture()
var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid))
$Sprite2D.texture = texture
RID get_test_texture
get_video_adapter_api_version
Qualifiers: const
Returns the version of the graphics video adapter currently in use (e.g. "1.2.189" for Vulkan, "3.3.0 NVIDIA 510.60.02" for OpenGL). This version may be different from the actual latest version supported by the hardware, as Godot may not always request the latest version. See also get_video_adapter_driver_info.
Note: When running a headless or server binary, this function returns an empty string.
String get_video_adapter_api_version
get_video_adapter_name
Qualifiers: const
Returns the name of the video adapter (e.g. "GeForce GTX 1080/PCIe/SSE2").
Note: When running a headless or server binary, this function returns an empty string.
Note: On the web platform, some browsers such as Firefox may report a different, fixed GPU name such as "GeForce GTX 980" (regardless of the user's actual GPU model). This is done to make fingerprinting more difficult.
String get_video_adapter_name
get_video_adapter_type
Qualifiers: const
Returns the type of the video adapter. Since dedicated graphics cards from a given generation will usually be significantly faster than integrated graphics made in the same generation, the device type can be used as a basis for automatic graphics settings adjustment. However, this is not always true, so make sure to provide users with a way to manually override graphics settings.
Note: When using the OpenGL rendering driver or when running in headless mode, this function always returns RenderingDevice.DEVICE_TYPE_OTHER.
int get_video_adapter_type
get_video_adapter_vendor
Qualifiers: const
Returns the vendor of the video adapter (e.g. "NVIDIA Corporation").
Note: When running a headless or server binary, this function returns an empty string.
String get_video_adapter_vendor
get_white_texture
Returns the ID of a 4×4 white texture (in Image.FORMAT_RGB8 format). This texture will be created and returned on the first call to get_white_texture, then it will be cached for subsequent calls. See also get_test_texture.
Example: Get the white texture and apply it to a Sprite2D node:
var texture_rid = RenderingServer.get_white_texture()
var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid))
$Sprite2D.texture = texture
RID get_white_texture
gi_set_use_half_resolution(bool)
If half_resolution
is true
, renders VoxelGI and SDFGI (sdfgi_enabled) buffers at halved resolution on each axis (e.g. 960×540 when the viewport size is 1920×1080). This improves performance significantly when VoxelGI or SDFGI is enabled, at the cost of artifacts that may be visible on polygon edges. The loss in quality becomes less noticeable as the viewport resolution increases. LightmapGI rendering is not affected by this setting. Equivalent to rendering/global_illumination/gi/use_half_resolution.
void gi_set_use_half_resolution(bool half_resolution)
Parameters
half_resolution
bool
global_shader_parameter_add(StringName, int, Variant)
Creates a new global shader uniform.
Note: Global shader parameter names are case-sensitive.
void global_shader_parameter_add(StringName name, int type, Variant default_value)
Parameters
name
StringNametype
intdefault_value
Variant
global_shader_parameter_get(StringName)
Qualifiers: const
Returns the value of the global shader uniform specified by name
.
Note: RenderingServer.global_shader_parameter_get has a large performance penalty as the rendering thread needs to synchronize with the calling thread, which is slow. Do not use this method during gameplay to avoid stuttering. If you need to read values in a script after setting them, consider creating an autoload where you store the values you need to query at the same time you're setting them as global parameters.
Variant global_shader_parameter_get(StringName name)
Parameters
name
StringName
global_shader_parameter_get_list
Qualifiers: const
Returns the list of global shader uniform names.
Note: RenderingServer.global_shader_parameter_get has a large performance penalty as the rendering thread needs to synchronize with the calling thread, which is slow. Do not use this method during gameplay to avoid stuttering. If you need to read values in a script after setting them, consider creating an autoload where you store the values you need to query at the same time you're setting them as global parameters.
StringName[] global_shader_parameter_get_list
global_shader_parameter_get_type(StringName)
Qualifiers: const
Returns the type associated to the global shader uniform specified by name
.
Note: RenderingServer.global_shader_parameter_get has a large performance penalty as the rendering thread needs to synchronize with the calling thread, which is slow. Do not use this method during gameplay to avoid stuttering. If you need to read values in a script after setting them, consider creating an autoload where you store the values you need to query at the same time you're setting them as global parameters.
int global_shader_parameter_get_type(StringName name)
Parameters
name
StringName
global_shader_parameter_remove(StringName)
Removes the global shader uniform specified by name
.
void global_shader_parameter_remove(StringName name)
Parameters
name
StringName
global_shader_parameter_set(StringName, Variant)
Sets the global shader uniform name
to value
.
void global_shader_parameter_set(StringName name, Variant value)
Parameters
name
StringNamevalue
Variant
global_shader_parameter_set_override(StringName, Variant)
Overrides the global shader uniform name
with value
. Equivalent to the ShaderGlobalsOverride node.
void global_shader_parameter_set_override(StringName name, Variant value)
Parameters
name
StringNamevalue
Variant
has_changed
Qualifiers: const
Returns true
if changes have been made to the RenderingServer's data. RenderingServer.force_draw is usually called if this happens.
bool has_changed
has_feature(int)
Qualifiers: const
This method does nothing and always returns false
.
bool has_feature(int feature)
Parameters
feature
int
has_os_feature(String)
Qualifiers: const
Returns true
if the OS supports a certain feature
. Features might be s3tc
, etc
, and etc2
.
bool has_os_feature(String feature)
Parameters
feature
String
instance_attach_object_instance_id(RID, int)
Attaches a unique Object ID to instance. Object ID must be attached to instance for proper culling with RenderingServer.instances_cull_aabb, RenderingServer.instances_cull_convex, and RenderingServer.instances_cull_ray.
void instance_attach_object_instance_id(RID instance, int id)
Parameters
instance_attach_skeleton(RID, RID)
Attaches a skeleton to an instance. Removes the previous skeleton from the instance.
void instance_attach_skeleton(RID instance, RID skeleton)
Parameters
instance_create
Creates a visual instance and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all instance_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
An instance is a way of placing a 3D object in the scenario. Objects like particles, meshes, reflection probes and decals need to be associated with an instance to be visible in the scenario using RenderingServer.instance_set_base.
Note: The equivalent node is VisualInstance3D.
RID instance_create
instance_create2(RID, RID)
Creates a visual instance, adds it to the RenderingServer, and sets both base and scenario. It can be accessed with the RID that is returned. This RID will be used in all instance_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method. This is a shorthand for using instance_create and setting the base and scenario manually.
RID instance_create2(RID base, RID scenario)
Parameters
instance_geometry_get_shader_parameter(RID, StringName)
Qualifiers: const
Returns the value of the per-instance shader uniform from the specified 3D geometry instance. Equivalent to GeometryInstance3D.get_instance_shader_parameter.
Note: Per-instance shader parameter names are case-sensitive.
Variant instance_geometry_get_shader_parameter(RID instance, StringName parameter)
Parameters
instance
RIDparameter
StringName
instance_geometry_get_shader_parameter_default_value(RID, StringName)
Qualifiers: const
Returns the default value of the per-instance shader uniform from the specified 3D geometry instance. Equivalent to GeometryInstance3D.get_instance_shader_parameter.
Variant instance_geometry_get_shader_parameter_default_value(RID instance, StringName parameter)
Parameters
instance
RIDparameter
StringName
instance_geometry_get_shader_parameter_list(RID)
Qualifiers: const
Returns a dictionary of per-instance shader uniform names of the per-instance shader uniform from the specified 3D geometry instance. The returned dictionary is in PropertyInfo format, with the keys name
, class_name
, type
, hint
, hint_string
and usage
. Equivalent to GeometryInstance3D.get_instance_shader_parameter.
Dictionary[] instance_geometry_get_shader_parameter_list(RID instance)
Parameters
instance
RID
instance_geometry_set_cast_shadows_setting(RID, int)
Sets the shadow casting setting to one of ShadowCastingSetting. Equivalent to cast_shadow.
void instance_geometry_set_cast_shadows_setting(RID instance, int shadow_casting_setting)
Parameters
instance_geometry_set_flag(RID, int, bool)
Sets the flag for a given InstanceFlags. See InstanceFlags for more details.
void instance_geometry_set_flag(RID instance, int flag, bool enabled)
Parameters
instance_geometry_set_lightmap(RID, RID, Rect2, int)
Sets the lightmap GI instance to use for the specified 3D geometry instance. The lightmap UV scale for the specified instance (equivalent to gi_lightmap_scale) and lightmap atlas slice must also be specified.
void instance_geometry_set_lightmap(RID instance, RID lightmap, Rect2 lightmap_uv_scale, int lightmap_slice)
Parameters
instance_geometry_set_lod_bias(RID, float)
Sets the level of detail bias to use when rendering the specified 3D geometry instance. Higher values result in higher detail from further away. Equivalent to lod_bias.
void instance_geometry_set_lod_bias(RID instance, float lod_bias)
Parameters
instance_geometry_set_material_overlay(RID, RID)
Sets a material that will be rendered for all surfaces on top of active materials for the mesh associated with this instance. Equivalent to material_overlay.
void instance_geometry_set_material_overlay(RID instance, RID material)
Parameters
instance_geometry_set_material_override(RID, RID)
Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to material_override.
void instance_geometry_set_material_override(RID instance, RID material)
Parameters
instance_geometry_set_shader_parameter(RID, StringName, Variant)
Sets the per-instance shader uniform on the specified 3D geometry instance. Equivalent to GeometryInstance3D.set_instance_shader_parameter.
void instance_geometry_set_shader_parameter(RID instance, StringName parameter, Variant value)
Parameters
instance
RIDparameter
StringNamevalue
Variant
instance_geometry_set_transparency(RID, float)
Sets the transparency for the given geometry instance. Equivalent to transparency.
A transparency of 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 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: 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.
void instance_geometry_set_transparency(RID instance, float transparency)
Parameters
instance_geometry_set_visibility_range(RID, float, float, float, float, int)
Sets the visibility range values for the given geometry instance. Equivalent to visibility_range_begin and related properties.
void instance_geometry_set_visibility_range(RID instance, float min, float max, float min_margin, float max_margin, int fade_mode)
Parameters
instance_reset_physics_interpolation(RID)
Prevents physics interpolation for the current physics tick.
This is useful when moving an instance to a new location, to give an instantaneous change rather than interpolation from the previous location.
void instance_reset_physics_interpolation(RID instance)
Parameters
instance
RID
instance_set_base(RID, RID)
Sets the base of the instance. A base can be any of the 3D objects that are created in the RenderingServer that can be displayed. For example, any of the light types, mesh, multimesh, particle system, reflection probe, decal, lightmap, voxel GI and visibility notifiers are all types that can be set as the base of an instance in order to be displayed in the scenario.
void instance_set_base(RID instance, RID base)
Parameters
instance_set_blend_shape_weight(RID, int, float)
Sets the weight for a given blend shape associated with this instance.
void instance_set_blend_shape_weight(RID instance, int shape, float weight)
Parameters
instance_set_custom_aabb(RID, AABB)
Sets a custom AABB to use when culling objects from the view frustum. Equivalent to setting custom_aabb.
void instance_set_custom_aabb(RID instance, AABB aabb)
Parameters
instance_set_extra_visibility_margin(RID, float)
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 extra_cull_margin.
void instance_set_extra_visibility_margin(RID instance, float margin)
Parameters
instance_set_ignore_culling(RID, bool)
If true
, ignores both frustum and occlusion culling on the specified 3D geometry instance. This is not the same as ignore_occlusion_culling, which only ignores occlusion culling and leaves frustum culling intact.
void instance_set_ignore_culling(RID instance, bool enabled)
Parameters
instance_set_interpolated(RID, bool)
Turns on and off physics interpolation for the instance.
void instance_set_interpolated(RID instance, bool interpolated)
Parameters
instance_set_layer_mask(RID, int)
Sets the render layers that this instance will be drawn to. Equivalent to layers.
void instance_set_layer_mask(RID instance, int mask)
Parameters
instance_set_pivot_data(RID, float, bool)
Sets the sorting offset and switches between using the bounding box or instance origin for depth sorting.
void instance_set_pivot_data(RID instance, float sorting_offset, bool use_aabb_center)
Parameters
instance_set_scenario(RID, RID)
Sets the scenario that the instance is in. The scenario is the 3D world that the objects will be displayed in.
void instance_set_scenario(RID instance, RID scenario)
Parameters
instance_set_surface_override_material(RID, int, RID)
Sets the override material of a specific surface. Equivalent to MeshInstance3D.set_surface_override_material.
void instance_set_surface_override_material(RID instance, int surface, RID material)
Parameters
instance_set_transform(RID, Transform3D)
Sets the world space transform of the instance. Equivalent to global_transform.
void instance_set_transform(RID instance, Transform3D transform)
Parameters
instance
RIDtransform
Transform3D
instance_set_visibility_parent(RID, RID)
Sets the visibility parent for the given instance. Equivalent to visibility_parent.
void instance_set_visibility_parent(RID instance, RID parent)
Parameters
instance_set_visible(RID, bool)
Sets whether an instance is drawn or not. Equivalent to visible.
void instance_set_visible(RID instance, bool visible)
Parameters
instances_cull_aabb(AABB, RID)
Qualifiers: const
Returns an array of object IDs intersecting with the provided AABB. Only 3D nodes that inherit from VisualInstance3D are considered, such as MeshInstance3D or DirectionalLight3D. Use @GlobalScope.instance_from_id to obtain the actual nodes. A scenario RID must be provided, which is available in the World3D you want to query. This forces an update for all resources queued to update.
Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
PackedInt64Array instances_cull_aabb(AABB aabb, RID scenario)
Parameters
instances_cull_convex(Plane[], RID)
Qualifiers: const
Returns an array of object IDs intersecting with the provided convex shape. Only 3D nodes that inherit from VisualInstance3D are considered, such as MeshInstance3D or DirectionalLight3D. Use @GlobalScope.instance_from_id to obtain the actual nodes. A scenario RID must be provided, which is available in the World3D you want to query. This forces an update for all resources queued to update.
Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
PackedInt64Array instances_cull_convex(Plane[] convex, RID scenario)
Parameters
convex
Plane[]scenario
RID
instances_cull_ray(Vector3, Vector3, RID)
Qualifiers: const
Returns an array of object IDs intersecting with the provided 3D ray. Only 3D nodes that inherit from VisualInstance3D are considered, such as MeshInstance3D or DirectionalLight3D. Use @GlobalScope.instance_from_id to obtain the actual nodes. A scenario RID must be provided, which is available in the World3D you want to query. This forces an update for all resources queued to update.
Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
PackedInt64Array instances_cull_ray(Vector3 from, Vector3 to, RID scenario)
Parameters
is_on_render_thread
Returns true
if our code is currently executing on the rendering thread.
bool is_on_render_thread
light_directional_set_blend_splits(RID, bool)
If true
, this directional light will blend between shadow map splits resulting in a smoother transition between them. Equivalent to directional_shadow_blend_splits.
void light_directional_set_blend_splits(RID light, bool enable)
Parameters
light_directional_set_shadow_mode(RID, int)
Sets the shadow mode for this directional light. Equivalent to directional_shadow_mode. See LightDirectionalShadowMode for options.
void light_directional_set_shadow_mode(RID light, int mode)
Parameters
light_directional_set_sky_mode(RID, int)
If true
, this light will not be used for anything except sky shaders. Use this for lights that impact your sky shader that you may want to hide from affecting the rest of the scene. For example, you may want to enable this when the sun in your sky shader falls below the horizon.
void light_directional_set_sky_mode(RID light, int mode)
Parameters
light_omni_set_shadow_mode(RID, int)
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 omni_shadow_mode.
void light_omni_set_shadow_mode(RID light, int mode)
Parameters
light_projectors_set_filter(int)
Sets the texture filter mode to use when rendering light projectors. This parameter is global and cannot be set on a per-light basis.
void light_projectors_set_filter(int filter)
Parameters
filter
int
light_set_bake_mode(RID, int)
Sets the bake mode to use for the specified 3D light. Equivalent to light_bake_mode.
void light_set_bake_mode(RID light, int bake_mode)
Parameters
light_set_color(RID, Color)
Sets the color of the light. Equivalent to light_color.
void light_set_color(RID light, Color color)
Parameters
light_set_cull_mask(RID, int)
Sets the cull mask for this 3D light. Lights only affect objects in the selected layers. Equivalent to light_cull_mask.
void light_set_cull_mask(RID light, int mask)
Parameters
light_set_distance_fade(RID, bool, float, float, float)
Sets the distance fade for this 3D light. This acts as a form of level of detail (LOD) and can be used to improve performance. Equivalent to distance_fade_enabled, distance_fade_begin, distance_fade_shadow, and distance_fade_length.
void light_set_distance_fade(RID decal, bool enabled, float begin, float shadow, float length)
Parameters
light_set_max_sdfgi_cascade(RID, int)
Sets the maximum SDFGI cascade in which the 3D light's indirect lighting is rendered. Higher values allow the light to be rendered in SDFGI further away from the camera.
void light_set_max_sdfgi_cascade(RID light, int cascade)
Parameters
light_set_negative(RID, bool)
If true
, the 3D light will subtract light instead of adding light. Equivalent to light_negative.
void light_set_negative(RID light, bool enable)
Parameters
light_set_param(RID, int, float)
Sets the specified 3D light parameter. See LightParam for options. Equivalent to Light3D.set_param.
void light_set_param(RID light, int param, float value)
Parameters
light_set_projector(RID, RID)
Sets the projector texture to use for the specified 3D light. Equivalent to light_projector.
void light_set_projector(RID light, RID texture)
Parameters
light_set_reverse_cull_face_mode(RID, bool)
If true
, 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 RenderingServer.instance_geometry_set_cast_shadows_setting. Equivalent to shadow_reverse_cull_face.
void light_set_reverse_cull_face_mode(RID light, bool enabled)
Parameters
light_set_shadow(RID, bool)
If true
, light will cast shadows. Equivalent to shadow_enabled.
void light_set_shadow(RID light, bool enabled)
Parameters
light_set_shadow_caster_mask(RID, int)
Sets the shadow caster mask for this 3D light. Shadows will only be cast using objects in the selected layers. Equivalent to shadow_caster_mask.
void light_set_shadow_caster_mask(RID light, int mask)
Parameters
lightmap_create
Creates a new lightmap global illumination instance and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all lightmap_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent node is LightmapGI.
RID lightmap_create
lightmap_get_probe_capture_bsp_tree(RID)
Qualifiers: const
PackedInt32Array lightmap_get_probe_capture_bsp_tree(RID lightmap)
Parameters
lightmap
RID
lightmap_get_probe_capture_points(RID)
Qualifiers: const
PackedVector3Array lightmap_get_probe_capture_points(RID lightmap)
Parameters
lightmap
RID
lightmap_get_probe_capture_sh(RID)
Qualifiers: const
PackedColorArray lightmap_get_probe_capture_sh(RID lightmap)
Parameters
lightmap
RID
lightmap_get_probe_capture_tetrahedra(RID)
Qualifiers: const
PackedInt32Array lightmap_get_probe_capture_tetrahedra(RID lightmap)
Parameters
lightmap
RID
lightmap_set_baked_exposure_normalization(RID, float)
Used to inform the renderer what exposure normalization value was used while baking the lightmap. This value will be used and modulated at run time to ensure that the lightmap maintains a consistent level of exposure even if the scene-wide exposure normalization is changed at run time. For more information see RenderingServer.camera_attributes_set_exposure.
void lightmap_set_baked_exposure_normalization(RID lightmap, float baked_exposure)
Parameters
lightmap_set_probe_bounds(RID, AABB)
void lightmap_set_probe_bounds(RID lightmap, AABB bounds)
Parameters
lightmap_set_probe_capture_data(RID, PackedVector3Array, PackedColorArray, PackedInt32Array, PackedInt32Array)
void lightmap_set_probe_capture_data(RID lightmap, PackedVector3Array points, PackedColorArray point_sh, PackedInt32Array tetrahedra, PackedInt32Array bsp_tree)
Parameters
lightmap
RIDpoints
PackedVector3Arraypoint_sh
PackedColorArraytetrahedra
PackedInt32Arraybsp_tree
PackedInt32Array
lightmap_set_probe_capture_update_speed(float)
void lightmap_set_probe_capture_update_speed(float speed)
Parameters
speed
float
lightmap_set_probe_interior(RID, bool)
void lightmap_set_probe_interior(RID lightmap, bool interior)
Parameters
lightmap_set_textures(RID, RID, bool)
Set the textures on the given lightmap
GI instance to the texture array pointed to by the light
RID. If the lightmap texture was baked with directional set to true
, then uses_sh
must also be true
.
void lightmap_set_textures(RID lightmap, RID light, bool uses_sh)
Parameters
lightmaps_set_bicubic_filter(bool)
Toggles whether a bicubic filter should be used when lightmaps are sampled. This smoothens their appearance at a performance cost.
void lightmaps_set_bicubic_filter(bool enable)
Parameters
enable
bool
make_sphere_mesh(int, int, float)
Returns a mesh of a sphere with the given number of horizontal subdivisions, vertical subdivisions and radius. See also get_test_cube.
RID make_sphere_mesh(int latitudes, int longitudes, float radius)
Parameters
material_create
Creates an empty material and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all material_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent resource is Material.
RID material_create
material_get_param(RID, StringName)
Qualifiers: const
Returns the value of a certain material's parameter.
Variant material_get_param(RID material, StringName parameter)
Parameters
material
RIDparameter
StringName
material_set_next_pass(RID, RID)
Sets an object's next material.
void material_set_next_pass(RID material, RID next_material)
Parameters
material_set_param(RID, StringName, Variant)
Sets a material's parameter.
void material_set_param(RID material, StringName parameter, Variant value)
Parameters
material
RIDparameter
StringNamevalue
Variant
material_set_render_priority(RID, int)
Sets a material's render priority.
void material_set_render_priority(RID material, int priority)
Parameters
material_set_shader(RID, RID)
Sets a shader material's shader.
void material_set_shader(RID shader_material, RID shader)
Parameters
mesh_add_surface(RID, Dictionary)
void mesh_add_surface(RID mesh, Dictionary surface)
Parameters
mesh
RIDsurface
Dictionary
mesh_add_surface_from_arrays(RID, int, Array, Array, Dictionary, int)
void mesh_add_surface_from_arrays(RID mesh, int primitive, Array arrays, Array blend_shapes, Dictionary lods, int compress_format)
Parameters
mesh_clear(RID)
Removes all surfaces from a mesh.
void mesh_clear(RID mesh)
Parameters
mesh
RID
mesh_create
Creates a new mesh and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all mesh_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
To place in a scene, attach this mesh to an instance using RenderingServer.instance_set_base using the returned RID.
Note: The equivalent resource is Mesh.
RID mesh_create
mesh_create_from_surfaces(Dictionary[], int)
RID mesh_create_from_surfaces(Dictionary[] surfaces, int blend_shape_count)
Parameters
surfaces
Dictionary[]blend_shape_count
int
mesh_get_blend_shape_count(RID)
Qualifiers: const
Returns a mesh's blend shape count.
int mesh_get_blend_shape_count(RID mesh)
Parameters
mesh
RID
mesh_get_blend_shape_mode(RID)
Qualifiers: const
Returns a mesh's blend shape mode.
int mesh_get_blend_shape_mode(RID mesh)
Parameters
mesh
RID
mesh_get_custom_aabb(RID)
Qualifiers: const
Returns a mesh's custom aabb.
AABB mesh_get_custom_aabb(RID mesh)
Parameters
mesh
RID
mesh_get_surface(RID, int)
Dictionary mesh_get_surface(RID mesh, int surface)
Parameters
mesh_get_surface_count(RID)
Qualifiers: const
Returns a mesh's number of surfaces.
int mesh_get_surface_count(RID mesh)
Parameters
mesh
RID
mesh_set_blend_shape_mode(RID, int)
Sets a mesh's blend shape mode.
void mesh_set_blend_shape_mode(RID mesh, int mode)
Parameters
mesh_set_custom_aabb(RID, AABB)
Sets a mesh's custom aabb.
void mesh_set_custom_aabb(RID mesh, AABB aabb)
Parameters
mesh_set_shadow_mesh(RID, RID)
void mesh_set_shadow_mesh(RID mesh, RID shadow_mesh)
Parameters
mesh_surface_get_arrays(RID, int)
Qualifiers: const
Returns a mesh's surface's buffer arrays.
Array mesh_surface_get_arrays(RID mesh, int surface)
Parameters
mesh_surface_get_blend_shape_arrays(RID, int)
Qualifiers: const
Returns a mesh's surface's arrays for blend shapes.
Array[] mesh_surface_get_blend_shape_arrays(RID mesh, int surface)
Parameters
mesh_surface_get_format_attribute_stride(int, int)
Qualifiers: const
Returns the stride of the attribute buffer for a mesh with given format
.
int mesh_surface_get_format_attribute_stride(int format, int vertex_count)
Parameters
mesh_surface_get_format_normal_tangent_stride(int, int)
Qualifiers: const
Returns the stride of the combined normals and tangents for a mesh with given format
. Note importantly that, while normals and tangents are in the vertex buffer with vertices, they are only interleaved with each other and so have a different stride than vertex positions.
int mesh_surface_get_format_normal_tangent_stride(int format, int vertex_count)
Parameters
mesh_surface_get_format_offset(int, int, int)
Qualifiers: const
Returns the offset of a given attribute by array_index
in the start of its respective buffer.
int mesh_surface_get_format_offset(int format, int vertex_count, int array_index)
Parameters
mesh_surface_get_format_skin_stride(int, int)
Qualifiers: const
Returns the stride of the skin buffer for a mesh with given format
.
int mesh_surface_get_format_skin_stride(int format, int vertex_count)
Parameters
mesh_surface_get_format_vertex_stride(int, int)
Qualifiers: const
Returns the stride of the vertex positions for a mesh with given format
. Note importantly that vertex positions are stored consecutively and are not interleaved with the other attributes in the vertex buffer (normals and tangents).
int mesh_surface_get_format_vertex_stride(int format, int vertex_count)
Parameters
mesh_surface_get_material(RID, int)
Qualifiers: const
Returns a mesh's surface's material.
RID mesh_surface_get_material(RID mesh, int surface)
Parameters
mesh_surface_remove(RID, int)
Removes the surface at the given index from the Mesh, shifting surfaces with higher index down by one.
void mesh_surface_remove(RID mesh, int surface)
Parameters
mesh_surface_set_material(RID, int, RID)
Sets a mesh's surface's material.
void mesh_surface_set_material(RID mesh, int surface, RID material)
Parameters
mesh_surface_update_attribute_region(RID, int, int, PackedByteArray)
void mesh_surface_update_attribute_region(RID mesh, int surface, int offset, PackedByteArray data)
Parameters
mesh
RIDsurface
intoffset
intdata
PackedByteArray
mesh_surface_update_skin_region(RID, int, int, PackedByteArray)
void mesh_surface_update_skin_region(RID mesh, int surface, int offset, PackedByteArray data)
Parameters
mesh
RIDsurface
intoffset
intdata
PackedByteArray
mesh_surface_update_vertex_region(RID, int, int, PackedByteArray)
void mesh_surface_update_vertex_region(RID mesh, int surface, int offset, PackedByteArray data)
Parameters
mesh
RIDsurface
intoffset
intdata
PackedByteArray
multimesh_allocate_data(RID, int, int, bool, bool, bool)
void multimesh_allocate_data(RID multimesh, int instances, int transform_format, bool color_format, bool custom_data_format, bool use_indirect)
Parameters
multimesh
RIDinstances
inttransform_format
intcolor_format
boolcustom_data_format
booluse_indirect
bool
multimesh_create
Creates a new multimesh on the RenderingServer and returns an RID handle. This RID will be used in all multimesh_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
To place in a scene, attach this multimesh to an instance using RenderingServer.instance_set_base using the returned RID.
Note: The equivalent resource is MultiMesh.
RID multimesh_create
multimesh_get_aabb(RID)
Qualifiers: const
Calculates and returns the axis-aligned bounding box that encloses all instances within the multimesh.
AABB multimesh_get_aabb(RID multimesh)
Parameters
multimesh
RID
multimesh_get_buffer(RID)
Qualifiers: const
Returns the MultiMesh data (such as instance transforms, colors, etc.). See RenderingServer.multimesh_set_buffer for details on the returned data.
Note: If the buffer is in the engine's internal cache, it will have to be fetched from GPU memory and possibly decompressed. This means RenderingServer.multimesh_get_buffer is potentially a slow operation and should be avoided whenever possible.
PackedFloat32Array multimesh_get_buffer(RID multimesh)
Parameters
multimesh
RID
multimesh_get_buffer_rd_rid(RID)
Qualifiers: const
Returns the RenderingDevice RID handle of the MultiMesh, which can be used as any other buffer on the Rendering Device.
RID multimesh_get_buffer_rd_rid(RID multimesh)
Parameters
multimesh
RID
multimesh_get_command_buffer_rd_rid(RID)
Qualifiers: const
Returns the RenderingDevice RID handle of the MultiMesh command buffer. This RID is only valid if use_indirect
is set to true
when allocating data through RenderingServer.multimesh_allocate_data. It can be used to directly modify the instance count via buffer.
The data structure is dependent on both how many surfaces the mesh contains and whether it is indexed or not, the buffer has 5 integers in it, with the last unused if the mesh is not indexed.
Each of the values in the buffer correspond to these options:
Indexed:
0 - indexCount;
1 - instanceCount;
2 - firstIndex;
3 - vertexOffset;
4 - firstInstance;
Non Indexed:
0 - vertexCount;
1 - instanceCount;
2 - firstVertex;
3 - firstInstance;
4 - unused;
RID multimesh_get_command_buffer_rd_rid(RID multimesh)
Parameters
multimesh
RID
multimesh_get_custom_aabb(RID)
Qualifiers: const
Returns the custom AABB defined for this MultiMesh resource.
AABB multimesh_get_custom_aabb(RID multimesh)
Parameters
multimesh
RID
multimesh_get_instance_count(RID)
Qualifiers: const
Returns the number of instances allocated for this multimesh.
int multimesh_get_instance_count(RID multimesh)
Parameters
multimesh
RID
multimesh_get_mesh(RID)
Qualifiers: const
Returns the RID of the mesh that will be used in drawing this multimesh.
RID multimesh_get_mesh(RID multimesh)
Parameters
multimesh
RID
multimesh_get_visible_instances(RID)
Qualifiers: const
Returns the number of visible instances for this multimesh.
int multimesh_get_visible_instances(RID multimesh)
Parameters
multimesh
RID
multimesh_instance_get_color(RID, int)
Qualifiers: const
Returns the color by which the specified instance will be modulated.
Color multimesh_instance_get_color(RID multimesh, int index)
Parameters
multimesh_instance_get_custom_data(RID, int)
Qualifiers: const
Returns the custom data associated with the specified instance.
Color multimesh_instance_get_custom_data(RID multimesh, int index)
Parameters
multimesh_instance_get_transform(RID, int)
Qualifiers: const
Returns the Transform3D of the specified instance.
Transform3D multimesh_instance_get_transform(RID multimesh, int index)
Parameters
multimesh_instance_get_transform_2d(RID, int)
Qualifiers: const
Returns the Transform2D of the specified instance. For use when the multimesh is set to use 2D transforms.
Transform2D multimesh_instance_get_transform_2d(RID multimesh, int index)
Parameters
multimesh_instance_reset_physics_interpolation(RID, int)
Prevents physics interpolation for the specified instance during the current physics tick.
This is useful when moving an instance to a new location, to give an instantaneous change rather than interpolation from the previous location.
void multimesh_instance_reset_physics_interpolation(RID multimesh, int index)
Parameters
multimesh_instance_set_color(RID, int, Color)
Sets the color by which this instance will be modulated. Equivalent to MultiMesh.set_instance_color.
void multimesh_instance_set_color(RID multimesh, int index, Color color)
Parameters
multimesh_instance_set_custom_data(RID, int, Color)
Sets the custom data for this instance. Custom data is passed as a Color, but is interpreted as a vec4
in the shader. Equivalent to MultiMesh.set_instance_custom_data.
void multimesh_instance_set_custom_data(RID multimesh, int index, Color custom_data)
Parameters
multimesh_instance_set_transform(RID, int, Transform3D)
Sets the Transform3D for this instance. Equivalent to MultiMesh.set_instance_transform.
void multimesh_instance_set_transform(RID multimesh, int index, Transform3D transform)
Parameters
multimesh
RIDindex
inttransform
Transform3D
multimesh_instance_set_transform_2d(RID, int, Transform2D)
Sets the Transform2D for this instance. For use when multimesh is used in 2D. Equivalent to MultiMesh.set_instance_transform_2d.
void multimesh_instance_set_transform_2d(RID multimesh, int index, Transform2D transform)
Parameters
multimesh
RIDindex
inttransform
Transform2D
multimesh_set_buffer(RID, PackedFloat32Array)
Set the entire data to use for drawing the multimesh
at once to buffer
(such as instance transforms and colors). buffer
's size must match the number of instances multiplied by the per-instance data size (which depends on the enabled MultiMesh fields). Otherwise, an error message is printed and nothing is rendered. See also RenderingServer.multimesh_get_buffer.
The per-instance data size and expected data order is:
2D:
- Position: 8 floats (8 floats for Transform2D)
- Position + Vertex color: 12 floats (8 floats for Transform2D, 4 floats for Color)
- Position + Custom data: 12 floats (8 floats for Transform2D, 4 floats of custom data)
- Position + Vertex color + Custom data: 16 floats (8 floats for Transform2D, 4 floats for Color, 4 floats of custom data)
3D:
- Position: 12 floats (12 floats for Transform3D)
- Position + Vertex color: 16 floats (12 floats for Transform3D, 4 floats for Color)
- Position + Custom data: 16 floats (12 floats for Transform3D, 4 floats of custom data)
- Position + Vertex color + Custom data: 20 floats (12 floats for Transform3D, 4 floats for Color, 4 floats of custom data)
Instance transforms are in row-major order. Specifically:
For Transform2D the float-order is:
(x.x, y.x, padding_float, origin.x, x.y, y.y, padding_float, origin.y)
.For Transform3D the float-order is:
(basis.x.x, basis.y.x, basis.z.x, origin.x, basis.x.y, basis.y.y, basis.z.y, origin.y, basis.x.z, basis.y.z, basis.z.z, origin.z)
.
void multimesh_set_buffer(RID multimesh, PackedFloat32Array buffer)
Parameters
multimesh
RIDbuffer
PackedFloat32Array
multimesh_set_buffer_interpolated(RID, PackedFloat32Array, PackedFloat32Array)
Alternative version of RenderingServer.multimesh_set_buffer for use with physics interpolation.
Takes both an array of current data and an array of data for the previous physics tick.
void multimesh_set_buffer_interpolated(RID multimesh, PackedFloat32Array buffer, PackedFloat32Array buffer_previous)
Parameters
multimesh
RIDbuffer
PackedFloat32Arraybuffer_previous
PackedFloat32Array
multimesh_set_custom_aabb(RID, AABB)
Sets the custom AABB for this MultiMesh resource.
void multimesh_set_custom_aabb(RID multimesh, AABB aabb)
Parameters
multimesh_set_mesh(RID, RID)
Sets the mesh to be drawn by the multimesh. Equivalent to mesh.
void multimesh_set_mesh(RID multimesh, RID mesh)
Parameters
multimesh_set_physics_interpolated(RID, bool)
Turns on and off physics interpolation for this MultiMesh resource.
void multimesh_set_physics_interpolated(RID multimesh, bool interpolated)
Parameters
multimesh_set_physics_interpolation_quality(RID, int)
Sets the physics interpolation quality for the MultiMesh.
A value of RenderingServer.MULTIMESH_INTERP_QUALITY_FAST gives fast but low quality interpolation, a value of RenderingServer.MULTIMESH_INTERP_QUALITY_HIGH gives slower but higher quality interpolation.
void multimesh_set_physics_interpolation_quality(RID multimesh, int quality)
Parameters
multimesh_set_visible_instances(RID, int)
Sets the number of instances visible at a given time. If -1, all instances that have been allocated are drawn. Equivalent to visible_instance_count.
void multimesh_set_visible_instances(RID multimesh, int visible)
Parameters
occluder_create
Creates an occluder instance and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all occluder_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent resource is Occluder3D (not to be confused with the OccluderInstance3D node).
RID occluder_create
occluder_set_mesh(RID, PackedVector3Array, PackedInt32Array)
Sets the mesh data for the given occluder RID, which controls the shape of the occlusion culling that will be performed.
void occluder_set_mesh(RID occluder, PackedVector3Array vertices, PackedInt32Array indices)
Parameters
occluder
RIDvertices
PackedVector3Arrayindices
PackedInt32Array
omni_light_create
Creates a new omni light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most light_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
To place in a scene, attach this omni light to an instance using RenderingServer.instance_set_base using the returned RID.
Note: The equivalent node is OmniLight3D.
RID omni_light_create
particles_collision_create
Creates a new 3D GPU particle collision or attractor and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most particles_collision_*
RenderingServer functions.
Note: The equivalent nodes are GPUParticlesCollision3D and GPUParticlesAttractor3D.
RID particles_collision_create
particles_collision_height_field_update(RID)
Requests an update for the 3D GPU particle collision heightfield. This may be automatically called by the 3D GPU particle collision heightfield depending on its update_mode.
void particles_collision_height_field_update(RID particles_collision)
Parameters
particles_collision
RID
particles_collision_set_attractor_attenuation(RID, float)
Sets the attenuation curve
for the 3D GPU particles attractor specified by the particles_collision
RID. Only used for attractors, not colliders. Equivalent to attenuation.
void particles_collision_set_attractor_attenuation(RID particles_collision, float curve)
Parameters
particles_collision_set_attractor_directionality(RID, float)
Sets the directionality amount
for the 3D GPU particles attractor specified by the particles_collision
RID. Only used for attractors, not colliders. Equivalent to directionality.
void particles_collision_set_attractor_directionality(RID particles_collision, float amount)
Parameters
particles_collision_set_attractor_strength(RID, float)
Sets the strength
for the 3D GPU particles attractor specified by the particles_collision
RID. Only used for attractors, not colliders. Equivalent to strength.
void particles_collision_set_attractor_strength(RID particles_collision, float strength)
Parameters
particles_collision_set_box_extents(RID, Vector3)
Sets the extents
for the 3D GPU particles collision by the particles_collision
RID. Equivalent to size, size, size, size or size depending on the particles_collision
type.
void particles_collision_set_box_extents(RID particles_collision, Vector3 extents)
Parameters
particles_collision_set_collision_type(RID, int)
Sets the collision or attractor shape type
for the 3D GPU particles collision or attractor specified by the particles_collision
RID.
void particles_collision_set_collision_type(RID particles_collision, int type)
Parameters
particles_collision_set_cull_mask(RID, int)
Sets the cull mask
for the 3D GPU particles collision or attractor specified by the particles_collision
RID. Equivalent to cull_mask or cull_mask depending on the particles_collision
type.
void particles_collision_set_cull_mask(RID particles_collision, int mask)
Parameters
particles_collision_set_field_texture(RID, RID)
Sets the signed distance field texture
for the 3D GPU particles collision specified by the particles_collision
RID. Equivalent to texture or texture depending on the particles_collision
type.
void particles_collision_set_field_texture(RID particles_collision, RID texture)
Parameters
particles_collision_set_height_field_mask(RID, int)
Sets the heightfield mask
for the 3D GPU particles heightfield collision specified by the particles_collision
RID. Equivalent to heightfield_mask.
void particles_collision_set_height_field_mask(RID particles_collision, int mask)
Parameters
particles_collision_set_height_field_resolution(RID, int)
Sets the heightmap resolution
for the 3D GPU particles heightfield collision specified by the particles_collision
RID. Equivalent to resolution.
void particles_collision_set_height_field_resolution(RID particles_collision, int resolution)
Parameters
particles_collision_set_sphere_radius(RID, float)
Sets the radius
for the 3D GPU particles sphere collision or attractor specified by the particles_collision
RID. Equivalent to radius or radius depending on the particles_collision
type.
void particles_collision_set_sphere_radius(RID particles_collision, float radius)
Parameters
particles_create
Creates a GPU-based particle system and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all particles_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
To place in a scene, attach these particles to an instance using RenderingServer.instance_set_base using the returned RID.
Note: The equivalent nodes are GPUParticles2D and GPUParticles3D.
Note: All particles_*
methods only apply to GPU-based particles, not CPU-based particles. CPUParticles2D and CPUParticles3D do not have equivalent RenderingServer functions available, as these use MultiMeshInstance2D and MultiMeshInstance3D under the hood (see multimesh_*
methods).
RID particles_create
particles_emit(RID, Transform3D, Vector3, Color, Color, int)
Manually emits particles from the particles
instance.
void particles_emit(RID particles, Transform3D transform, Vector3 velocity, Color color, Color custom, int emit_flags)
Parameters
particles_get_current_aabb(RID)
Calculates and returns the axis-aligned bounding box that contains all the particles. Equivalent to capture_aabb.
AABB particles_get_current_aabb(RID particles)
Parameters
particles
RID
particles_get_emitting(RID)
Returns true
if particles are currently set to emitting.
bool particles_get_emitting(RID particles)
Parameters
particles
RID
particles_is_inactive(RID)
Returns true
if particles are not emitting and particles are set to inactive.
bool particles_is_inactive(RID particles)
Parameters
particles
RID
particles_request_process(RID)
Add particle system to list of particle systems that need to be updated. Update will take place on the next frame, or on the next call to RenderingServer.instances_cull_aabb, RenderingServer.instances_cull_convex, or RenderingServer.instances_cull_ray.
void particles_request_process(RID particles)
Parameters
particles
RID
particles_request_process_time(RID, float)
Requests particles to process for extra process time during a single frame.
void particles_request_process_time(RID particles, float time)
Parameters
particles_restart(RID)
Reset the particles on the next update. Equivalent to GPUParticles3D.restart.
void particles_restart(RID particles)
Parameters
particles
RID
particles_set_amount(RID, int)
Sets the number of particles to be drawn and allocates the memory for them. Equivalent to amount.
void particles_set_amount(RID particles, int amount)
Parameters
particles_set_amount_ratio(RID, float)
Sets the amount ratio for particles to be emitted. Equivalent to amount_ratio.
void particles_set_amount_ratio(RID particles, float ratio)
Parameters
particles_set_collision_base_size(RID, float)
void particles_set_collision_base_size(RID particles, float size)
Parameters
particles_set_custom_aabb(RID, AABB)
Sets a custom axis-aligned bounding box for the particle system. Equivalent to visibility_aabb.
void particles_set_custom_aabb(RID particles, AABB aabb)
Parameters
particles_set_draw_order(RID, int)
Sets the draw order of the particles to one of the named enums from ParticlesDrawOrder. See ParticlesDrawOrder for options. Equivalent to draw_order.
void particles_set_draw_order(RID particles, int order)
Parameters
particles_set_draw_pass_mesh(RID, int, RID)
Sets the mesh to be used for the specified draw pass. Equivalent to draw_pass_1, draw_pass_2, draw_pass_3, and draw_pass_4.
void particles_set_draw_pass_mesh(RID particles, int pass, RID mesh)
Parameters
particles_set_draw_passes(RID, int)
Sets the number of draw passes to use. Equivalent to draw_passes.
void particles_set_draw_passes(RID particles, int count)
Parameters
particles_set_emission_transform(RID, Transform3D)
Sets the Transform3D that will be used by the particles when they first emit.
void particles_set_emission_transform(RID particles, Transform3D transform)
Parameters
particles
RIDtransform
Transform3D
particles_set_emitter_velocity(RID, Vector3)
Sets the velocity of a particle node, that will be used by inherit_velocity_ratio.
void particles_set_emitter_velocity(RID particles, Vector3 velocity)
Parameters
particles_set_emitting(RID, bool)
If true
, particles will emit over time. Setting to false
does not reset the particles, but only stops their emission. Equivalent to emitting.
void particles_set_emitting(RID particles, bool emitting)
Parameters
particles_set_explosiveness_ratio(RID, float)
Sets the explosiveness ratio. Equivalent to explosiveness.
void particles_set_explosiveness_ratio(RID particles, float ratio)
Parameters
particles_set_fixed_fps(RID, int)
Sets the frame rate that the particle system rendering will be fixed to. Equivalent to fixed_fps.
void particles_set_fixed_fps(RID particles, int fps)
Parameters
particles_set_fractional_delta(RID, bool)
If true
, uses fractional delta which smooths the movement of the particles. Equivalent to fract_delta.
void particles_set_fractional_delta(RID particles, bool enable)
Parameters
particles_set_interp_to_end(RID, float)
Sets the value that informs a ParticleProcessMaterial to rush all particles towards the end of their lifetime.
void particles_set_interp_to_end(RID particles, float factor)
Parameters
particles_set_interpolate(RID, bool)
void particles_set_interpolate(RID particles, bool enable)
Parameters
particles_set_lifetime(RID, float)
Sets the lifetime of each particle in the system. Equivalent to lifetime.
void particles_set_lifetime(RID particles, float lifetime)
Parameters
particles_set_mode(RID, int)
Sets whether the GPU particles specified by the particles
RID should be rendered in 2D or 3D according to mode
.
void particles_set_mode(RID particles, int mode)
Parameters
particles_set_one_shot(RID, bool)
If true
, particles will emit once and then stop. Equivalent to one_shot.
void particles_set_one_shot(RID particles, bool one_shot)
Parameters
particles_set_pre_process_time(RID, float)
Sets the preprocess time for the particles' animation. This lets you delay starting an animation until after the particles have begun emitting. Equivalent to preprocess.
void particles_set_pre_process_time(RID particles, float time)
Parameters
particles_set_process_material(RID, RID)
Sets the material for processing the particles.
Note: This is not the material used to draw the materials. Equivalent to process_material.
void particles_set_process_material(RID particles, RID material)
Parameters
particles_set_randomness_ratio(RID, float)
Sets the emission randomness ratio. This randomizes the emission of particles within their phase. Equivalent to randomness.
void particles_set_randomness_ratio(RID particles, float ratio)
Parameters
particles_set_speed_scale(RID, float)
Sets the speed scale of the particle system. Equivalent to speed_scale.
void particles_set_speed_scale(RID particles, float scale)
Parameters
particles_set_subemitter(RID, RID)
void particles_set_subemitter(RID particles, RID subemitter_particles)
Parameters
particles_set_trail_bind_poses(RID, Transform3D[])
void particles_set_trail_bind_poses(RID particles, Transform3D[] bind_poses)
Parameters
particles
RIDbind_poses
Transform3D[]
particles_set_trails(RID, bool, float)
If enable
is true
, enables trails for the particles
with the specified length_sec
in seconds. Equivalent to trail_enabled and trail_lifetime.
void particles_set_trails(RID particles, bool enable, float length_sec)
Parameters
particles_set_transform_align(RID, int)
void particles_set_transform_align(RID particles, int align)
Parameters
particles_set_use_local_coordinates(RID, bool)
If true
, particles use local coordinates. If false
they use global coordinates. Equivalent to local_coords.
void particles_set_use_local_coordinates(RID particles, bool enable)
Parameters
positional_soft_shadow_filter_set_quality(int)
Sets the filter quality for omni and spot light shadows in 3D. See also rendering/lights_and_shadows/positional_shadow/soft_shadow_filter_quality. This parameter is global and cannot be set on a per-viewport basis.
void positional_soft_shadow_filter_set_quality(int quality)
Parameters
quality
int
reflection_probe_create
Creates a reflection probe and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all reflection_probe_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
To place in a scene, attach this reflection probe to an instance using RenderingServer.instance_set_base using the returned RID.
Note: The equivalent node is ReflectionProbe.
RID reflection_probe_create
reflection_probe_set_ambient_color(RID, Color)
Sets the reflection probe's custom ambient light color. Equivalent to ambient_color.
void reflection_probe_set_ambient_color(RID probe, Color color)
Parameters
reflection_probe_set_ambient_energy(RID, float)
Sets the reflection probe's custom ambient light energy. Equivalent to ambient_color_energy.
void reflection_probe_set_ambient_energy(RID probe, float energy)
Parameters
reflection_probe_set_ambient_mode(RID, int)
Sets the reflection probe's ambient light mode. Equivalent to ambient_mode.
void reflection_probe_set_ambient_mode(RID probe, int mode)
Parameters
reflection_probe_set_as_interior(RID, bool)
If true
, reflections will ignore sky contribution. Equivalent to interior.
void reflection_probe_set_as_interior(RID probe, bool enable)
Parameters
reflection_probe_set_blend_distance(RID, float)
Sets the distance in meters over which a probe blends into the scene.
void reflection_probe_set_blend_distance(RID probe, float blend_distance)
Parameters
reflection_probe_set_cull_mask(RID, int)
Sets the render cull mask for this reflection probe. Only instances with a matching layer will be reflected by this probe. Equivalent to cull_mask.
void reflection_probe_set_cull_mask(RID probe, int layers)
Parameters
reflection_probe_set_enable_box_projection(RID, bool)
If true
, uses box projection. This can make reflections look more correct in certain situations. Equivalent to box_projection.
void reflection_probe_set_enable_box_projection(RID probe, bool enable)
Parameters
reflection_probe_set_enable_shadows(RID, bool)
If true
, computes shadows in the reflection probe. This makes the reflection much slower to compute. Equivalent to enable_shadows.
void reflection_probe_set_enable_shadows(RID probe, bool enable)
Parameters
reflection_probe_set_intensity(RID, float)
Sets the intensity of the reflection probe. Intensity modulates the strength of the reflection. Equivalent to intensity.
void reflection_probe_set_intensity(RID probe, float intensity)
Parameters
reflection_probe_set_max_distance(RID, float)
Sets the max distance away from the probe an object can be before it is culled. Equivalent to max_distance.
void reflection_probe_set_max_distance(RID probe, float distance)
Parameters
reflection_probe_set_mesh_lod_threshold(RID, float)
Sets the mesh level of detail to use in the reflection probe rendering. Higher values will use less detailed versions of meshes that have LOD variations generated, which can improve performance. Equivalent to mesh_lod_threshold.
void reflection_probe_set_mesh_lod_threshold(RID probe, float pixels)
Parameters
reflection_probe_set_origin_offset(RID, Vector3)
Sets the origin offset to be used when this reflection probe is in box project mode. Equivalent to origin_offset.
void reflection_probe_set_origin_offset(RID probe, Vector3 offset)
Parameters
reflection_probe_set_reflection_mask(RID, int)
Sets the render reflection mask for this reflection probe. Only instances with a matching layer will have reflections applied from this probe. Equivalent to reflection_mask.
void reflection_probe_set_reflection_mask(RID probe, int layers)
Parameters
reflection_probe_set_resolution(RID, int)
Sets the resolution to use when rendering the specified reflection probe. The resolution
is specified for each cubemap face: for instance, specifying 512
will allocate 6 faces of 512×512 each (plus mipmaps for roughness levels).
void reflection_probe_set_resolution(RID probe, int resolution)
Parameters
reflection_probe_set_size(RID, Vector3)
Sets the size of the area that the reflection probe will capture. Equivalent to size.
void reflection_probe_set_size(RID probe, Vector3 size)
Parameters
reflection_probe_set_update_mode(RID, int)
Sets how often the reflection probe updates. Can either be once or every frame. See ReflectionProbeUpdateMode for options.
void reflection_probe_set_update_mode(RID probe, int mode)
Parameters
request_frame_drawn_callback(Callable)
Schedules a callback to the given callable after a frame has been drawn.
void request_frame_drawn_callback(Callable callable)
Parameters
callable
Callable
scenario_create
Creates a scenario and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all scenario_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
The scenario is the 3D world that all the visual instances exist in.
RID scenario_create
scenario_set_camera_attributes(RID, RID)
Sets the camera attributes (effects
) that will be used with this scenario. See also CameraAttributes.
void scenario_set_camera_attributes(RID scenario, RID effects)
Parameters
scenario_set_compositor(RID, RID)
Sets the compositor (compositor
) that will be used with this scenario. See also Compositor.
void scenario_set_compositor(RID scenario, RID compositor)
Parameters
scenario_set_environment(RID, RID)
Sets the environment that will be used with this scenario. See also Environment.
void scenario_set_environment(RID scenario, RID environment)
Parameters
scenario_set_fallback_environment(RID, RID)
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.
void scenario_set_fallback_environment(RID scenario, RID environment)
Parameters
screen_space_roughness_limiter_set_active(bool, float, float)
Sets the screen-space roughness limiter parameters, such as whether it should be enabled and its thresholds. Equivalent to rendering/anti_aliasing/screen_space_roughness_limiter/enabled, rendering/anti_aliasing/screen_space_roughness_limiter/amount and rendering/anti_aliasing/screen_space_roughness_limiter/limit.
void screen_space_roughness_limiter_set_active(bool enable, float amount, float limit)
Parameters
set_boot_image(Image, Color, bool, bool)
Sets a boot image. The color defines the background color. If scale
is true
, the image will be scaled to fit the screen size. If use_filter
is true
, the image will be scaled with linear interpolation. If use_filter
is false
, the image will be scaled with nearest-neighbor interpolation.
void set_boot_image(Image image, Color color, bool scale, bool use_filter)
Parameters
set_debug_generate_wireframes(bool)
If generate
is true
, generates debug wireframes for all meshes that are loaded when using the Compatibility renderer. By default, the engine does not generate debug wireframes at runtime, since they slow down loading of assets and take up VRAM.
Note: You must call this method before loading any meshes when using the Compatibility renderer, otherwise wireframes will not be used.
void set_debug_generate_wireframes(bool generate)
Parameters
generate
bool
set_default_clear_color(Color)
Sets the default clear color which is used when a specific clear color has not been selected. See also get_default_clear_color.
void set_default_clear_color(Color color)
Parameters
color
Color
shader_create
Creates an empty shader and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all shader_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent resource is Shader.
RID shader_create
shader_get_code(RID)
Qualifiers: const
Returns a shader's source code as a string.
String shader_get_code(RID shader)
Parameters
shader
RID
shader_get_default_texture_parameter(RID, StringName, int)
Qualifiers: const
Returns a default texture from a shader searched by name.
Note: If the sampler array is used use index
to access the specified texture.
RID shader_get_default_texture_parameter(RID shader, StringName name, int index)
Parameters
shader
RIDname
StringNameindex
int
shader_get_parameter_default(RID, StringName)
Qualifiers: const
Returns the default value for the specified shader uniform. This is usually the value written in the shader source code.
Variant shader_get_parameter_default(RID shader, StringName name)
Parameters
shader
RIDname
StringName
shader_set_code(RID, String)
Sets the shader's source code (which triggers recompilation after being changed).
void shader_set_code(RID shader, String code)
Parameters
shader_set_default_texture_parameter(RID, StringName, RID, int)
Sets a shader's default texture. Overwrites the texture given by name.
Note: If the sampler array is used use index
to access the specified texture.
void shader_set_default_texture_parameter(RID shader, StringName name, RID texture, int index)
Parameters
shader
RIDname
StringNametexture
RIDindex
int
shader_set_path_hint(RID, String)
Sets the path hint for the specified shader. This should generally match the Shader resource's resource_path.
void shader_set_path_hint(RID shader, String path)
Parameters
skeleton_allocate_data(RID, int, bool)
void skeleton_allocate_data(RID skeleton, int bones, bool is_2d_skeleton)
Parameters
skeleton_bone_get_transform(RID, int)
Qualifiers: const
Returns the Transform3D set for a specific bone of this skeleton.
Transform3D skeleton_bone_get_transform(RID skeleton, int bone)
Parameters
skeleton_bone_get_transform_2d(RID, int)
Qualifiers: const
Returns the Transform2D set for a specific bone of this skeleton.
Transform2D skeleton_bone_get_transform_2d(RID skeleton, int bone)
Parameters
skeleton_bone_set_transform(RID, int, Transform3D)
Sets the Transform3D for a specific bone of this skeleton.
void skeleton_bone_set_transform(RID skeleton, int bone, Transform3D transform)
Parameters
skeleton
RIDbone
inttransform
Transform3D
skeleton_bone_set_transform_2d(RID, int, Transform2D)
Sets the Transform2D for a specific bone of this skeleton.
void skeleton_bone_set_transform_2d(RID skeleton, int bone, Transform2D transform)
Parameters
skeleton
RIDbone
inttransform
Transform2D
skeleton_create
Creates a skeleton and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all skeleton_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
RID skeleton_create
skeleton_get_bone_count(RID)
Qualifiers: const
Returns the number of bones allocated for this skeleton.
int skeleton_get_bone_count(RID skeleton)
Parameters
skeleton
RID
skeleton_set_base_transform_2d(RID, Transform2D)
void skeleton_set_base_transform_2d(RID skeleton, Transform2D base_transform)
Parameters
skeleton
RIDbase_transform
Transform2D
sky_bake_panorama(RID, float, bool, Vector2i)
Generates and returns an Image containing the radiance map for the specified sky
RID. This supports built-in sky material and custom sky shaders. If bake_irradiance
is true
, the irradiance map is saved instead of the radiance map. The radiance map is used to render reflected light, while the irradiance map is used to render ambient light. See also RenderingServer.environment_bake_panorama.
Note: The image is saved in linear color space without any tonemapping performed, which means it will look too dark if viewed directly in an image editor. energy
values above 1.0
can be used to brighten the resulting image.
Note: size
should be a 2:1 aspect ratio for the generated panorama to have square pixels. For radiance maps, there is no point in using a height greater than radiance_size, as it won't increase detail. Irradiance maps only contain low-frequency data, so there is usually no point in going past a size of 128×64 pixels when saving an irradiance map.
Image sky_bake_panorama(RID sky, float energy, bool bake_irradiance, Vector2i size)
Parameters
sky_create
Creates an empty sky and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all sky_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
RID sky_create
sky_set_material(RID, RID)
Sets the material that the sky uses to render the background, ambient and reflection maps.
void sky_set_material(RID sky, RID material)
Parameters
sky_set_mode(RID, int)
Sets the process mode
of the sky specified by the sky
RID. Equivalent to process_mode.
void sky_set_mode(RID sky, int mode)
Parameters
sky_set_radiance_size(RID, int)
Sets the radiance_size
of the sky specified by the sky
RID (in pixels). Equivalent to radiance_size.
void sky_set_radiance_size(RID sky, int radiance_size)
Parameters
spot_light_create
Creates a spot light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most light_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
To place in a scene, attach this spot light to an instance using RenderingServer.instance_set_base using the returned RID.
RID spot_light_create
sub_surface_scattering_set_quality(int)
Sets rendering/environment/subsurface_scattering/subsurface_scattering_quality to use when rendering materials that have subsurface scattering enabled.
void sub_surface_scattering_set_quality(int quality)
Parameters
quality
int
sub_surface_scattering_set_scale(float, float)
Sets the rendering/environment/subsurface_scattering/subsurface_scattering_scale and rendering/environment/subsurface_scattering/subsurface_scattering_depth_scale to use when rendering materials that have subsurface scattering enabled.
void sub_surface_scattering_set_scale(float scale, float depth_scale)
Parameters
texture_2d_create(Image)
Creates a 2-dimensional texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all texture_2d_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent resource is Texture2D.
Note: Not to be confused with RenderingDevice.texture_create, which creates the graphics API's own texture type as opposed to the Godot-specific Texture2D resource.
RID texture_2d_create(Image image)
Parameters
image
Image
texture_2d_get(RID)
Qualifiers: const
Returns an Image instance from the given texture
RID.
Example: Get the test texture from get_test_texture and apply it to a Sprite2D node:
var texture_rid = RenderingServer.get_test_texture()
var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid))
$Sprite2D.texture = texture
Image texture_2d_get(RID texture)
Parameters
texture
RID
texture_2d_layer_get(RID, int)
Image texture_2d_layer_get(RID texture, int layer)
Parameters
texture_2d_layered_create(Image[], int)
Creates a 2-dimensional layered texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all texture_2d_layered_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent resource is TextureLayered.
RID texture_2d_layered_create(Image[] layers, int layered_type)
Parameters
layers
Image[]layered_type
int
texture_2d_layered_placeholder_create(int)
Creates a placeholder for a 2-dimensional layered texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all texture_2d_layered_*
RenderingServer functions, although it does nothing when used. See also texture_2d_placeholder_create.
Note: The equivalent resource is PlaceholderTextureLayered.
RID texture_2d_layered_placeholder_create(int layered_type)
Parameters
layered_type
int
texture_2d_placeholder_create
Creates a placeholder for a 2-dimensional layered texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all texture_2d_layered_*
RenderingServer functions, although it does nothing when used. See also RenderingServer.texture_2d_layered_placeholder_create.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent resource is PlaceholderTexture2D.
RID texture_2d_placeholder_create
texture_2d_update(RID, Image, int)
Updates the texture specified by the texture
RID with the data in image
. A layer
must also be specified, which should be 0
when updating a single-layer texture (Texture2D).
Note: The image
must have the same width, height and format as the current texture
data. Otherwise, an error will be printed and the original texture won't be modified. If you need to use different width, height or format, use RenderingServer.texture_replace instead.
void texture_2d_update(RID texture, Image image, int layer)
Parameters
texture_3d_create(int, int, int, int, bool, Image[])
Note: The equivalent resource is Texture3D.
RID texture_3d_create(int format, int width, int height, int depth, bool mipmaps, Image[] data)
Parameters
texture_3d_get(RID)
Image[] texture_3d_get(RID texture)
Parameters
texture
RID
texture_3d_placeholder_create
Creates a placeholder for a 3-dimensional texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all texture_3d_*
RenderingServer functions, although it does nothing when used.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent resource is PlaceholderTexture3D.
RID texture_3d_placeholder_create
texture_3d_update(RID, Image[])
Updates the texture specified by the texture
RID's data with the data in data
. All the texture's layers must be replaced at once.
Note: The texture
must have the same width, height, depth and format as the current texture data. Otherwise, an error will be printed and the original texture won't be modified. If you need to use different width, height, depth or format, use RenderingServer.texture_replace instead.
void texture_3d_update(RID texture, Image[] data)
Parameters
texture
RIDdata
Image[]
texture_create_from_native_handle(int, int, int, int, int, int, int, int)
Creates a texture based on a native handle that was created outside of Godot's renderer.
Note: If using only the rendering device renderer, it's recommend to use RenderingDevice.texture_create_from_extension together with RenderingServer.texture_rd_create, rather than this method. It will give you much more control over the texture's format and usage.
RID texture_create_from_native_handle(int type, int format, int native_handle, int width, int height, int depth, int layers, int layered_type)
Parameters
texture_get_format(RID)
Qualifiers: const
Returns the format for the texture.
int texture_get_format(RID texture)
Parameters
texture
RID
texture_get_native_handle(RID, bool)
Qualifiers: const
Returns the internal graphics handle for this texture object. For use when communicating with third-party APIs mostly with GDExtension.
Note: This function returns a uint64_t
which internally maps to a GLuint
(OpenGL) or VkImage
(Vulkan).
int texture_get_native_handle(RID texture, bool srgb)
Parameters
texture_get_path(RID)
Qualifiers: const
String texture_get_path(RID texture)
Parameters
texture
RID
texture_get_rd_texture(RID, bool)
Qualifiers: const
Returns a texture RID that can be used with RenderingDevice.
RID texture_get_rd_texture(RID texture, bool srgb)
Parameters
texture_proxy_create(RID)
This method does nothing and always returns an invalid RID.
RID texture_proxy_create(RID base)
Parameters
base
RID
texture_proxy_update(RID, RID)
This method does nothing.
void texture_proxy_update(RID texture, RID proxy_to)
Parameters
texture_rd_create(RID, int)
Creates a new texture object based on a texture created directly on the RenderingDevice. If the texture contains layers, layer_type
is used to define the layer type.
RID texture_rd_create(RID rd_texture, int layer_type)
Parameters
texture_replace(RID, RID)
Replaces texture
's texture data by the texture specified by the by_texture
RID, without changing texture
's RID.
void texture_replace(RID texture, RID by_texture)
Parameters
texture_set_force_redraw_if_visible(RID, bool)
void texture_set_force_redraw_if_visible(RID texture, bool enable)
Parameters
texture_set_path(RID, String)
void texture_set_path(RID texture, String path)
Parameters
texture_set_size_override(RID, int, int)
void texture_set_size_override(RID texture, int width, int height)
Parameters
viewport_attach_camera(RID, RID)
Sets a viewport's camera.
void viewport_attach_camera(RID viewport, RID camera)
Parameters
viewport_attach_canvas(RID, RID)
Sets a viewport's canvas.
void viewport_attach_canvas(RID viewport, RID canvas)
Parameters
viewport_attach_to_screen(RID, Rect2, int)
Copies the viewport to a region of the screen specified by rect
. If RenderingServer.viewport_set_render_direct_to_screen is true
, then the 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:
func _ready():
RenderingServer.viewport_attach_to_screen(get_viewport().get_viewport_rid(), Rect2())
RenderingServer.viewport_attach_to_screen($Viewport.get_viewport_rid(), Rect2(0, 0, 600, 600))
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 further optimization, see RenderingServer.viewport_set_render_direct_to_screen.
void viewport_attach_to_screen(RID viewport, Rect2 rect, int screen)
Parameters
viewport_create
Creates an empty viewport and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all viewport_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent node is Viewport.
RID viewport_create
viewport_get_measured_render_time_cpu(RID)
Qualifiers: const
Returns the CPU time taken to render the last frame in milliseconds. This only includes time spent in rendering-related operations; scripts' _process
functions and other engine subsystems are not included in this readout. To get a complete readout of CPU time spent to render the scene, sum the render times of all viewports that are drawn every frame plus get_frame_setup_time_cpu. Unlike get_frames_per_second, this method will accurately reflect CPU utilization even if framerate is capped via V-Sync or max_fps. See also RenderingServer.viewport_get_measured_render_time_gpu.
Note: Requires measurements to be enabled on the specified viewport
using RenderingServer.viewport_set_measure_render_time. Otherwise, this method returns 0.0
.
float viewport_get_measured_render_time_cpu(RID viewport)
Parameters
viewport
RID
viewport_get_measured_render_time_gpu(RID)
Qualifiers: const
Returns the GPU time taken to render the last frame in milliseconds. To get a complete readout of GPU time spent to render the scene, sum the render times of all viewports that are drawn every frame. Unlike get_frames_per_second, this method accurately reflects GPU utilization even if framerate is capped via V-Sync or max_fps. See also RenderingServer.viewport_get_measured_render_time_cpu.
Note: Requires measurements to be enabled on the specified viewport
using RenderingServer.viewport_set_measure_render_time. Otherwise, this method returns 0.0
.
Note: When GPU utilization is low enough during a certain period of time, GPUs will decrease their power state (which in turn decreases core and memory clock speeds). This can cause the reported GPU time to increase if GPU utilization is kept low enough by a framerate cap (compared to what it would be at the GPU's highest power state). Keep this in mind when benchmarking using RenderingServer.viewport_get_measured_render_time_gpu. This behavior can be overridden in the graphics driver settings at the cost of higher power usage.
float viewport_get_measured_render_time_gpu(RID viewport)
Parameters
viewport
RID
viewport_get_render_info(RID, int, int)
Returns a statistic about the rendering engine which can be used for performance profiling. This is separated into render pass type
s, each of them having the same info
s you can query (different passes will return different values). See ViewportRenderInfoType for a list of render pass types and ViewportRenderInfo for a list of information that can be queried.
See also RenderingServer.get_rendering_info, which returns global information across all viewports.
Note: Viewport rendering information is not available until at least 2 frames have been rendered by the engine. If rendering information is not available, RenderingServer.viewport_get_render_info returns 0
. To print rendering information in _ready()
successfully, use the following:
func _ready():
for _i in 2:
await get_tree().process_frame
print(
RenderingServer.viewport_get_render_info(get_viewport().get_viewport_rid(),
RenderingServer.VIEWPORT_RENDER_INFO_TYPE_VISIBLE,
RenderingServer.VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME)
)
int viewport_get_render_info(RID viewport, int type, int info)
Parameters
viewport_get_render_target(RID)
Qualifiers: const
Returns the render target for the viewport.
RID viewport_get_render_target(RID viewport)
Parameters
viewport
RID
viewport_get_texture(RID)
Qualifiers: const
Returns the viewport's last rendered frame.
RID viewport_get_texture(RID viewport)
Parameters
viewport
RID
viewport_get_update_mode(RID)
Qualifiers: const
Returns the viewport's update mode. See ViewportUpdateMode constants for options.
Warning: Calling this from any thread other than the rendering thread will be detrimental to performance.
int viewport_get_update_mode(RID viewport)
Parameters
viewport
RID
viewport_remove_canvas(RID, RID)
Detaches a viewport from a canvas.
void viewport_remove_canvas(RID viewport, RID canvas)
Parameters
viewport_set_active(RID, bool)
If true
, sets the viewport active, else sets it inactive.
void viewport_set_active(RID viewport, bool active)
Parameters
viewport_set_anisotropic_filtering_level(RID, int)
Sets the maximum number of samples to take when using anisotropic filtering on textures (as a power of two). A higher sample count will result in sharper textures at oblique angles, but is more expensive to compute. A value of 0
forcibly disables anisotropic filtering, even on materials where it is enabled.
The anisotropic filtering level also affects decals and light projectors if they are configured to use anisotropic filtering. See rendering/textures/decals/filter and rendering/textures/light_projectors/filter.
Note: In 3D, for this setting to have an effect, set texture_filter to BaseMaterial3D.TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC or BaseMaterial3D.TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC on materials.
Note: In 2D, for this setting to have an effect, set texture_filter to CanvasItem.TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC or CanvasItem.TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC on the CanvasItem node displaying the texture (or in CanvasTexture). However, anisotropic filtering is rarely useful in 2D, so only enable it for textures in 2D if it makes a meaningful visual difference.
void viewport_set_anisotropic_filtering_level(RID viewport, int anisotropic_filtering_level)
Parameters
viewport_set_canvas_cull_mask(RID, int)
Sets the rendering mask associated with this Viewport. Only CanvasItem nodes with a matching rendering visibility layer will be rendered by this Viewport.
void viewport_set_canvas_cull_mask(RID viewport, int canvas_cull_mask)
Parameters
viewport_set_canvas_stacking(RID, RID, int, int)
Sets the stacking order for a viewport's canvas.
layer
is the actual canvas layer, while sublayer
specifies the stacking order of the canvas among those in the same layer.
void viewport_set_canvas_stacking(RID viewport, RID canvas, int layer, int sublayer)
Parameters
viewport_set_canvas_transform(RID, RID, Transform2D)
Sets the transformation of a viewport's canvas.
void viewport_set_canvas_transform(RID viewport, RID canvas, Transform2D offset)
Parameters
viewport
RIDcanvas
RIDoffset
Transform2D
viewport_set_clear_mode(RID, int)
Sets the clear mode of a viewport. See ViewportClearMode for options.
void viewport_set_clear_mode(RID viewport, int clear_mode)
Parameters
viewport_set_debug_draw(RID, int)
Sets the debug draw mode of a viewport. See ViewportDebugDraw for options.
void viewport_set_debug_draw(RID viewport, int draw)
Parameters
viewport_set_default_canvas_item_texture_filter(RID, int)
Sets the default texture filtering mode for the specified viewport
RID. See CanvasItemTextureFilter for options.
void viewport_set_default_canvas_item_texture_filter(RID viewport, int filter)
Parameters
viewport_set_default_canvas_item_texture_repeat(RID, int)
Sets the default texture repeat mode for the specified viewport
RID. See CanvasItemTextureRepeat for options.
void viewport_set_default_canvas_item_texture_repeat(RID viewport, int repeat)
Parameters
viewport_set_disable_2d(RID, bool)
If true
, the viewport's canvas (i.e. 2D and GUI elements) is not rendered.
void viewport_set_disable_2d(RID viewport, bool disable)
Parameters
viewport_set_disable_3d(RID, bool)
If true
, the viewport's 3D elements are not rendered.
void viewport_set_disable_3d(RID viewport, bool disable)
Parameters
viewport_set_environment_mode(RID, int)
Sets the viewport's environment mode which allows enabling or disabling rendering of 3D environment over 2D canvas. When disabled, 2D will not be affected by the environment. When enabled, 2D will be affected by the environment if the environment background mode is RenderingServer.ENV_BG_CANVAS. The default behavior is to inherit the setting from the viewport's parent. If the topmost parent is also set to RenderingServer.VIEWPORT_ENVIRONMENT_INHERIT, then the behavior will be the same as if it was set to RenderingServer.VIEWPORT_ENVIRONMENT_ENABLED.
void viewport_set_environment_mode(RID viewport, int mode)
Parameters
viewport_set_fsr_sharpness(RID, float)
Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference.
void viewport_set_fsr_sharpness(RID viewport, float sharpness)
Parameters
viewport_set_global_canvas_transform(RID, Transform2D)
Sets the viewport's global transformation matrix.
void viewport_set_global_canvas_transform(RID viewport, Transform2D transform)
Parameters
viewport
RIDtransform
Transform2D
viewport_set_measure_render_time(RID, bool)
Sets the measurement for the given viewport
RID (obtained using get_viewport_rid). Once enabled, RenderingServer.viewport_get_measured_render_time_cpu and RenderingServer.viewport_get_measured_render_time_gpu will return values greater than 0.0
when queried with the given viewport
.
void viewport_set_measure_render_time(RID viewport, bool enable)
Parameters
viewport_set_msaa_2d(RID, int)
Sets the multisample antialiasing mode for 2D/Canvas on the specified viewport
RID. See ViewportMSAA for options. Equivalent to rendering/anti_aliasing/quality/msaa_2d or msaa_2d.
void viewport_set_msaa_2d(RID viewport, int msaa)
Parameters
viewport_set_msaa_3d(RID, int)
Sets the multisample antialiasing mode for 3D on the specified viewport
RID. See ViewportMSAA for options. Equivalent to rendering/anti_aliasing/quality/msaa_3d or msaa_3d.
void viewport_set_msaa_3d(RID viewport, int msaa)
Parameters
viewport_set_occlusion_culling_build_quality(int)
Sets the rendering/occlusion_culling/bvh_build_quality to use for occlusion culling. This parameter is global and cannot be set on a per-viewport basis.
void viewport_set_occlusion_culling_build_quality(int quality)
Parameters
quality
int
viewport_set_occlusion_rays_per_thread(int)
Sets the rendering/occlusion_culling/occlusion_rays_per_thread to use for occlusion culling. This parameter is global and cannot be set on a per-viewport basis.
void viewport_set_occlusion_rays_per_thread(int rays_per_thread)
Parameters
rays_per_thread
int
viewport_set_parent_viewport(RID, RID)
Sets the viewport's parent to the viewport specified by the parent_viewport
RID.
void viewport_set_parent_viewport(RID viewport, RID parent_viewport)
Parameters
viewport_set_positional_shadow_atlas_quadrant_subdivision(RID, int, int)
Sets the number of subdivisions to use in the specified shadow atlas quadrant
for omni and spot shadows. See also Viewport.set_positional_shadow_atlas_quadrant_subdiv.
void viewport_set_positional_shadow_atlas_quadrant_subdivision(RID viewport, int quadrant, int subdivision)
Parameters
viewport_set_positional_shadow_atlas_size(RID, int, bool)
Sets the size
of the shadow atlas's images (used for omni and spot lights) on the viewport specified by the viewport
RID. The value is rounded up to the nearest power of 2. If use_16_bits
is true
, use 16 bits for the omni/spot shadow depth map. Enabling this results in shadows having less precision and may result in shadow acne, but can lead to performance improvements on some devices.
Note: If this is set to 0
, no positional shadows will be visible at all. This can improve performance significantly on low-end systems by reducing both the CPU and GPU load (as fewer draw calls are needed to draw the scene without shadows).
void viewport_set_positional_shadow_atlas_size(RID viewport, int size, bool use_16_bits)
Parameters
viewport_set_render_direct_to_screen(RID, bool)
If true
, 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 screen_texture. 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.
void viewport_set_render_direct_to_screen(RID viewport, bool enabled)
Parameters
viewport_set_scaling_3d_mode(RID, int)
Sets the 3D resolution scaling mode. Bilinear scaling renders at different resolution to either undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is an upscaling technology that produces high quality images at fast framerates by using a spatially aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces significantly higher image quality. FSR should be used where possible.
void viewport_set_scaling_3d_mode(RID viewport, int scaling_3d_mode)
Parameters
viewport_set_scaling_3d_scale(RID, float)
Scales the 3D render buffer based on the viewport size uses an image filter specified in ViewportScaling3DMode to scale the output image to the full viewport size. Values lower than 1.0
can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater than 1.0
are only valid for bilinear mode and can be used to improve 3D rendering quality at a high performance cost (supersampling). See also ViewportMSAA for multi-sample antialiasing, which is significantly cheaper but only smoothens the edges of polygons.
When using FSR upscaling, AMD recommends exposing the following values as preset options to users "Ultra Quality: 0.77", "Quality: 0.67", "Balanced: 0.59", "Performance: 0.5" instead of exposing the entire scale.
void viewport_set_scaling_3d_scale(RID viewport, float scale)
Parameters
viewport_set_scenario(RID, RID)
Sets a viewport's scenario. The scenario contains information about environment information, reflection atlas, etc.
void viewport_set_scenario(RID viewport, RID scenario)
Parameters
viewport_set_screen_space_aa(RID, int)
Sets the viewport's screen-space antialiasing mode. Equivalent to rendering/anti_aliasing/quality/screen_space_aa or screen_space_aa.
void viewport_set_screen_space_aa(RID viewport, int mode)
Parameters
viewport_set_sdf_oversize_and_scale(RID, int, int)
Sets the viewport's 2D signed distance field rendering/2d/sdf/oversize and rendering/2d/sdf/scale. This is used when sampling the signed distance field in CanvasItem shaders as well as GPUParticles2D collision. This is not used by SDFGI in 3D rendering.
void viewport_set_sdf_oversize_and_scale(RID viewport, int oversize, int scale)
Parameters
viewport_set_size(RID, int, int)
Sets the viewport's width and height in pixels.
void viewport_set_size(RID viewport, int width, int height)
Parameters
viewport_set_snap_2d_transforms_to_pixel(RID, bool)
If true
, canvas item transforms (i.e. origin position) are snapped to the nearest pixel when rendering. This can lead to a crisper appearance at the cost of less smooth movement, especially when Camera2D smoothing is enabled. Equivalent to rendering/2d/snap/snap_2d_transforms_to_pixel.
void viewport_set_snap_2d_transforms_to_pixel(RID viewport, bool enabled)
Parameters
viewport_set_snap_2d_vertices_to_pixel(RID, bool)
If true
, canvas item vertices (i.e. polygon points) are snapped to the nearest pixel when rendering. This can lead to a crisper appearance at the cost of less smooth movement, especially when Camera2D smoothing is enabled. Equivalent to rendering/2d/snap/snap_2d_vertices_to_pixel.
void viewport_set_snap_2d_vertices_to_pixel(RID viewport, bool enabled)
Parameters
viewport_set_texture_mipmap_bias(RID, float)
Affects the final texture sharpness by reading from a lower or higher mipmap (also called "texture LOD bias"). Negative values make mipmapped textures sharper but grainier when viewed at a distance, while positive values make mipmapped textures blurrier (even when up close). To get sharper textures at a distance without introducing too much graininess, set this between -0.75
and 0.0
. Enabling temporal antialiasing (rendering/anti_aliasing/quality/use_taa) can help reduce the graininess visible when using negative mipmap bias.
Note: When the 3D scaling mode is set to FSR 1.0, this value is used to adjust the automatic mipmap bias which is calculated internally based on the scale factor. The formula for this is -log2(1.0 / scale) + mipmap_bias
.
void viewport_set_texture_mipmap_bias(RID viewport, float mipmap_bias)
Parameters
viewport_set_transparent_background(RID, bool)
If true
, the viewport renders its background as transparent.
void viewport_set_transparent_background(RID viewport, bool enabled)
Parameters
viewport_set_update_mode(RID, int)
Sets when the viewport should be updated. See ViewportUpdateMode constants for options.
void viewport_set_update_mode(RID viewport, int update_mode)
Parameters
viewport_set_use_debanding(RID, bool)
If true
, enables debanding on the specified viewport. Equivalent to rendering/anti_aliasing/quality/use_debanding or use_debanding.
void viewport_set_use_debanding(RID viewport, bool enable)
Parameters
viewport_set_use_hdr_2d(RID, bool)
If true
, 2D rendering will use a high dynamic range (HDR) format framebuffer matching the bit depth of the 3D framebuffer. When using the Forward+ renderer this will be an RGBA16
framebuffer, while when using the Mobile renderer it will be an RGB10_A2
framebuffer. Additionally, 2D rendering will take place in linear color space and will be converted to sRGB space immediately before blitting to the screen (if the Viewport is attached to the screen). Practically speaking, this means that the end result of the Viewport will not be clamped into the 0-1
range and can be used in 3D rendering without color space adjustments. This allows 2D rendering to take advantage of effects requiring high dynamic range (e.g. 2D glow) as well as substantially improves the appearance of effects requiring highly detailed gradients. This setting has the same effect as use_hdr_2d.
Note: This setting will have no effect when using the Compatibility renderer, which always renders in low dynamic range for performance reasons.
void viewport_set_use_hdr_2d(RID viewport, bool enabled)
Parameters
viewport_set_use_occlusion_culling(RID, bool)
If true
, enables occlusion culling on the specified viewport. Equivalent to rendering/occlusion_culling/use_occlusion_culling.
void viewport_set_use_occlusion_culling(RID viewport, bool enable)
Parameters
viewport_set_use_taa(RID, bool)
If true
, use temporal antialiasing. Equivalent to rendering/anti_aliasing/quality/use_taa or use_taa.
void viewport_set_use_taa(RID viewport, bool enable)
Parameters
viewport_set_use_xr(RID, bool)
If true
, the viewport uses augmented or virtual reality technologies. See XRInterface.
void viewport_set_use_xr(RID viewport, bool use_xr)
Parameters
viewport_set_vrs_mode(RID, int)
Sets the Variable Rate Shading (VRS) mode for the viewport. If the GPU does not support VRS, this property is ignored. Equivalent to rendering/vrs/mode.
void viewport_set_vrs_mode(RID viewport, int mode)
Parameters
viewport_set_vrs_texture(RID, RID)
The texture to use when the VRS mode is set to RenderingServer.VIEWPORT_VRS_TEXTURE. Equivalent to rendering/vrs/texture.
void viewport_set_vrs_texture(RID viewport, RID texture)
Parameters
viewport_set_vrs_update_mode(RID, int)
Sets the update mode for Variable Rate Shading (VRS) for the viewport. VRS requires the input texture to be converted to the format usable by the VRS method supported by the hardware. The update mode defines how often this happens. If the GPU does not support VRS, or VRS is not enabled, this property is ignored.
If set to RenderingServer.VIEWPORT_VRS_UPDATE_ONCE, the input texture is copied once and the mode is changed to RenderingServer.VIEWPORT_VRS_UPDATE_DISABLED.
void viewport_set_vrs_update_mode(RID viewport, int mode)
Parameters
visibility_notifier_create
Creates a new 3D visibility notifier object and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all visibility_notifier_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
To place in a scene, attach this notifier to an instance using RenderingServer.instance_set_base using the returned RID.
Note: The equivalent node is VisibleOnScreenNotifier3D.
RID visibility_notifier_create
visibility_notifier_set_aabb(RID, AABB)
void visibility_notifier_set_aabb(RID notifier, AABB aabb)
Parameters
visibility_notifier_set_callbacks(RID, Callable, Callable)
void visibility_notifier_set_callbacks(RID notifier, Callable enter_callable, Callable exit_callable)
Parameters
voxel_gi_allocate_data(RID, Transform3D, AABB, Vector3i, PackedByteArray, PackedByteArray, PackedByteArray, PackedInt32Array)
void voxel_gi_allocate_data(RID voxel_gi, Transform3D to_cell_xform, AABB aabb, Vector3i octree_size, PackedByteArray octree_cells, PackedByteArray data_cells, PackedByteArray distance_field, PackedInt32Array level_counts)
Parameters
voxel_gi
RIDto_cell_xform
Transform3Daabb
AABBoctree_size
Vector3ioctree_cells
PackedByteArraydata_cells
PackedByteArraydistance_field
PackedByteArraylevel_counts
PackedInt32Array
voxel_gi_create
Creates a new voxel-based global illumination object and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all voxel_gi_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's RenderingServer.free_rid method.
Note: The equivalent node is VoxelGI.
RID voxel_gi_create
voxel_gi_get_data_cells(RID)
Qualifiers: const
PackedByteArray voxel_gi_get_data_cells(RID voxel_gi)
Parameters
voxel_gi
RID
voxel_gi_get_distance_field(RID)
Qualifiers: const
PackedByteArray voxel_gi_get_distance_field(RID voxel_gi)
Parameters
voxel_gi
RID
voxel_gi_get_level_counts(RID)
Qualifiers: const
PackedInt32Array voxel_gi_get_level_counts(RID voxel_gi)
Parameters
voxel_gi
RID
voxel_gi_get_octree_cells(RID)
Qualifiers: const
PackedByteArray voxel_gi_get_octree_cells(RID voxel_gi)
Parameters
voxel_gi
RID
voxel_gi_get_octree_size(RID)
Qualifiers: const
Vector3i voxel_gi_get_octree_size(RID voxel_gi)
Parameters
voxel_gi
RID
voxel_gi_get_to_cell_xform(RID)
Qualifiers: const
Transform3D voxel_gi_get_to_cell_xform(RID voxel_gi)
Parameters
voxel_gi
RID
voxel_gi_set_baked_exposure_normalization(RID, float)
Used to inform the renderer what exposure normalization value was used while baking the voxel gi. This value will be used and modulated at run time to ensure that the voxel gi maintains a consistent level of exposure even if the scene-wide exposure normalization is changed at run time. For more information see RenderingServer.camera_attributes_set_exposure.
void voxel_gi_set_baked_exposure_normalization(RID voxel_gi, float baked_exposure)
Parameters
voxel_gi_set_bias(RID, float)
void voxel_gi_set_bias(RID voxel_gi, float bias)
Parameters
voxel_gi_set_dynamic_range(RID, float)
Sets the dynamic_range value to use on the specified voxel_gi
's RID.
void voxel_gi_set_dynamic_range(RID voxel_gi, float range)
Parameters
voxel_gi_set_energy(RID, float)
void voxel_gi_set_energy(RID voxel_gi, float energy)
Parameters
voxel_gi_set_interior(RID, bool)
void voxel_gi_set_interior(RID voxel_gi, bool enable)
Parameters
voxel_gi_set_normal_bias(RID, float)
Sets the normal_bias value to use on the specified voxel_gi
's RID.
void voxel_gi_set_normal_bias(RID voxel_gi, float bias)
Parameters
voxel_gi_set_propagation(RID, float)
Sets the propagation value to use on the specified voxel_gi
's RID.
void voxel_gi_set_propagation(RID voxel_gi, float amount)
Parameters
voxel_gi_set_quality(int)
Sets the rendering/global_illumination/voxel_gi/quality value to use when rendering. This parameter is global and cannot be set on a per-VoxelGI basis.
void voxel_gi_set_quality(int quality)
Parameters
quality
int
voxel_gi_set_use_two_bounces(RID, bool)
Sets the use_two_bounces value to use on the specified voxel_gi
's RID.
void voxel_gi_set_use_two_bounces(RID voxel_gi, bool enable)
Parameters
Events
frame_post_draw
Emitted at the end of the frame, after the RenderingServer has finished updating all the Viewports.
signal frame_post_draw
frame_pre_draw
Emitted at the beginning of the frame, before the RenderingServer updates all the Viewports.
signal frame_pre_draw