Work in progress

Godot documentation is being updated to reflect the latest changes in version 4.0. Some documentation pages may still state outdated information. This banner will tell you if you're reading one of such pages.

The contents of this page are up to date. If you can 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.

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.

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.

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.

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.

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 )

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_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 )

RID

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 )

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_multimesh ( RID item, RID mesh, RID texture )

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 )

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, int count=-1 )

void

canvas_item_clear ( RID item )

RID

canvas_item_create ( )

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

canvas_item_set_default_texture_repeat ( RID item, CanvasItemTextureRepeat repeat )

void

canvas_item_set_distance_field_mode ( RID item, bool enabled )

void

canvas_item_set_draw_behind_parent ( RID item, bool enabled )

void

canvas_item_set_draw_index ( RID item, int index )

void

canvas_item_set_light_mask ( RID item, int mask )

void

canvas_item_set_material ( RID item, RID material )

void

canvas_item_set_modulate ( RID item, Color color )

void

canvas_item_set_parent ( RID item, RID parent )

void

canvas_item_set_self_modulate ( RID item, Color color )

void

canvas_item_set_sort_children_by_y ( RID item, bool enabled )

void

canvas_item_set_transform ( RID item, Transform2D transform )

void

canvas_item_set_use_parent_material ( RID item, bool enabled )

void

canvas_item_set_visibility_layer ( RID item, int visibility_layer )

void

canvas_item_set_visibility_notifier ( RID item, bool enable, Rect2 area, Callable enter_callable, Callable exit_callable )

void

canvas_item_set_visible ( RID item, bool visible )

void

canvas_item_set_z_as_relative_to_parent ( RID item, bool enabled )

void

canvas_item_set_z_index ( RID item, int z_index )

void

canvas_light_attach_to_canvas ( RID light, RID canvas )

RID

canvas_light_create ( )

void

canvas_light_occluder_attach_to_canvas ( RID occluder, RID canvas )

RID

canvas_light_occluder_create ( )

void

canvas_light_occluder_set_as_sdf_collision ( RID occluder, bool enable )

void

canvas_light_occluder_set_enabled ( RID occluder, bool enabled )

void

canvas_light_occluder_set_light_mask ( RID occluder, int mask )

void

canvas_light_occluder_set_polygon ( RID occluder, RID polygon )

void

canvas_light_occluder_set_transform ( RID occluder, Transform2D transform )

void

canvas_light_set_blend_mode ( RID light, CanvasLightBlendMode mode )

void

canvas_light_set_color ( RID light, Color color )

void

canvas_light_set_enabled ( RID light, bool enabled )

void

canvas_light_set_energy ( RID light, float energy )

void

canvas_light_set_height ( RID light, float height )

void

canvas_light_set_item_cull_mask ( RID light, int mask )

void

canvas_light_set_item_shadow_cull_mask ( RID light, int mask )

void

canvas_light_set_layer_range ( RID light, int min_layer, int max_layer )

void

canvas_light_set_mode ( RID light, CanvasLightMode mode )

void

canvas_light_set_shadow_color ( RID light, Color color )

void

canvas_light_set_shadow_enabled ( RID light, bool enabled )

void

canvas_light_set_shadow_filter ( RID light, CanvasLightShadowFilter filter )

void

canvas_light_set_shadow_smooth ( RID light, float smooth )

void

canvas_light_set_texture ( RID light, RID texture )

void

canvas_light_set_texture_offset ( RID light, Vector2 offset )

void

canvas_light_set_texture_scale ( RID light, float scale )

void

canvas_light_set_transform ( RID light, Transform2D transform )

void

canvas_light_set_z_range ( RID light, int min_z, int max_z )

RID

canvas_occluder_polygon_create ( )

void

canvas_occluder_polygon_set_cull_mode ( RID occluder_polygon, CanvasOccluderPolygonCullMode mode )

void

canvas_occluder_polygon_set_shape ( RID occluder_polygon, PackedVector2Array shape, bool closed )

void

canvas_set_disable_scale ( bool disable )

void

canvas_set_item_mirroring ( RID canvas, RID item, Vector2 mirroring )

void

canvas_set_modulate ( RID canvas, Color color )

void

canvas_set_shadow_texture_size ( int size )

RID

canvas_texture_create ( )

void

canvas_texture_set_channel ( RID canvas_texture, CanvasTextureChannel channel, RID texture )

void

canvas_texture_set_shading_parameters ( RID canvas_texture, Color base_color, float shininess )

void

canvas_texture_set_texture_filter ( RID canvas_texture, CanvasItemTextureFilter filter )

