Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

RenderingServer

Inherits: Object

Server for anything visible.

Description

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 viewport_set_scenario or 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 Node3D.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 instance_set_base. The instance must also be attached to the scenario using 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.

Tutorials

Properties

bool

render_loop_enabled

Methods

Image[]

bake_render_uv2 ( RID base, RID[] material_overrides, Vector2i image_size )

void

call_on_render_thread ( Callable callable )

RID

camera_attributes_create ( )

void

camera_attributes_set_auto_exposure ( RID camera_attributes, bool enable, float min_sensitivity, float max_sensitivity, float speed, float scale )

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 )

void

camera_attributes_set_dof_blur_bokeh_shape ( DOFBokehShape shape )

void

camera_attributes_set_dof_blur_quality ( DOFBlurQuality quality, bool use_jitter )

void

camera_attributes_set_exposure ( RID camera_attributes, float multiplier, float normalization )

RID

camera_create ( )

void

camera_set_camera_attributes ( RID camera, RID effects )

void

camera_set_cull_mask ( RID camera, int layers )

void

camera_set_environment ( RID camera, RID env )

void

camera_set_frustum ( RID camera, float size, Vector2 offset, float z_near, float z_far )

void

camera_set_orthogona