Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
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¶
Methods¶
bake_render_uv2 ( RID base, RID[] material_overrides, Vector2i image_size ) |
|
void |
call_on_render_thread ( Callable callable ) |
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 ) |
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_orthogonal ( RID camera, float size, float z_near, float z_far ) |
void |
camera_set_perspective ( RID camera, float fovy_degrees, float z_near, float z_far ) |
void |
camera_set_transform ( RID camera, Transform3D transform ) |
void |
camera_set_use_vertical_aspect ( RID camera, bool enable ) |
canvas_create ( ) |
|
void |
canvas_item_add_animation_slice ( RID item, float animation_length, float slice_begin, float slice_end, float offset=0.0 ) |
void |
canvas_item_add_circle ( RID item, Vector2 pos, float radius, Color color ) |
void |
canvas_item_add_clip_ignore ( RID item, bool ignore ) |
void |
canvas_item_add_lcd_texture_rect_region ( RID item, Rect2 rect, RID texture, Rect2 src_rect, Color modulate ) |
void |
canvas_item_add_line ( RID item, Vector2 from, Vector2 to, Color color, float width=-1.0, bool antialiased=false ) |
void |
canvas_item_add_mesh ( RID item, RID mesh, Transform2D transform=Transform2D(1, 0, 0, 1, 0, 0), Color modulate=Color(1, 1, 1, 1), RID texture=RID() ) |
void |
canvas_item_add_msdf_texture_rect_region ( RID item, Rect2 rect, RID texture, Rect2 src_rect, Color modulate=Color(1, 1, 1, 1), int outline_size=0, float px_range=1.0, float scale=1.0 ) |
void |
canvas_item_add_multiline ( RID item, PackedVector2Array points, PackedColorArray colors, float width=-1.0 ) |
void |
canvas_item_add_multimesh ( RID item, RID mesh, RID texture=RID() ) |
void |
canvas_item_add_nine_patch ( RID item, Rect2 rect, Rect2 source, RID texture, Vector2 topleft, Vector2 bottomright, NinePatchAxisMode x_axis_mode=0, NinePatchAxisMode y_axis_mode=0, bool draw_center=true, Color modulate=Color(1, 1, 1, 1) ) |
void |
canvas_item_add_particles ( RID item, RID particles, RID texture ) |
void |
canvas_item_add_polygon ( RID item, PackedVector2Array points, PackedColorArray colors, PackedVector2Array uvs=PackedVector2Array(), RID texture=RID() ) |
void |
canvas_item_add_polyline ( RID item, PackedVector2Array points, PackedColorArray colors, float width=-1.0, bool antialiased=false ) |
void |
canvas_item_add_primitive ( RID item, PackedVector2Array points, PackedColorArray colors, PackedVector2Array uvs, RID texture ) |
void |
canvas_item_add_rect ( RID item, Rect2 rect, Color color ) |
void |
canvas_item_add_set_transform ( RID item, Transform2D transform ) |
void |
canvas_item_add_texture_rect ( RID item, Rect2 rect, RID texture, bool tile=false, Color modulate=Color(1, 1, 1, 1), bool transpose=false ) |
void |
canvas_item_add_texture_rect_region ( RID item, Rect2 rect, RID texture, Rect2 src_rect, Color modulate=Color(1, 1, 1, 1), bool transpose=false, bool clip_uv=true ) |
void |
canvas_item_add_triangle_array ( RID item, PackedInt32Array indices, PackedVector2Array points, PackedColorArray colors, PackedVector2Array uvs=PackedVector2Array(), PackedInt32Array bones=PackedInt32Array(), PackedFloat32Array weights=PackedFloat32Array(), RID texture=RID(), int count=-1 ) |
void |
canvas_item_clear ( RID item ) |
void |
canvas_item_set_canvas_group_mode ( RID item, CanvasGroupMode mode, float clear_margin=5.0, bool fit_empty=false, float fit_margin=0.0, bool blur_mipmaps=false ) |
void |
canvas_item_set_clip ( RID item, bool clip ) |
void |
canvas_item_set_copy_to_backbuffer ( RID item, bool enabled, Rect2 rect ) |
void |
canvas_item_set_custom_rect ( RID item, bool use_custom_rect, Rect2 rect=Rect2(0, 0, 0, 0) ) |
void |
canvas_item_set_default_texture_filter ( RID item, CanvasItemTextureFilter filter ) |
void |