void

canvas_texture_set_texture_repeat ( RID canvas_texture, CanvasItemTextureRepeat repeat )

RenderingDevice

create_local_rendering_device ( ) const

RID

decal_create ( )

void

decal_set_albedo_mix ( RID decal, float albedo_mix )

void

decal_set_cull_mask ( RID decal, int mask )

void

decal_set_distance_fade ( RID decal, bool enabled, float begin, float length )

void

decal_set_emission_energy ( RID decal, float energy )

void

decal_set_fade ( RID decal, float above, float below )

void

decal_set_modulate ( RID decal, Color color )

void

decal_set_normal_fade ( RID decal, float fade )

void

decal_set_size ( RID decal, Vector3 size )

void

decal_set_texture ( RID decal, DecalTexture type, RID texture )

void

decals_set_filter ( DecalFilter filter )

RID

directional_light_create ( )

void

directional_shadow_atlas_set_size ( int size, bool is_16bits )

void

directional_soft_shadow_filter_set_quality ( ShadowQuality quality )

Image

environment_bake_panorama ( RID environment, bool bake_irradiance, Vector2i size )

RID

environment_create ( )

void

environment_glow_set_use_bicubic_upscale ( bool enable )

void

environment_set_adjustment ( RID env, bool enable, float brightness, float contrast, float saturation, bool use_1d_color_correction, RID color_correction )

void

environment_set_ambient_light ( RID env, Color color, EnvironmentAmbientSource ambient=0, float energy=1.0, float sky_contibution=0.0, EnvironmentReflectionSource reflection_source=0 )

void

environment_set_background ( RID env, EnvironmentBG bg )

void

environment_set_bg_color ( RID env, Color color )

void

environment_set_bg_energy ( RID env, float multiplier, float exposure_value )

void

environment_set_canvas_max_layer ( RID env, int max_layer )

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 )

void

environment_set_glow ( RID env, bool enable, PackedFloat32Array levels, float intensity, float strength, float mix, float bloom_threshold, EnvironmentGlowBlendMode blend_mode, float hdr_bleed_threshold, float hdr_bleed_scale, float hdr_luminance_cap, float glow_map_strength, RID glow_map )

void

environment_set_sdfgi ( RID env, bool enable, int cascades, float min_cell_size, EnvironmentSDFGIYScale y_scale, bool use_occlusion, float bounce_feedback, bool read_sky, float energy, float normal_bias, float probe_bias )

void

environment_set_sdfgi_frames_to_converge ( EnvironmentSDFGIFramesToConverge frames )

void

environment_set_sdfgi_frames_to_update_light ( EnvironmentSDFGIFramesToUpdateLight frames )

void

environment_set_sdfgi_ray_count ( EnvironmentSDFGIRayCount ray_count )

void

environment_set_sky ( RID env, RID sky )

void

environment_set_sky_custom_fov ( RID env, float scale )

void

environment_set_sky_orientation ( RID env, Basis orientation )

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 )

void

environment_set_ssao_quality ( EnvironmentSSAOQuality quality, bool half_size, float adaptive_target, int blur_passes, float fadeout_from, float fadeout_to )

void

environment_set_ssil_quality ( EnvironmentSSILQuality quality, bool half_size, float adaptive_target, int blur_passes, float fadeout_from, float fadeout_to )

void

environment_set_ssr ( RID env, bool enable, int max_steps, float fade_in, float fade_out, float depth_tolerance )

void

environment_set_ssr_roughness_quality ( EnvironmentSSRRoughnessQuality quality )

void

environment_set_tonemap ( RID env, EnvironmentToneMapper tone_mapper, float exposure, float white )

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 )

void

environment_set_volumetric_fog_filter_active ( bool active )

void

environment_set_volumetric_fog_volume_size ( int size, int depth )

RID

fog_volume_create ( )

void

fog_volume_set_material ( RID fog_volume, RID material )

void

fog_volume_set_shape ( RID fog_volume, FogVolumeShape shape )

void

fog_volume_set_size ( RID fog_volume, Vector3 size )

void

force_draw ( bool swap_buffers=true, float frame_step=0.0 )

void

force_sync ( )

void

free_rid ( RID rid )

Color

get_default_clear_color ( )

float

get_frame_setup_time_cpu ( ) const

RenderingDevice

get_rendering_device ( ) const

int

get_rendering_info ( RenderingInfo info )

Dictionary[]

get_shader_parameter_list ( RID shader ) const

RID

get_test_cube ( )

RID

get_test_texture ( )

String

get_video_adapter_api_version (