VisualServer

Inherits: Object

Server for anything visible.

Description

Server for anything visible. The visual server is the API backend for everything visible. The whole scene system mounts on it to display.

The visual server is completely opaque, the internals are entirely implementation specific and cannot be accessed.

The visual server can be used to bypass the scene system entirely.

Resources are created using the *_create functions.

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 visual server from a running game, the scenario can be accessed from the scene tree from any Spatial node with Spatial.get_world. 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.

Tutorials

Properties

bool

render_loop_enabled

Methods

void

black_bars_set_images ( RID left, RID top, RID right, RID bottom )

void

black_bars_set_margins ( int left, int top, int right, int bottom )

RID

camera_create ( )

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, Transform transform )

void

camera_set_use_vertical_aspect ( RID camera, bool enable )

RID

canvas_create ( )

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

void

canvas_item_add_multimesh ( RID item, RID mesh, RID texture, RID normal_map )

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 ), RID normal_map )

void

canvas_item_add_particles ( RID item, RID particles, RID texture, RID normal_map )

void

canvas_item_add_polygon ( RID item, PoolVector2Array points, PoolColorArray colors, PoolVector2Array uvs=PoolVector2Array( ), RID texture, RID normal_map, bool antialiased=false )

void

canvas_item_add_polyline ( RID item, PoolVector2Array points, PoolColorArray colors, float width=1.0, bool antialiased=false )

void

canvas_item_add_primitive ( RID item, PoolVector2Array points, PoolColorArray colors, PoolVector2Array uvs, RID texture, float width=1.0, RID normal_map )

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, RID normal_map )

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, RID normal_map, bool clip_uv=true )

void

canvas_item_add_triangle_array ( RID item, PoolIntArray indices, PoolVector2Array points, PoolColorArray colors, PoolVector2Array uvs=PoolVector2Array( ), PoolIntArray bones=PoolIntArray( ), PoolRealArray weights=PoolRealArray( ), RID texture, int count=-1, RID normal_map, bool antialiased=false, bool antialiasing_use_indices=false )

void

canvas_item_clear ( RID item )

RID

canvas_item_create ( )

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_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_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_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_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_scale ( RID light, float scale )

void

canvas_light_set_shadow_buffer_size ( RID light, int size )

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_gradient_length ( RID light, float length )

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_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, PoolVector2Array shape, bool closed )

void

canvas_occluder_polygon_set_shape_as_lines ( RID occluder_polygon, PoolVector2Array shape )

void

canvas_set_item_mirroring ( RID canvas, RID item, Vector2 mirroring )

void

canvas_set_modulate ( RID canvas, Color color )

RID

directional_light_create ( )

void

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

RID

environment_create ( )

void

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

void

environment_set_ambient_light ( RID env, Color color, float energy=1.0, float sky_contibution=0.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 energy )

void

environment_set_canvas_max_layer ( RID env, int max_layer )

void

environment_set_dof_blur_far ( RID env, bool enable, float distance, float transition, float far_amount, EnvironmentDOFBlurQuality quality )

void

environment_set_dof_blur_near ( RID env, bool enable, float distance, float transition, float far_amount, EnvironmentDOFBlurQuality quality )

void

environment_set_fog ( RID env, bool enable, Color color, Color sun_color, float sun_amount )

void

environment_set_fog_depth ( RID env, bool enable, float depth_begin, float depth_end, float depth_curve, bool transmit, float transmit_curve )

void

environment_set_fog_height ( RID env, bool enable, float min_height, float max_height, float height_curve )

void

environment_set_glow ( RID env, bool enable, int level_flags, float intensity, float strength, float bloom_threshold, EnvironmentGlowBlendMode blend_mode, float hdr_bleed_threshold, float hdr_bleed_scale, float hdr_luminance_cap, bool bicubic_upscale, bool high_quality )

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 radius2, float intensity2, float bias, float light_affect, float ao_channel_affect, Color color, EnvironmentSSAOQuality quality, EnvironmentSSAOBlur blur, float bilateral_sharpness )

void

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

void

environment_set_tonemap ( RID env, EnvironmentToneMapper tone_mapper, float exposure, float white, bool auto_exposure, float min_luminance, float max_luminance, float auto_exp_speed, float auto_exp_grey )

void

finish ( )

void

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

void

force_sync ( )

void

free_rid ( RID rid )

int

get_render_info ( RenderInfo info )

RID

get_test_cube ( )

RID

get_test_texture ( )

String

get_video_adapter_name ( ) const

String

get_video_adapter_vendor ( ) const

RID

get_white_texture ( )

RID

gi_probe_create ( )

float

gi_probe_get_bias ( RID probe ) const

AABB

gi_probe_get_bounds ( RID probe ) const

float

gi_probe_get_cell_size ( RID probe ) const

PoolIntArray

gi_probe_get_dynamic_data ( RID probe ) const

int

gi_probe_get_dynamic_range ( RID probe ) const

float

gi_probe_get_energy ( RID probe ) const

float

gi_probe_get_normal_bias ( RID probe ) const

float

gi_probe_get_propagation ( RID probe ) const

Transform

gi_probe_get_to_cell_xform ( RID probe ) const

bool

gi_probe_is_compressed ( RID probe ) const

bool

gi_probe_is_interior ( RID probe ) const

void

gi_probe_set_bias ( RID probe, float bias )

void

gi_probe_set_bounds ( RID probe, AABB bounds )

void

gi_probe_set_cell_size ( RID probe, float range )

void

gi_probe_set_compress ( RID probe, bool enable )

void

gi_probe_set_dynamic_data ( RID probe, PoolIntArray data )

void

gi_probe_set_dynamic_range ( RID probe, int range )

void

gi_probe_set_energy ( RID probe, float energy )

void

gi_probe_set_interior ( RID probe, bool enable )

void

gi_probe_set_normal_bias ( RID probe, float bias )

void

gi_probe_set_propagation ( RID probe, float propagation )

void

gi_probe_set_to_cell_xform ( RID probe, Transform xform )

bool

has_changed ( ChangedPriority queried_priority=0 ) const

bool

has_feature ( Features feature ) const

bool

has_os_feature ( String feature ) const

void

immediate_begin ( RID immediate, PrimitiveType primitive, RID texture )

void

immediate_clear ( RID immediate )

void

immediate_color ( RID immediate, Color color )

RID

immediate_create ( )

void

immediate_end ( RID immediate )

RID

immediate_get_material ( RID immediate ) const

void

immediate_normal ( RID immediate, Vector3 normal )

void

immediate_set_material ( RID immediate, RID material )

void

immediate_tangent ( RID immediate, Plane tangent )

void

immediate_uv ( RID immediate, Vector2 tex_uv )

void

immediate_uv2 ( RID immediate, Vector2 tex_uv )

void

immediate_vertex ( RID immediate, Vector3 vertex )

void

immediate_vertex_2d ( RID immediate, Vector2 vertex )

void

init ( )

void

instance_attach_object_instance_id ( RID instance, int id )

void

instance_attach_skeleton ( RID instance, RID skeleton )

RID

instance_create ( )

RID

instance_create2 ( RID base, RID scenario )

void

instance_geometry_set_as_instance_lod ( RID instance, RID as_lod_of_instance )

void

instance_geometry_set_cast_shadows_setting ( RID instance, ShadowCastingSetting shadow_casting_setting )

void

instance_geometry_set_draw_range ( RID instance, float min, float max, float min_margin, float max_margin )

void

instance_geometry_set_flag ( RID instance, InstanceFlags flag, bool enabled )

void

instance_geometry_set_material_overlay ( RID instance, RID material )

void

instance_geometry_set_material_override ( RID instance, RID material )

void

instance_set_base ( RID instance, RID base )

void

instance_set_blend_shape_weight ( RID instance, int shape, float weight )

void

instance_set_custom_aabb ( RID instance, AABB aabb )

void

instance_set_exterior ( RID instance, bool enabled )

void

instance_set_extra_visibility_margin ( RID instance, float margin )

void

instance_set_layer_mask ( RID instance, int mask )

void

instance_set_scenario ( RID instance, RID scenario )

void

instance_set_surface_material ( RID instance, int surface, RID material )

void

instance_set_transform ( RID instance, Transform transform )

void

instance_set_use_lightmap ( RID instance, RID lightmap_instance, RID lightmap, int lightmap_slice=-1, Rect2 lightmap_uv_rect=Rect2( 0, 0, 1, 1 ) )

void

instance_set_visible ( RID instance, bool visible )

Array

instances_cull_aabb ( AABB aabb, RID scenario ) const

Array

instances_cull_convex ( Array convex, RID scenario ) const

Array

instances_cull_ray ( Vector3 from, Vector3 to, RID scenario ) const

void

light_directional_set_blend_splits ( RID light, bool enable )

void

light_directional_set_shadow_depth_range_mode ( RID light, LightDirectionalShadowDepthRangeMode range_mode )

void

light_directional_set_shadow_mode ( RID light, LightDirectionalShadowMode mode )

void

light_omni_set_shadow_detail ( RID light, LightOmniShadowDetail detail )

void

light_omni_set_shadow_mode ( RID light, LightOmniShadowMode mode )

void

light_set_bake_mode ( RID light, LightBakeMode bake_mode )

void

light_set_color ( RID light, Color color )

void

light_set_cull_mask ( RID light, int mask )

void

light_set_negative ( RID light, bool enable )

void

light_set_param ( RID light, LightParam param, float value )

void

light_set_projector ( RID light, RID texture )

void

light_set_reverse_cull_face_mode ( RID light, bool enabled )

void

light_set_shadow ( RID light, bool enabled )

void

light_set_shadow_color ( RID light, Color color )

void

light_set_use_gi ( RID light, bool enabled )

RID

lightmap_capture_create ( )

AABB

lightmap_capture_get_bounds ( RID capture ) const

float

lightmap_capture_get_energy ( RID capture ) const

PoolByteArray

lightmap_capture_get_octree ( RID capture ) const

int

lightmap_capture_get_octree_cell_subdiv ( RID capture ) const

Transform

lightmap_capture_get_octree_cell_transform ( RID capture ) const

bool

lightmap_capture_is_interior ( RID capture ) const

void

lightmap_capture_set_bounds ( RID capture, AABB bounds )

void

lightmap_capture_set_energy ( RID capture, float energy )

void

lightmap_capture_set_interior ( RID capture, bool interior )

void

lightmap_capture_set_octree ( RID capture, PoolByteArray octree )

void

lightmap_capture_set_octree_cell_subdiv ( RID capture, int subdiv )

void

lightmap_capture_set_octree_cell_transform ( RID capture, Transform xform )

RID

make_sphere_mesh ( int latitudes, int longitudes, float radius )

RID

material_create ( )

Variant

material_get_param ( RID material, String parameter ) const

Variant

material_get_param_default ( RID material, String parameter ) const

RID

material_get_shader ( RID shader_material ) const

void

material_set_line_width ( RID material, float width )

void

material_set_next_pass ( RID material, RID next_material )

void

material_set_param ( RID material, String parameter, Variant value )

void

material_set_render_priority ( RID material, int priority )

void

material_set_shader ( RID shader_material, RID shader )

void

mesh_add_surface_from_arrays ( RID mesh, PrimitiveType primitive, Array arrays, Array blend_shapes=[ ], int compress_format=2194432 )

void

mesh_clear ( RID mesh )

RID

mesh_create ( )

int

mesh_get_blend_shape_count ( RID mesh ) const

BlendShapeMode

mesh_get_blend_shape_mode ( RID mesh ) const

AABB

mesh_get_custom_aabb ( RID mesh ) const

int

mesh_get_surface_count ( RID mesh ) const

void

mesh_remove_surface ( RID mesh, int index )

void

mesh_set_blend_shape_count ( RID mesh, int amount )

void

mesh_set_blend_shape_mode ( RID mesh, BlendShapeMode mode )

void

mesh_set_custom_aabb ( RID mesh, AABB aabb )

AABB

mesh_surface_get_aabb ( RID mesh, int surface ) const

PoolByteArray

mesh_surface_get_array ( RID mesh, int surface ) const

int

mesh_surface_get_array_index_len ( RID mesh, int surface ) const

int

mesh_surface_get_array_len ( RID mesh, int surface ) const

Array

mesh_surface_get_arrays ( RID mesh, int surface ) const

Array

mesh_surface_get_blend_shape_arrays ( RID mesh, int surface ) const

int

mesh_surface_get_format ( RID mesh, int surface ) const

int

mesh_surface_get_format_offset ( int format, int vertex_len, int index_len, int array_index ) const

int

mesh_surface_get_format_stride ( int format, int vertex_len, int index_len, int array_index ) const

PoolByteArray

mesh_surface_get_index_array ( RID mesh, int surface ) const

RID

mesh_surface_get_material ( RID mesh, int surface ) const

PrimitiveType

mesh_surface_get_primitive_type ( RID mesh, int surface ) const

Array

mesh_surface_get_skeleton_aabb ( RID mesh, int surface ) const

void

mesh_surface_set_material ( RID mesh, int surface, RID material )

void

mesh_surface_update_region ( RID mesh, int surface, int offset, PoolByteArray data )

void

multimesh_allocate ( RID multimesh, int instances, MultimeshTransformFormat transform_format, MultimeshColorFormat color_format, MultimeshCustomDataFormat custom_data_format=0 )

RID

multimesh_create ( )

AABB

multimesh_get_aabb ( RID multimesh ) const

int

multimesh_get_instance_count ( RID multimesh ) const

RID

multimesh_get_mesh ( RID multimesh ) const

int

multimesh_get_visible_instances ( RID multimesh ) const

Color

multimesh_instance_get_color ( RID multimesh, int index ) const

Color

multimesh_instance_get_custom_data ( RID multimesh, int index ) const

Transform

multimesh_instance_get_transform ( RID multimesh, int index ) const

Transform2D

multimesh_instance_get_transform_2d ( RID multimesh, int index ) const

void

multimesh_instance_set_color ( RID multimesh, int index, Color color )

void

multimesh_instance_set_custom_data ( RID multimesh, int index, Color custom_data )

void

multimesh_instance_set_transform ( RID multimesh, int index, Transform transform )

void

multimesh_instance_set_transform_2d ( RID multimesh, int index, Transform2D transform )

void

multimesh_set_as_bulk_array ( RID multimesh, PoolRealArray array )

void

multimesh_set_mesh ( RID multimesh, RID mesh )

void

multimesh_set_visible_instances ( RID multimesh, int visible )

RID

omni_light_create ( )

RID

particles_create ( )

AABB

particles_get_current_aabb ( RID particles )

bool

particles_get_emitting ( RID particles )

bool

particles_is_inactive ( RID particles )

void

particles_request_process ( RID particles )

void

particles_restart ( RID particles )

void

particles_set_amount ( RID particles, int amount )

void

particles_set_custom_aabb ( RID particles, AABB aabb )

void

particles_set_draw_order ( RID particles, ParticlesDrawOrder order )

void

particles_set_draw_pass_mesh ( RID particles, int pass, RID mesh )

void

particles_set_draw_passes ( RID particles, int count )

void

particles_set_emission_transform ( RID particles, Transform transform )

void

particles_set_emitting ( RID particles, bool emitting )

void

particles_set_explosiveness_ratio ( RID particles, float ratio )

void

particles_set_fixed_fps ( RID particles, int fps )

void

particles_set_fractional_delta ( RID particles, bool enable )

void

particles_set_lifetime ( RID particles, float lifetime )

void

particles_set_one_shot ( RID particles, bool one_shot )

void

particles_set_pre_process_time ( RID particles, float time )

void

particles_set_process_material ( RID particles, RID material )

void

particles_set_randomness_ratio ( RID particles, float ratio )

void

particles_set_speed_scale ( RID particles, float scale )

void

particles_set_use_local_coordinates ( RID particles, bool enable )

RID

reflection_probe_create ( )

void

reflection_probe_set_as_interior ( RID probe, bool enable )

void

reflection_probe_set_cull_mask ( RID probe, int layers )

void

reflection_probe_set_enable_box_projection ( RID probe, bool enable )

void

reflection_probe_set_enable_shadows ( RID probe, bool enable )

void

reflection_probe_set_extents ( RID probe, Vector3 extents )

void

reflection_probe_set_intensity ( RID probe, float intensity )

void

reflection_probe_set_interior_ambient ( RID probe, Color color )

void

reflection_probe_set_interior_ambient_energy ( RID probe, float energy )

void

reflection_probe_set_interior_ambient_probe_contribution ( RID probe, float contrib )

void

reflection_probe_set_max_distance ( RID probe, float distance )

void

reflection_probe_set_origin_offset ( RID probe, Vector3 offset )

void

reflection_probe_set_update_mode ( RID probe, ReflectionProbeUpdateMode mode )

void

request_frame_drawn_callback ( Object where, String method, Variant userdata )

RID

scenario_create ( )

void

scenario_set_debug ( RID scenario, ScenarioDebugMode debug_mode )

void

scenario_set_environment ( RID scenario, RID environment )

void

scenario_set_fallback_environment ( RID scenario, RID environment )

void

scenario_set_reflection_atlas_size ( RID scenario, int size, int subdiv )

void

set_boot_image ( Image image, Color color, bool scale, bool use_filter=true )

void

set_debug_generate_wireframes ( bool generate )

void

set_default_clear_color ( Color color )

void

set_shader_async_hidden_forbidden ( bool forbidden )

void

set_shader_time_scale ( float scale )

void

set_use_occlusion_culling ( bool enable )

RID

shader_create ( )

String

shader_get_code ( RID shader ) const

RID

shader_get_default_texture_param ( RID shader, String name ) const

Array

shader_get_param_list ( RID shader ) const

void

shader_set_code ( RID shader, String code )

void

shader_set_default_texture_param ( RID shader, String name, RID texture )

void

skeleton_allocate ( RID skeleton, int bones, bool is_2d_skeleton=false )

Transform

skeleton_bone_get_transform ( RID skeleton, int bone ) const

Transform2D

skeleton_bone_get_transform_2d ( RID skeleton, int bone ) const

void

skeleton_bone_set_transform ( RID skeleton, int bone, Transform transform )

void

skeleton_bone_set_transform_2d ( RID skeleton, int bone, Transform2D transform )

RID

skeleton_create ( )

int

skeleton_get_bone_count ( RID skeleton ) const

RID

sky_create ( )

void

sky_set_texture ( RID sky, RID cube_map, int radiance_size )

RID

spot_light_create ( )

void

sync ( )

void

texture_allocate ( RID texture, int width, int height, int depth_3d, Format format, TextureType type, int flags=7 )

void

texture_bind ( RID texture, int number )

RID

texture_create ( )

RID

texture_create_from_image ( Image image, int flags=7 )

Array

texture_debug_usage ( )

Image

texture_get_data ( RID texture, int cube_side=0 ) const

int

texture_get_depth ( RID texture ) const

int

texture_get_flags ( RID texture ) const

Format

texture_get_format ( RID texture ) const

int

texture_get_height ( RID texture ) const

String

texture_get_path ( RID texture ) const

int

texture_get_texid ( RID texture ) const

TextureType

texture_get_type ( RID texture ) const

int

texture_get_width ( RID texture ) const

void

texture_set_data ( RID texture, Image image, int layer=0 )

void

texture_set_data_partial ( RID texture, Image image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_mip, int layer=0 )

void

texture_set_flags ( RID texture, int flags )

void

texture_set_path ( RID texture, String path )

void

texture_set_proxy ( RID proxy, RID base )

void

texture_set_shrink_all_x2_on_set_data ( bool shrink )

void

texture_set_size_override ( RID texture, int width, int height, int depth )

void

textures_keep_original ( bool enable )

void

viewport_attach_camera ( RID viewport, RID camera )

void

viewport_attach_canvas ( RID viewport, RID canvas )

void

viewport_attach_to_screen ( RID viewport, Rect2 rect=Rect2( 0, 0, 0, 0 ), int screen=0 )

RID

viewport_create ( )

void

viewport_detach ( RID viewport )

int

viewport_get_render_info ( RID viewport, ViewportRenderInfo info )

RID

viewport_get_texture ( RID viewport ) const

void

viewport_remove_canvas ( RID viewport, RID canvas )

void

viewport_set_active ( RID viewport, bool active )

void

viewport_set_canvas_stacking ( RID viewport, RID canvas, int layer, int sublayer )

void

viewport_set_canvas_transform ( RID viewport, RID canvas, Transform2D offset )

void

viewport_set_clear_mode ( RID viewport, ViewportClearMode clear_mode )

void

viewport_set_debug_draw ( RID viewport, ViewportDebugDraw draw )

void

viewport_set_disable_3d ( RID viewport, bool disabled )

void

viewport_set_disable_environment ( RID viewport, bool disabled )

void

viewport_set_global_canvas_transform ( RID viewport, Transform2D transform )

void

viewport_set_hdr ( RID viewport, bool enabled )

void

viewport_set_hide_canvas ( RID viewport, bool hidden )

void

viewport_set_hide_scenario ( RID viewport, bool hidden )

void

viewport_set_msaa ( RID viewport, ViewportMSAA msaa )

void

viewport_set_parent_viewport ( RID viewport, RID parent_viewport )

void

viewport_set_render_direct_to_screen ( RID viewport, bool enabled )

void

viewport_set_scenario ( RID viewport, RID scenario )

void

viewport_set_shadow_atlas_quadrant_subdivision ( RID viewport, int quadrant, int subdivision )

void

viewport_set_shadow_atlas_size ( RID viewport, int size )

void

viewport_set_sharpen_intensity ( RID viewport, float intensity )

void

viewport_set_size ( RID viewport, int width, int height )

void

viewport_set_transparent_background ( RID viewport, bool enabled )

void

viewport_set_update_mode ( RID viewport, ViewportUpdateMode update_mode )

void

viewport_set_usage ( RID viewport, ViewportUsage usage )

void

viewport_set_use_32_bpc_depth ( RID viewport, bool enabled )

void

viewport_set_use_arvr ( RID viewport, bool use_arvr )

void

viewport_set_use_debanding ( RID viewport, bool debanding )

void

viewport_set_use_fxaa ( RID viewport, bool fxaa )

void

viewport_set_vflip ( RID viewport, bool enabled )

Signals

  • frame_post_draw ( )

Emitted at the end of the frame, after the VisualServer has finished updating all the Viewports.


  • frame_pre_draw ( )

Emitted at the beginning of the frame, before the VisualServer updates all the Viewports.

Enumerations

enum CubeMapSide:

  • CUBEMAP_LEFT = 0 —- Marks the left side of a cubemap.

  • CUBEMAP_RIGHT = 1 —- Marks the right side of a cubemap.

  • CUBEMAP_BOTTOM = 2 —- Marks the bottom side of a cubemap.

  • CUBEMAP_TOP = 3 —- Marks the top side of a cubemap.

  • CUBEMAP_FRONT = 4 —- Marks the front side of a cubemap.

  • CUBEMAP_BACK = 5 —- Marks the back side of a cubemap.


enum TextureType:

  • TEXTURE_TYPE_2D = 0 —- Normal texture with 2 dimensions, width and height.

  • TEXTURE_TYPE_CUBEMAP = 2 —- Texture made up of six faces, can be looked up with a vec3 in shader.

  • TEXTURE_TYPE_2D_ARRAY = 3 —- An array of 2-dimensional textures.

  • TEXTURE_TYPE_3D = 4 —- A 3-dimensional texture with width, height, and depth.


enum TextureFlags:

  • TEXTURE_FLAG_MIPMAPS = 1 —- Generates mipmaps, which are smaller versions of the same texture to use when zoomed out, keeping the aspect ratio.

  • TEXTURE_FLAG_REPEAT = 2 —- Repeats the texture (instead of clamp to edge).

  • TEXTURE_FLAG_FILTER = 4 —- Uses a magnifying filter, to enable smooth zooming in of the texture.

  • TEXTURE_FLAG_ANISOTROPIC_FILTER = 8 —- Uses anisotropic mipmap filtering. Generates smaller versions of the same texture with different aspect ratios.

This results in better-looking textures when viewed from oblique angles.

  • TEXTURE_FLAG_CONVERT_TO_LINEAR = 16 —- Converts the texture to the sRGB color space.

  • TEXTURE_FLAG_MIRRORED_REPEAT = 32 —- Repeats the texture with alternate sections mirrored.

  • TEXTURE_FLAG_USED_FOR_STREAMING = 2048 —- Texture is a video surface.

  • TEXTURE_FLAGS_DEFAULT = 7 —- Default flags. TEXTURE_FLAG_MIPMAPS, TEXTURE_FLAG_REPEAT and TEXTURE_FLAG_FILTER are enabled.


enum ShaderMode:

  • SHADER_SPATIAL = 0 —- Shader is a 3D shader.

  • SHADER_CANVAS_ITEM = 1 —- Shader is a 2D shader.

  • SHADER_PARTICLES = 2 —- Shader is a particle shader.

  • SHADER_MAX = 3 —- Represents the size of the ShaderMode enum.


enum ArrayType:

  • ARRAY_VERTEX = 0 —- Array is a vertex array.

  • ARRAY_NORMAL = 1 —- Array is a normal array.

  • ARRAY_TANGENT = 2 —- Array is a tangent array.

  • ARRAY_COLOR = 3 —- Array is a color array.

  • ARRAY_TEX_UV = 4 —- Array is an UV coordinates array.

  • ARRAY_TEX_UV2 = 5 —- Array is an UV coordinates array for the second UV coordinates.

  • ARRAY_BONES = 6 —- Array contains bone information.

  • ARRAY_WEIGHTS = 7 —- Array is weight information.

  • ARRAY_INDEX = 8 —- Array is index array.

  • ARRAY_MAX = 9 —- Represents the size of the ArrayType enum.


enum ArrayFormat:

  • ARRAY_FORMAT_VERTEX = 1 —- Flag used to mark a vertex array.

  • ARRAY_FORMAT_NORMAL = 2 —- Flag used to mark a normal array.

  • ARRAY_FORMAT_TANGENT = 4 —- Flag used to mark a tangent array.

  • ARRAY_FORMAT_COLOR = 8 —- Flag used to mark a color array.

  • ARRAY_FORMAT_TEX_UV = 16 —- Flag used to mark an UV coordinates array.

  • ARRAY_FORMAT_TEX_UV2 = 32 —- Flag used to mark an UV coordinates array for the second UV coordinates.

  • ARRAY_FORMAT_BONES = 64 —- Flag used to mark a bone information array.

  • ARRAY_FORMAT_WEIGHTS = 128 —- Flag used to mark a weights array.

  • ARRAY_FORMAT_INDEX = 256 —- Flag used to mark an index array.

  • ARRAY_COMPRESS_VERTEX = 512 —- Flag used to mark a compressed (half float) vertex array.

  • ARRAY_COMPRESS_NORMAL = 1024 —- Flag used to mark a compressed (half float) normal array.

  • ARRAY_COMPRESS_TANGENT = 2048 —- Flag used to mark a compressed (half float) tangent array.

  • ARRAY_COMPRESS_COLOR = 4096 —- Flag used to mark a compressed (half float) color array.

  • ARRAY_COMPRESS_TEX_UV = 8192 —- Flag used to mark a compressed (half float) UV coordinates array.

  • ARRAY_COMPRESS_TEX_UV2 = 16384 —- Flag used to mark a compressed (half float) UV coordinates array for the second UV coordinates.

  • ARRAY_COMPRESS_BONES = 32768 —- Flag used to mark a compressed bone array.

  • ARRAY_COMPRESS_WEIGHTS = 65536 —- Flag used to mark a compressed (half float) weight array.

  • ARRAY_COMPRESS_INDEX = 131072 —- Flag used to mark a compressed index array.

  • ARRAY_FLAG_USE_2D_VERTICES = 262144 —- Flag used to mark that the array contains 2D vertices.

  • ARRAY_FLAG_USE_16_BIT_BONES = 524288 —- Flag used to mark that the array uses 16-bit bones instead of 8-bit.

  • ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION = 2097152 —- Flag used to mark that the array uses an octahedral representation of normal and tangent vectors rather than cartesian.

  • ARRAY_COMPRESS_DEFAULT = 2194432 —- Used to set flags ARRAY_COMPRESS_NORMAL, ARRAY_COMPRESS_TANGENT, ARRAY_COMPRESS_COLOR, ARRAY_COMPRESS_TEX_UV, ARRAY_COMPRESS_TEX_UV2, ARRAY_COMPRESS_WEIGHTS, and ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION quickly.


enum PrimitiveType:

  • PRIMITIVE_POINTS = 0 —- Primitive to draw consists of points.

  • PRIMITIVE_LINES = 1 —- Primitive to draw consists of lines.

  • PRIMITIVE_LINE_STRIP = 2 —- Primitive to draw consists of a line strip from start to end.

  • PRIMITIVE_LINE_LOOP = 3 —- Primitive to draw consists of a line loop (a line strip with a line between the last and the first vertex).

  • PRIMITIVE_TRIANGLES = 4 —- Primitive to draw consists of triangles.

  • PRIMITIVE_TRIANGLE_STRIP = 5 —- Primitive to draw consists of a triangle strip (the last 3 vertices are always combined to make a triangle).

  • PRIMITIVE_TRIANGLE_FAN = 6 —- Primitive to draw consists of a triangle strip (the last 2 vertices are always combined with the first to make a triangle).

  • PRIMITIVE_MAX = 7 —- Represents the size of the PrimitiveType enum.


enum BlendShapeMode:

  • BLEND_SHAPE_MODE_NORMALIZED = 0 —- Blend shapes are normalized.

  • BLEND_SHAPE_MODE_RELATIVE = 1 —- Blend shapes are relative to base weight.


enum LightType:

  • LIGHT_DIRECTIONAL = 0 —- Is a directional (sun) light.

  • LIGHT_OMNI = 1 —- Is an omni light.

  • LIGHT_SPOT = 2 —- Is a spot light.


enum LightParam:

  • LIGHT_PARAM_ENERGY = 0 —- The light’s energy.

  • LIGHT_PARAM_INDIRECT_ENERGY = 1 —- Secondary multiplier used with indirect light (light bounces).

  • LIGHT_PARAM_SIZE = 2 —- The light’s size, currently only used for soft shadows in baked lightmaps.

  • LIGHT_PARAM_SPECULAR = 3 —- The light’s influence on specularity.

  • LIGHT_PARAM_RANGE = 4 —- The light’s range.

  • LIGHT_PARAM_ATTENUATION = 5 —- The light’s attenuation.

  • LIGHT_PARAM_SPOT_ANGLE = 6 —- The spotlight’s angle.

  • LIGHT_PARAM_SPOT_ATTENUATION = 7 —- The spotlight’s attenuation.

  • LIGHT_PARAM_CONTACT_SHADOW_SIZE = 8 —- Scales the shadow color.

  • LIGHT_PARAM_SHADOW_MAX_DISTANCE = 9 —- Max distance that shadows will be rendered.

  • LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET = 10 —- Proportion of shadow atlas occupied by the first split.

  • LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET = 11 —- Proportion of shadow atlas occupied by the second split.

  • LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET = 12 —- Proportion of shadow atlas occupied by the third split. The fourth split occupies the rest.

  • LIGHT_PARAM_SHADOW_NORMAL_BIAS = 13 —- Normal bias used to offset shadow lookup by object normal. Can be used to fix self-shadowing artifacts.

  • LIGHT_PARAM_SHADOW_BIAS = 14 —- Bias the shadow lookup to fix self-shadowing artifacts.

  • LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE = 15 —- Increases bias on further splits to fix self-shadowing that only occurs far away from the camera.

  • LIGHT_PARAM_MAX = 16 —- Represents the size of the LightParam enum.


enum LightBakeMode:

  • LIGHT_BAKE_DISABLED = 0

  • LIGHT_BAKE_INDIRECT = 1

  • LIGHT_BAKE_ALL = 2


enum LightOmniShadowMode:

  • LIGHT_OMNI_SHADOW_DUAL_PARABOLOID = 0 —- Use a dual paraboloid shadow map for omni lights.

  • LIGHT_OMNI_SHADOW_CUBE = 1 —- Use a cubemap shadow map for omni lights. Slower but better quality than dual paraboloid.


enum LightOmniShadowDetail:

  • LIGHT_OMNI_SHADOW_DETAIL_VERTICAL = 0 —- Use more detail vertically when computing shadow map.

  • LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL = 1 —- Use more detail horizontally when computing shadow map.


enum LightDirectionalShadowMode:

  • LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL = 0 —- Use orthogonal shadow projection for directional light.

  • LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS = 1 —- Use 2 splits for shadow projection when using directional light.

  • LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS = 2 —- Use 4 splits for shadow projection when using directional light.


enum LightDirectionalShadowDepthRangeMode:

  • LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE = 0 —- Keeps shadows stable as camera moves but has lower effective resolution.

  • LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED = 1 —- Optimize use of shadow maps, increasing the effective resolution. But may result in shadows moving or flickering slightly.


enum ViewportUpdateMode:

  • VIEWPORT_UPDATE_DISABLED = 0 —- Do not update the viewport.

  • VIEWPORT_UPDATE_ONCE = 1 —- Update the viewport once then set to disabled.

  • VIEWPORT_UPDATE_WHEN_VISIBLE = 2 —- Update the viewport whenever it is visible.

  • VIEWPORT_UPDATE_ALWAYS = 3 —- Always update the viewport.


enum ViewportClearMode:

  • VIEWPORT_CLEAR_ALWAYS = 0 —- The viewport is always cleared before drawing.

  • VIEWPORT_CLEAR_NEVER = 1 —- The viewport is never cleared before drawing.

  • VIEWPORT_CLEAR_ONLY_NEXT_FRAME = 2 —- The viewport is cleared once, then the clear mode is set to VIEWPORT_CLEAR_NEVER.


enum ViewportMSAA:

  • VIEWPORT_MSAA_DISABLED = 0 —- Multisample antialiasing is disabled.

  • VIEWPORT_MSAA_2X = 1 —- Multisample antialiasing is set to 2×.

  • VIEWPORT_MSAA_4X = 2 —- Multisample antialiasing is set to 4×.

  • VIEWPORT_MSAA_8X = 3 —- Multisample antialiasing is set to 8×.

  • VIEWPORT_MSAA_16X = 4 —- Multisample antialiasing is set to 16×.

  • VIEWPORT_MSAA_EXT_2X = 5 —- Multisample antialiasing is set to 2× on external texture. Special mode for GLES2 Android VR (Oculus Quest and Go).

  • VIEWPORT_MSAA_EXT_4X = 6 —- Multisample antialiasing is set to 4× on external texture. Special mode for GLES2 Android VR (Oculus Quest and Go).


enum ViewportUsage:

  • VIEWPORT_USAGE_2D = 0 —- The Viewport does not render 3D but samples.

  • VIEWPORT_USAGE_2D_NO_SAMPLING = 1 —- The Viewport does not render 3D and does not sample.

  • VIEWPORT_USAGE_3D = 2 —- The Viewport renders 3D with effects.

  • VIEWPORT_USAGE_3D_NO_EFFECTS = 3 —- The Viewport renders 3D but without effects.


enum ViewportRenderInfo:

  • VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME = 0 —- Number of objects drawn in a single frame.

  • VIEWPORT_RENDER_INFO_VERTICES_IN_FRAME = 1 —- Number of vertices drawn in a single frame.

  • VIEWPORT_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME = 2 —- Number of material changes during this frame.

  • VIEWPORT_RENDER_INFO_SHADER_CHANGES_IN_FRAME = 3 —- Number of shader changes during this frame.

  • VIEWPORT_RENDER_INFO_SURFACE_CHANGES_IN_FRAME = 4 —- Number of surface changes during this frame.

  • VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME = 5 —- Number of draw calls during this frame.

  • VIEWPORT_RENDER_INFO_2D_ITEMS_IN_FRAME = 6 —- Number of 2d items drawn this frame.

  • VIEWPORT_RENDER_INFO_2D_DRAW_CALLS_IN_FRAME = 7 —- Number of 2d draw calls during this frame.

  • VIEWPORT_RENDER_INFO_MAX = 8 —- Represents the size of the ViewportRenderInfo enum.


enum ViewportDebugDraw:

  • VIEWPORT_DEBUG_DRAW_DISABLED = 0 —- Debug draw is disabled. Default setting.

  • VIEWPORT_DEBUG_DRAW_UNSHADED = 1 —- Debug draw sets objects to unshaded.

  • VIEWPORT_DEBUG_DRAW_OVERDRAW = 2 —- Overwrites clear color to (0,0,0,0).

  • VIEWPORT_DEBUG_DRAW_WIREFRAME = 3 —- Debug draw draws objects in wireframe.


enum ScenarioDebugMode:

  • SCENARIO_DEBUG_DISABLED = 0 —- Do not use a debug mode.

  • SCENARIO_DEBUG_WIREFRAME = 1 —- Draw all objects as wireframe models.

  • SCENARIO_DEBUG_OVERDRAW = 2 —- Draw all objects in a way that displays how much overdraw is occurring. Overdraw occurs when a section of pixels is drawn and shaded and then another object covers it up. To optimize a scene, you should reduce overdraw.

  • SCENARIO_DEBUG_SHADELESS = 3 —- Draw all objects without shading. Equivalent to setting all objects shaders to unshaded.


enum InstanceType:

  • INSTANCE_NONE = 0 —- The instance does not have a type.

  • INSTANCE_MESH = 1 —- The instance is a mesh.

  • INSTANCE_MULTIMESH = 2 —- The instance is a multimesh.

  • INSTANCE_IMMEDIATE = 3 —- The instance is an immediate geometry.

  • INSTANCE_PARTICLES = 4 —- The instance is a particle emitter.

  • INSTANCE_LIGHT = 5 —- The instance is a light.

  • INSTANCE_REFLECTION_PROBE = 6 —- The instance is a reflection probe.

  • INSTANCE_GI_PROBE = 7 —- The instance is a GI probe.

  • INSTANCE_LIGHTMAP_CAPTURE = 8 —- The instance is a lightmap capture.

  • INSTANCE_MAX = 9 —- Represents the size of the InstanceType enum.

  • INSTANCE_GEOMETRY_MASK = 30 —- A combination of the flags of geometry instances (mesh, multimesh, immediate and particles).


enum InstanceFlags:

  • INSTANCE_FLAG_USE_BAKED_LIGHT = 0 —- Allows the instance to be used in baked lighting.

  • INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE = 1 —- When set, manually requests to draw geometry on next frame.

  • INSTANCE_FLAG_MAX = 2 —- Represents the size of the InstanceFlags enum.


enum ShadowCastingSetting:

  • SHADOW_CASTING_SETTING_OFF = 0 —- Disable shadows from this instance.

  • SHADOW_CASTING_SETTING_ON = 1 —- Cast shadows from this instance.

  • SHADOW_CASTING_SETTING_DOUBLE_SIDED = 2 —- Disable backface culling when rendering the shadow of the object. This is slightly slower but may result in more correct shadows.

  • SHADOW_CASTING_SETTING_SHADOWS_ONLY = 3 —- Only render the shadows from the object. The object itself will not be drawn.


enum NinePatchAxisMode:

  • NINE_PATCH_STRETCH = 0 —- The nine patch gets stretched where needed.

  • NINE_PATCH_TILE = 1 —- The nine patch gets filled with tiles where needed.

  • NINE_PATCH_TILE_FIT = 2 —- The nine patch gets filled with tiles where needed and stretches them a bit if needed.


enum CanvasLightMode:

  • CANVAS_LIGHT_MODE_ADD = 0 —- Adds light color additive to the canvas.

  • CANVAS_LIGHT_MODE_SUB = 1 —- Adds light color subtractive to the canvas.

  • CANVAS_LIGHT_MODE_MIX = 2 —- The light adds color depending on transparency.

  • CANVAS_LIGHT_MODE_MASK = 3 —- The light adds color depending on mask.


enum CanvasLightShadowFilter:

  • CANVAS_LIGHT_FILTER_NONE = 0 —- Do not apply a filter to canvas light shadows.

  • CANVAS_LIGHT_FILTER_PCF3 = 1 —- Use PCF3 filtering to filter canvas light shadows.

  • CANVAS_LIGHT_FILTER_PCF5 = 2 —- Use PCF5 filtering to filter canvas light shadows.

  • CANVAS_LIGHT_FILTER_PCF7 = 3 —- Use PCF7 filtering to filter canvas light shadows.

  • CANVAS_LIGHT_FILTER_PCF9 = 4 —- Use PCF9 filtering to filter canvas light shadows.

  • CANVAS_LIGHT_FILTER_PCF13 = 5 —- Use PCF13 filtering to filter canvas light shadows.


enum CanvasOccluderPolygonCullMode:

  • CANVAS_OCCLUDER_POLYGON_CULL_DISABLED = 0 —- Culling of the canvas occluder is disabled.

  • CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE = 1 —- Culling of the canvas occluder is clockwise.

  • CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE = 2 —- Culling of the canvas occluder is counterclockwise.


enum RenderInfo:

  • INFO_OBJECTS_IN_FRAME = 0 —- The amount of objects in the frame.

  • INFO_VERTICES_IN_FRAME = 1 —- The amount of vertices in the frame.

  • INFO_MATERIAL_CHANGES_IN_FRAME = 2 —- The amount of modified materials in the frame.

  • INFO_SHADER_CHANGES_IN_FRAME = 3 —- The amount of shader rebinds in the frame.

  • INFO_SHADER_COMPILES_IN_FRAME = 4 —- The peak amount of shaders that have been under compilation in the frame.

This is useful to know when asynchronous shader compilation has finished for the current shaders on screen.

Note: For complete certainty, only assume there are no outstanding compilations when this value is zero for at least two frames in a row.

Unimplemented in the GLES2 rendering backend, always returns 0.

  • INFO_SURFACE_CHANGES_IN_FRAME = 5 —- The amount of surface changes in the frame.

  • INFO_DRAW_CALLS_IN_FRAME = 6 —- The amount of draw calls in frame.

  • INFO_2D_ITEMS_IN_FRAME = 7 —- The amount of 2d items in the frame.

  • INFO_2D_DRAW_CALLS_IN_FRAME = 8 —- The amount of 2d draw calls in frame.

  • INFO_USAGE_VIDEO_MEM_TOTAL = 9 —- Unimplemented in the GLES2 and GLES3 rendering backends, always returns 0.

  • INFO_VIDEO_MEM_USED = 10 —- The amount of video memory used, i.e. texture and vertex memory combined.

  • INFO_TEXTURE_MEM_USED = 11 —- The amount of texture memory used.

  • INFO_VERTEX_MEM_USED = 12 —- The amount of vertex memory used.


enum Features:

  • FEATURE_SHADERS = 0 —- Hardware supports shaders. This enum is currently unused in Godot 3.x.

  • FEATURE_MULTITHREADED = 1 —- Hardware supports multithreading. This enum is currently unused in Godot 3.x.


enum MultimeshTransformFormat:

  • MULTIMESH_TRANSFORM_2D = 0 —- Use Transform2D to store MultiMesh transform.

  • MULTIMESH_TRANSFORM_3D = 1 —- Use Transform to store MultiMesh transform.


enum MultimeshColorFormat:

  • MULTIMESH_COLOR_NONE = 0 —- MultiMesh does not use per-instance color.

  • MULTIMESH_COLOR_8BIT = 1 —- MultiMesh color uses 8 bits per component. This packs the color into a single float.

  • MULTIMESH_COLOR_FLOAT = 2 —- MultiMesh color uses a float per channel.


enum MultimeshCustomDataFormat:

  • MULTIMESH_CUSTOM_DATA_NONE = 0 —- MultiMesh does not use custom data.

  • MULTIMESH_CUSTOM_DATA_8BIT = 1 —- MultiMesh custom data uses 8 bits per component. This packs the 4-component custom data into a single float.

  • MULTIMESH_CUSTOM_DATA_FLOAT = 2 —- MultiMesh custom data uses a float per component.


enum ReflectionProbeUpdateMode:

  • REFLECTION_PROBE_UPDATE_ONCE = 0 —- Reflection probe will update reflections once and then stop.

  • REFLECTION_PROBE_UPDATE_ALWAYS = 1 —- Reflection probe will update each frame. This mode is necessary to capture moving objects.


enum ParticlesDrawOrder:

  • PARTICLES_DRAW_ORDER_INDEX = 0 —- Draw particles in the order that they appear in the particles array.

  • PARTICLES_DRAW_ORDER_LIFETIME = 1 —- Sort particles based on their lifetime.

  • PARTICLES_DRAW_ORDER_VIEW_DEPTH = 2 —- Sort particles based on their distance to the camera.


enum EnvironmentBG:

  • ENV_BG_CLEAR_COLOR = 0 —- Use the clear color as background.

  • ENV_BG_COLOR = 1 —- Use a specified color as the background.

  • ENV_BG_SKY = 2 —- Use a sky resource for the background.

  • ENV_BG_COLOR_SKY = 3 —- Use a custom color for background, but use a sky for shading and reflections.

  • ENV_BG_CANVAS = 4 —- Use a specified canvas layer as the background. This can be useful for instantiating a 2D scene in a 3D world.

  • ENV_BG_KEEP = 5 —- Do not clear the background, use whatever was rendered last frame as the background.

  • ENV_BG_MAX = 7 —- Represents the size of the EnvironmentBG enum.


enum EnvironmentDOFBlurQuality:

  • ENV_DOF_BLUR_QUALITY_LOW = 0 —- Use lowest blur quality. Fastest, but may look bad.

  • ENV_DOF_BLUR_QUALITY_MEDIUM = 1 —- Use medium blur quality.

  • ENV_DOF_BLUR_QUALITY_HIGH = 2 —- Used highest blur quality. Looks the best, but is the slowest.


enum EnvironmentGlowBlendMode:

  • GLOW_BLEND_MODE_ADDITIVE = 0 —- Add the effect of the glow on top of the scene.

  • GLOW_BLEND_MODE_SCREEN = 1 —- Blends the glow effect with the screen. Does not get as bright as additive.

  • GLOW_BLEND_MODE_SOFTLIGHT = 2 —- Produces a subtle color disturbance around objects.

  • GLOW_BLEND_MODE_REPLACE = 3 —- Shows the glow effect by itself without the underlying scene.


enum EnvironmentToneMapper:

  • ENV_TONE_MAPPER_LINEAR = 0 —- Output color as they came in. This can cause bright lighting to look blown out, with noticeable clipping in the output colors.

  • ENV_TONE_MAPPER_REINHARD = 1 —- Use the Reinhard tonemapper. Performs a variation on rendered pixels’ colors by this formula: color = color / (1 + color). This avoids clipping bright highlights, but the resulting image can look a bit dull.

  • ENV_TONE_MAPPER_FILMIC = 2 —- Use the filmic tonemapper. This avoids clipping bright highlights, with a resulting image that usually looks more vivid than ENV_TONE_MAPPER_REINHARD.

  • ENV_TONE_MAPPER_ACES = 3 —- Use the legacy Godot version of the Academy Color Encoding System tonemapper. Unlike ENV_TONE_MAPPER_ACES_FITTED, this version of ACES does not handle bright lighting in a physically accurate way. ACES typically has a more contrasted output compared to ENV_TONE_MAPPER_REINHARD and ENV_TONE_MAPPER_FILMIC.

Note: This tonemapping operator will be removed in Godot 4.0 in favor of the more accurate ENV_TONE_MAPPER_ACES_FITTED.

  • ENV_TONE_MAPPER_ACES_FITTED = 4 —- Use the Academy Color Encoding System tonemapper. ACES is slightly more expensive than other options, but it handles bright lighting in a more realistic fashion by desaturating it as it becomes brighter. ACES typically has a more contrasted output compared to ENV_TONE_MAPPER_REINHARD and ENV_TONE_MAPPER_FILMIC.

enum EnvironmentSSAOQuality:

  • ENV_SSAO_QUALITY_LOW = 0 —- Lowest quality of screen space ambient occlusion.

  • ENV_SSAO_QUALITY_MEDIUM = 1 —- Medium quality screen space ambient occlusion.

  • ENV_SSAO_QUALITY_HIGH = 2 —- Highest quality screen space ambient occlusion.


enum EnvironmentSSAOBlur:

  • ENV_SSAO_BLUR_DISABLED = 0 —- Disables the blur set for SSAO. Will make SSAO look noisier.

  • ENV_SSAO_BLUR_1x1 = 1 —- Perform a 1x1 blur on the SSAO output.

  • ENV_SSAO_BLUR_2x2 = 2 —- Performs a 2x2 blur on the SSAO output.

  • ENV_SSAO_BLUR_3x3 = 3 —- Performs a 3x3 blur on the SSAO output. Use this for smoothest SSAO.


enum ChangedPriority:

  • CHANGED_PRIORITY_ANY = 0 —- Used to query for any changes that request a redraw, whatever the priority.

  • CHANGED_PRIORITY_LOW = 1 —- Registered changes which have low priority can be optionally prevented from causing editor redraws. Examples might include dynamic shaders (typically using the TIME built-in).

  • CHANGED_PRIORITY_HIGH = 2 —- Registered changes which can cause a redraw default to high priority.

Constants

  • NO_INDEX_ARRAY = -1 —- Marks an error that shows that the index array is empty.

  • ARRAY_WEIGHTS_SIZE = 4 —- Number of weights/bones per vertex.

  • CANVAS_ITEM_Z_MIN = -4096 —- The minimum Z-layer for canvas items.

  • CANVAS_ITEM_Z_MAX = 4096 —- The maximum Z-layer for canvas items.

  • MAX_GLOW_LEVELS = 7 —- Max number of glow levels that can be used with glow post-process effect.

  • MAX_CURSORS = 8 —- Unused enum in Godot 3.x.

  • MATERIAL_RENDER_PRIORITY_MIN = -128 —- The minimum renderpriority of all materials.

  • MATERIAL_RENDER_PRIORITY_MAX = 127 —- The maximum renderpriority of all materials.

Property Descriptions

  • bool render_loop_enabled

Setter

set_render_loop_enabled(value)

Getter

is_render_loop_enabled()

If false, disables rendering completely, but the engine logic is still being processed. You can call force_draw to draw a frame even with rendering disabled.

Method Descriptions

  • void black_bars_set_images ( RID left, RID top, RID right, RID bottom )

Sets images to be rendered in the window margin.


  • void black_bars_set_margins ( int left, int top, int right, int bottom )

Sets margin size, where black bars (or images, if black_bars_set_images was used) are rendered.


  • RID camera_create ( )

Creates a camera and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all camera_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


  • void camera_set_cull_mask ( RID camera, int layers )

Sets the cull mask associated with this camera. The cull mask describes which 3D layers are rendered by this camera. Equivalent to Camera.cull_mask.


  • void camera_set_environment ( RID camera, RID env )

Sets the environment used by this camera. Equivalent to Camera.environment.


Sets camera to use frustum projection. This mode allows adjusting the offset argument to create “tilted frustum” effects.


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_perspective ( RID camera, float fovy_degrees, float z_near, float z_far )

Sets camera to use perspective projection. Objects on the screen becomes smaller when they are far away.


  • void camera_set_transform ( RID camera, Transform transform )

Sets Transform of camera.


  • void camera_set_use_vertical_aspect ( RID camera, bool enable )

If true, preserves the horizontal aspect ratio which is equivalent to Camera.KEEP_WIDTH. If false, preserves the vertical aspect ratio which is equivalent to Camera.KEEP_HEIGHT.


  • RID 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_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


Adds a circle command to the CanvasItem‘s draw commands.


  • void canvas_item_add_clip_ignore ( RID item, bool ignore )

If ignore is true, the VisualServer does not perform clipping.


Adds a line command to the CanvasItem‘s draw commands.


  • 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 normal_map )

Adds a mesh command to the CanvasItem‘s draw commands.


  • void canvas_item_add_multimesh ( RID item, RID mesh, RID texture, RID normal_map )

Adds a MultiMesh to the CanvasItem‘s draw commands. Only affects its aabb at the moment.


Adds a nine patch image to the CanvasItem‘s draw commands.

See NinePatchRect for more explanation.


  • void canvas_item_add_particles ( RID item, RID particles, RID texture, RID normal_map )

Adds a particle system to the CanvasItem‘s draw commands.


Adds a polygon to the CanvasItem‘s draw commands.


Adds a polyline, which is a line from multiple points with a width, to the CanvasItem‘s draw commands.


Adds a primitive to the CanvasItem‘s draw commands.


Adds a rectangle to the CanvasItem‘s draw commands.


  • void canvas_item_add_set_transform ( RID item, Transform2D transform )

Adds a Transform2D command to the CanvasItem‘s draw commands.

This sets the extra_matrix uniform when executed. This affects the later commands of the canvas item.


  • 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, RID normal_map )

Adds a textured rect to the CanvasItem‘s draw commands.


  • 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, RID normal_map, bool clip_uv=true )

Adds a texture rect with region setting to the CanvasItem‘s draw commands.


Adds a triangle array to the CanvasItem‘s draw commands.


  • void canvas_item_clear ( RID item )

Clears the CanvasItem and removes all commands in it.


  • RID canvas_item_create ( )

Creates a new CanvasItem and returns its RID. It can be accessed with the RID that is returned. This RID will be used in all canvas_item_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


  • void canvas_item_set_clip ( RID item, bool clip )

Sets clipping for the CanvasItem.


  • void canvas_item_set_copy_to_backbuffer ( RID item, bool enabled, Rect2 rect )

Sets the CanvasItem to copy a rect to the backbuffer.


  • void canvas_item_set_custom_rect ( RID item, bool use_custom_rect, Rect2 rect=Rect2( 0, 0, 0, 0 ) )

Defines a custom drawing rectangle for the CanvasItem.


  • void canvas_item_set_distance_field_mode ( RID item, bool enabled )

Enables the use of distance fields for GUI elements that are rendering distance field based fonts.


  • void canvas_item_set_draw_behind_parent ( RID item, bool enabled )

Sets CanvasItem to be drawn behind its parent.


  • void canvas_item_set_draw_index ( RID item, int index )

Sets the index for the CanvasItem.


  • void canvas_item_set_light_mask ( RID item, int mask )

The light mask. See LightOccluder2D for more information on light masks.


  • void canvas_item_set_material ( RID item, RID material )

Sets a new material to the CanvasItem.


  • void canvas_item_set_modulate ( RID item, Color color )

Sets the color that modulates the CanvasItem and its children.


  • void canvas_item_set_parent ( RID item, RID parent )

Sets the parent for the CanvasItem. The parent can be another canvas item, or it can be the root canvas that is attached to the viewport.


  • void canvas_item_set_self_modulate ( RID item, Color color )

Sets the color that modulates the CanvasItem without children.


  • void canvas_item_set_sort_children_by_y ( RID item, bool enabled )

Sets if CanvasItem‘s children should be sorted by y-position.


Sets the CanvasItem‘s Transform2D.


  • void canvas_item_set_use_parent_material ( RID item, bool enabled )

Sets if the CanvasItem uses its parent’s material.


  • void canvas_item_set_visible ( RID item, bool visible )

Sets if the canvas item (including its children) is visible.


  • void canvas_item_set_z_as_relative_to_parent ( RID item, bool enabled )

If this is enabled, the Z index of the parent will be added to the children’s Z index.


  • void canvas_item_set_z_index ( RID item, int z_index )

Sets the CanvasItem‘s Z index, i.e. its draw order (lower indexes are drawn first).


  • void canvas_light_attach_to_canvas ( RID light, RID canvas )

Attaches the canvas light to the canvas. Removes it from its previous canvas.


  • RID canvas_light_create ( )

Creates a canvas light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_light_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


  • void canvas_light_occluder_attach_to_canvas ( RID occluder, RID canvas )

Attaches a light occluder to the canvas. Removes it from its previous canvas.


  • RID canvas_light_occluder_create ( )

Creates a light occluder and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_light_ocluder_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


  • void canvas_light_occluder_set_enabled ( RID occluder, bool enabled )

Enables or disables light occluder.


  • void canvas_light_occluder_set_light_mask ( RID occluder, int mask )

The light mask. See LightOccluder2D for more information on light masks.


  • void canvas_light_occluder_set_polygon ( RID occluder, RID polygon )

Sets a light occluder’s polygon.


  • void canvas_light_occluder_set_transform ( RID occluder, Transform2D transform )

Sets a light occluder’s Transform2D.


  • void canvas_light_set_color ( RID light, Color color )

Sets the color for a light.


  • void canvas_light_set_enabled ( RID light, bool enabled )

Enables or disables a canvas light.


  • void canvas_light_set_energy ( RID light, float energy )

Sets a canvas light’s energy.


  • void canvas_light_set_height ( RID light, float height )

Sets a canvas light’s height.


  • void canvas_light_set_item_cull_mask ( RID light, int mask )

The light mask. See LightOccluder2D for more information on light masks.


  • void canvas_light_set_item_shadow_cull_mask ( RID light, int mask )

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_layer_range ( RID light, int min_layer, int max_layer )

The layer range that gets rendered with this light.


The mode of the light, see CanvasLightMode constants.


  • void canvas_light_set_scale ( RID light, float scale )

Sets the texture’s scale factor of the light. Equivalent to Light2D.texture_scale.


  • void canvas_light_set_shadow_buffer_size ( RID light, int size )

Sets the width of the shadow buffer, size gets scaled to the next power of two for this.


  • void canvas_light_set_shadow_color ( RID light, Color color )

Sets the color of the canvas light’s shadow.


  • void canvas_light_set_shadow_enabled ( RID light, bool enabled )

Enables or disables the canvas light’s shadow.


Sets the canvas light’s shadow’s filter, see CanvasLightShadowFilter constants.


  • void canvas_light_set_shadow_gradient_length ( RID light, float length )

Sets the length of the shadow’s gradient.


  • void canvas_light_set_shadow_smooth ( RID light, float smooth )

Smoothens the shadow. The lower, the smoother.


  • void canvas_light_set_texture ( RID light, RID texture )

Sets texture to be used by light. Equivalent to Light2D.texture.


  • void canvas_light_set_texture_offset ( RID light, Vector2 offset )

Sets the offset of the light’s texture. Equivalent to Light2D.offset.


Sets the canvas light’s Transform2D.


  • void canvas_light_set_z_range ( RID light, int min_z, int max_z )

Sets the Z range of objects that will be affected by this light. Equivalent to Light2D.range_z_min and Light2D.range_z_max.


  • RID canvas_occluder_polygon_create ( )

Creates a new light occluder polygon and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_occluder_polygon_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


Sets an occluder polygons cull mode. See CanvasOccluderPolygonCullMode constants.


Sets the shape of the occluder polygon.


  • void canvas_occluder_polygon_set_shape_as_lines ( RID occluder_polygon, PoolVector2Array shape )

Sets the shape of the occluder polygon as lines.


  • void canvas_set_item_mirroring ( RID canvas, RID item, Vector2 mirroring )

A copy of the canvas item will be drawn with a local offset of the mirroring Vector2.


  • void canvas_set_modulate ( RID canvas, Color color )

Modulates all colors in the given canvas.


  • RID directional_light_create ( )

Creates a directional light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most light_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

To place in a scene, attach this directional light to an instance using instance_set_base using the returned RID.


  • void draw ( bool swap_buffers=true, float frame_step=0.0 )

Draws a frame. This method is deprecated, please use force_draw instead.


  • RID environment_create ( )

Creates an environment and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all environment_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


Sets the values to be used with the “Adjustment” post-process effect. See Environment for more details.


  • void environment_set_ambient_light ( RID env, Color color, float energy=1.0, float sky_contibution=0.0 )

Sets the ambient light parameters. See Environment for more details.


Sets the BGMode of the environment. Equivalent to Environment.background_mode.


  • void environment_set_bg_color ( RID env, Color color )

Color displayed for clear areas of the scene (if using Custom color or Color+Sky background modes).


  • void environment_set_bg_energy ( RID env, float energy )

Sets the intensity of the background color.


  • void environment_set_canvas_max_layer ( RID env, int max_layer )

Sets the maximum layer to use if using Canvas background mode.


Sets the values to be used with the “DoF Far Blur” post-process effect. See Environment for more details.


Sets the values to be used with the “DoF Near Blur” post-process effect. See Environment for more details.


Sets the variables to be used with the scene fog. See Environment for more details.


Sets the variables to be used with the fog depth effect. See Environment for more details.


  • void environment_set_fog_height ( RID env, bool enable, float min_height, float max_height, float height_curve )

Sets the variables to be used with the fog height effect. See Environment for more details.


Sets the variables to be used with the “glow” post-process effect. See Environment for more details.


  • void environment_set_sky ( RID env, RID sky )

Sets the Sky to be used as the environment’s background when using BGMode sky. Equivalent to Environment.background_sky.


  • void environment_set_sky_custom_fov ( RID env, float scale )

Sets a custom field of view for the background Sky. Equivalent to Environment.background_sky_custom_fov.


  • void environment_set_sky_orientation ( RID env, Basis orientation )

Sets the rotation of the background Sky expressed as a Basis. Equivalent to Environment.background_sky_orientation.


Sets the variables to be used with the “Screen Space Ambient Occlusion (SSAO)” post-process effect. See Environment for more details.


Sets the variables to be used with the “screen space reflections” post-process effect. See Environment for more details.


Sets the variables to be used with the “tonemap” post-process effect. See Environment for more details.


  • void finish ( )

Removes buffers and clears testcubes.


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

Forces a frame to be drawn when the function is called. Drawing a frame updates all Viewports that are set to update. Use with extreme caution.


  • void force_sync ( )

Synchronizes threads.


  • void free_rid ( RID rid )

Tries to free an object in the VisualServer.


Returns a certain information, see RenderInfo for options.


  • RID get_test_cube ( )

Returns the id of the test cube. Creates one if none exists.


  • RID get_test_texture ( )

Returns the id of the test texture. Creates one if none exists.


  • String get_video_adapter_name ( ) 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.


  • String get_video_adapter_vendor ( ) 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.


  • RID get_white_texture ( )

Returns the id of a white texture. Creates one if none exists.


  • RID gi_probe_create ( )

Creates a GI probe and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all gi_probe_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

To place in a scene, attach this GI probe to an instance using instance_set_base using the returned RID.


  • float gi_probe_get_bias ( RID probe ) const

Returns the bias value for the GI probe. Bias is used to avoid self occlusion. Equivalent to GIProbeData.bias.


  • AABB gi_probe_get_bounds ( RID probe ) const

Returns the axis-aligned bounding box that covers the full extent of the GI probe.


  • float gi_probe_get_cell_size ( RID probe ) const

Returns the cell size set by gi_probe_set_cell_size.


Returns the data used by the GI probe.


  • int gi_probe_get_dynamic_range ( RID probe ) const

Returns the dynamic range set for this GI probe. Equivalent to GIProbe.dynamic_range.


  • float gi_probe_get_energy ( RID probe ) const

Returns the energy multiplier for this GI probe. Equivalent to GIProbe.energy.


  • float gi_probe_get_normal_bias ( RID probe ) const

Returns the normal bias for this GI probe. Equivalent to GIProbe.normal_bias.


  • float gi_probe_get_propagation ( RID probe ) const

Returns the propagation value for this GI probe. Equivalent to GIProbe.propagation.


Returns the Transform set by gi_probe_set_to_cell_xform.


  • bool gi_probe_is_compressed ( RID probe ) const

Returns true if the GI probe data associated with this GI probe is compressed. Equivalent to GIProbe.compress.


  • bool gi_probe_is_interior ( RID probe ) const

Returns true if the GI probe is set to interior, meaning it does not account for sky light. Equivalent to GIProbe.interior.


  • void gi_probe_set_bias ( RID probe, float bias )

Sets the bias value to avoid self-occlusion. Equivalent to GIProbe.bias.


  • void gi_probe_set_bounds ( RID probe, AABB bounds )

Sets the axis-aligned bounding box that covers the extent of the GI probe.


  • void gi_probe_set_cell_size ( RID probe, float range )

Sets the size of individual cells within the GI probe.


  • void gi_probe_set_compress ( RID probe, bool enable )

Sets the compression setting for the GI probe data. Compressed data will take up less space but may look worse. Equivalent to GIProbe.compress.


Sets the data to be used in the GI probe for lighting calculations. Normally this is created and called internally within the GIProbe node. You should not try to set this yourself.


  • void gi_probe_set_dynamic_range ( RID probe, int range )

Sets the dynamic range of the GI probe. Dynamic range sets the limit for how bright lights can be. A smaller range captures greater detail but limits how bright lights can be. Equivalent to GIProbe.dynamic_range.


  • void gi_probe_set_energy ( RID probe, float energy )

Sets the energy multiplier for this GI probe. A higher energy makes the indirect light from the GI probe brighter. Equivalent to GIProbe.energy.


  • void gi_probe_set_interior ( RID probe, bool enable )

Sets the interior value of this GI probe. A GI probe set to interior does not include the sky when calculating lighting. Equivalent to GIProbe.interior.


  • void gi_probe_set_normal_bias ( RID probe, float bias )

Sets the normal bias for this GI probe. Normal bias behaves similar to the other form of bias and may help reduce self-occlusion. Equivalent to GIProbe.normal_bias.


  • void gi_probe_set_propagation ( RID probe, float propagation )

Sets the propagation of light within this GI probe. Equivalent to GIProbe.propagation.


  • void gi_probe_set_to_cell_xform ( RID probe, Transform xform )

Sets the to cell Transform for this GI probe.


Returns true if changes have been made to the VisualServer’s data. draw is usually called if this happens.

As changes are registered as either high or low priority (e.g. dynamic shaders), this function takes an optional argument to query either low or high priority changes, or any changes.


Not yet implemented. Always returns false.


Returns true if the OS supports a certain feature. Features might be s3tc, etc, etc2, pvrtc and skinning_fallback.

When rendering with GLES2, returns true with skinning_fallback in case the hardware doesn’t support the default GPU skinning process.


Sets up ImmediateGeometry internals to prepare for drawing. Equivalent to ImmediateGeometry.begin.


  • void immediate_clear ( RID immediate )

Clears everything that was set up between immediate_begin and immediate_end. Equivalent to ImmediateGeometry.clear.


  • void immediate_color ( RID immediate, Color color )

Sets the color to be used with next vertex. Equivalent to ImmediateGeometry.set_color.


  • RID immediate_create ( )

Creates an immediate geometry and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all immediate_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

To place in a scene, attach this immediate geometry to an instance using instance_set_base using the returned RID.


  • void immediate_end ( RID immediate )

Ends drawing the ImmediateGeometry and displays it. Equivalent to ImmediateGeometry.end.


  • RID immediate_get_material ( RID immediate ) const

Returns the material assigned to the ImmediateGeometry.


  • void immediate_normal ( RID immediate, Vector3 normal )

Sets the normal to be used with next vertex. Equivalent to ImmediateGeometry.set_normal.


  • void immediate_set_material ( RID immediate, RID material )

Sets the material to be used to draw the ImmediateGeometry.


  • void immediate_tangent ( RID immediate, Plane tangent )

Sets the tangent to be used with next vertex. Equivalent to ImmediateGeometry.set_tangent.


  • void immediate_uv ( RID immediate, Vector2 tex_uv )

Sets the UV to be used with next vertex. Equivalent to ImmediateGeometry.set_uv.


  • void immediate_uv2 ( RID immediate, Vector2 tex_uv )

Sets the UV2 to be used with next vertex. Equivalent to ImmediateGeometry.set_uv2.


  • void immediate_vertex ( RID immediate, Vector3 vertex )

Adds the next vertex using the information provided in advance. Equivalent to ImmediateGeometry.add_vertex.


  • void immediate_vertex_2d ( RID immediate, Vector2 vertex )

Adds the next vertex using the information provided in advance. This is a helper class that calls immediate_vertex under the hood. Equivalent to ImmediateGeometry.add_vertex.


  • void init ( )

Initializes the visual server. This function is called internally by platform-dependent code during engine initialization. If called from a running game, it will not do anything.


  • void instance_attach_object_instance_id ( RID instance, int id )

Attaches a unique Object ID to instance. Object ID must be attached to instance for proper culling with instances_cull_aabb, instances_cull_convex, and instances_cull_ray.


  • void instance_attach_skeleton ( RID instance, RID skeleton )

Attaches a skeleton to an instance. Removes the previous skeleton from the instance.


  • RID instance_create ( )

Creates a visual instance and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all instance_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

An instance is a way of placing a 3D object in the scenario. Objects like particles, meshes, and reflection probes need to be associated with an instance to be visible in the scenario using instance_set_base.


  • RID instance_create2 ( RID base, RID scenario )

Creates a visual instance, adds it to the VisualServer, and sets both base and scenario. It can be accessed with the RID that is returned. This RID will be used in all instance_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


  • void instance_geometry_set_as_instance_lod ( RID instance, RID as_lod_of_instance )

Not implemented in Godot 3.x.


Sets the shadow casting setting to one of ShadowCastingSetting. Equivalent to GeometryInstance.cast_shadow.


Not implemented in Godot 3.x.


Sets the flag for a given InstanceFlags. See InstanceFlags for more details.


  • void instance_geometry_set_material_overlay ( RID instance, RID material )

Sets a material that will be rendered for all surfaces on top of active materials for the mesh associated with this instance. Equivalent to GeometryInstance.material_overlay.


  • void instance_geometry_set_material_override ( RID instance, RID material )

Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to GeometryInstance.material_override.


  • void instance_set_base ( RID instance, RID base )

Sets the base of the instance. A base can be any of the 3D objects that are created in the VisualServer that can be displayed. For example, any of the light types, mesh, multimesh, immediate geometry, particle system, reflection probe, lightmap capture, and the GI probe are all types that can be set as the base of an instance in order to be displayed in the scenario.


  • void instance_set_blend_shape_weight ( RID instance, int shape, float weight )

Sets the weight for a given blend shape associated with this instance.


  • void instance_set_custom_aabb ( RID instance, AABB aabb )

Sets a custom AABB to use when culling objects from the view frustum. Equivalent to GeometryInstance.set_custom_aabb.


  • void instance_set_exterior ( RID instance, bool enabled )

Function not implemented in Godot 3.x.


  • void instance_set_extra_visibility_margin ( RID instance, float margin )

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 GeometryInstance.extra_cull_margin.


  • void instance_set_layer_mask ( RID instance, int mask )

Sets the render layers that this instance will be drawn to. Equivalent to VisualInstance.layers.


  • void instance_set_scenario ( RID instance, RID scenario )

Sets the scenario that the instance is in. The scenario is the 3D world that the objects will be displayed in.


  • void instance_set_surface_material ( RID instance, int surface, RID material )

Sets the material of a specific surface. Equivalent to MeshInstance.set_surface_material.


  • void instance_set_transform ( RID instance, Transform transform )

Sets the world space transform of the instance. Equivalent to Spatial.transform.


  • void instance_set_use_lightmap ( RID instance, RID lightmap_instance, RID lightmap, int lightmap_slice=-1, Rect2 lightmap_uv_rect=Rect2( 0, 0, 1, 1 ) )

Sets the lightmap to use with this instance.


  • void instance_set_visible ( RID instance, bool visible )

Sets whether an instance is drawn or not. Equivalent to Spatial.visible.


  • Array instances_cull_aabb ( AABB aabb, RID scenario ) const

Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as MeshInstance or DirectionalLight. Use @GDScript.instance_from_id to obtain the actual nodes. A scenario RID must be provided, which is available in the World you want to query. This forces an update for all resources queued to update.

Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.


  • Array instances_cull_convex ( Array convex, RID scenario ) const

Returns an array of object IDs intersecting with the provided convex shape. Only visual 3D nodes are considered, such as MeshInstance or DirectionalLight. Use @GDScript.instance_from_id to obtain the actual nodes. A scenario RID must be provided, which is available in the World you want to query. This forces an update for all resources queued to update.

Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.


Returns an array of object IDs intersecting with the provided 3D ray. Only visual 3D nodes are considered, such as MeshInstance or DirectionalLight. Use @GDScript.instance_from_id to obtain the actual nodes. A scenario RID must be provided, which is available in the World you want to query. This forces an update for all resources queued to update.

Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.


  • void light_directional_set_blend_splits ( RID light, bool enable )

If true, this directional light will blend between shadow map splits resulting in a smoother transition between them. Equivalent to DirectionalLight.directional_shadow_blend_splits.


Sets the shadow depth range mode for this directional light. Equivalent to DirectionalLight.directional_shadow_depth_range. See LightDirectionalShadowDepthRangeMode for options.


Sets the shadow mode for this directional light. Equivalent to DirectionalLight.directional_shadow_mode. See LightDirectionalShadowMode for options.


Sets whether to use vertical or horizontal detail for this omni light. This can be used to alleviate artifacts in the shadow map. Equivalent to OmniLight.omni_shadow_detail.


Sets whether to use a dual paraboloid or a cubemap for the shadow map. Dual paraboloid is faster but may suffer from artifacts. Equivalent to OmniLight.omni_shadow_mode.


Sets the bake mode for this light, see LightBakeMode for options. The bake mode affects how the light will be baked in BakedLightmaps and GIProbes.


  • void light_set_color ( RID light, Color color )

Sets the color of the light. Equivalent to Light.light_color.


  • void light_set_cull_mask ( RID light, int mask )

Sets the cull mask for this Light. Lights only affect objects in the selected layers. Equivalent to Light.light_cull_mask.


  • void light_set_negative ( RID light, bool enable )

If true, light will subtract light instead of adding light. Equivalent to Light.light_negative.


Sets the specified light parameter. See LightParam for options. Equivalent to Light.set_param.


  • void light_set_projector ( RID light, RID texture )

Not implemented in Godot 3.x.


  • void light_set_reverse_cull_face_mode ( RID light, bool enabled )

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 instance_geometry_set_cast_shadows_setting. Equivalent to Light.shadow_reverse_cull_face.


  • void light_set_shadow ( RID light, bool enabled )

If true, light will cast shadows. Equivalent to Light.shadow_enabled.


  • void light_set_shadow_color ( RID light, Color color )

Sets the color of the shadow cast by the light. Equivalent to Light.shadow_color.


  • void light_set_use_gi ( RID light, bool enabled )

Sets whether GI probes capture light information from this light. Deprecated method. Use light_set_bake_mode instead. This method is only kept for compatibility reasons and calls light_set_bake_mode internally, setting the bake mode to LIGHT_BAKE_DISABLED or LIGHT_BAKE_INDIRECT depending on the given parameter.


  • RID lightmap_capture_create ( )

Creates a lightmap capture and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all lightmap_capture_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

To place in a scene, attach this lightmap capture to an instance using instance_set_base using the returned RID.


  • AABB lightmap_capture_get_bounds ( RID capture ) const

Returns the size of the lightmap capture area.


  • float lightmap_capture_get_energy ( RID capture ) const

Returns the energy multiplier used by the lightmap capture.


Returns the octree used by the lightmap capture.


  • int lightmap_capture_get_octree_cell_subdiv ( RID capture ) const

Returns the cell subdivision amount used by this lightmap capture’s octree.


  • Transform lightmap_capture_get_octree_cell_transform ( RID capture ) const

Returns the cell transform for this lightmap capture’s octree.


  • bool lightmap_capture_is_interior ( RID capture ) const

Returns true if capture is in “interior” mode.


  • void lightmap_capture_set_bounds ( RID capture, AABB bounds )

Sets the size of the area covered by the lightmap capture. Equivalent to BakedLightmapData.bounds.


  • void lightmap_capture_set_energy ( RID capture, float energy )

Sets the energy multiplier for this lightmap capture. Equivalent to BakedLightmapData.energy.


  • void lightmap_capture_set_interior ( RID capture, bool interior )

Sets the “interior” mode for this lightmap capture. Equivalent to BakedLightmapData.interior.


Sets the octree to be used by this lightmap capture. This function is normally used by the BakedLightmap node. Equivalent to BakedLightmapData.octree.


  • void lightmap_capture_set_octree_cell_subdiv ( RID capture, int subdiv )

Sets the subdivision level of this lightmap capture’s octree. Equivalent to BakedLightmapData.cell_subdiv.


  • void lightmap_capture_set_octree_cell_transform ( RID capture, Transform xform )

Sets the octree cell transform for this lightmap capture’s octree. Equivalent to BakedLightmapData.cell_space_transform.


Returns a mesh of a sphere with the given amount of horizontal and vertical subdivisions.


  • RID material_create ( )

Creates an empty material and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all material_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


Returns the value of a certain material’s parameter.


Returns the default value for the param if available. Returns null otherwise.


  • RID material_get_shader ( RID shader_material ) const

Returns the shader of a certain material’s shader. Returns an empty RID if the material doesn’t have a shader.


  • void material_set_line_width ( RID material, float width )

Sets a material’s line width.


  • void material_set_next_pass ( RID material, RID next_material )

Sets an object’s next material.


Sets a material’s parameter.


  • void material_set_render_priority ( RID material, int priority )

Sets a material’s render priority.


  • void material_set_shader ( RID shader_material, RID shader )

Sets a shader material’s shader.


Adds a surface generated from the Arrays to a mesh. See PrimitiveType constants for types.


  • void mesh_clear ( RID mesh )

Removes all surfaces from a mesh.


  • RID mesh_create ( )

Creates a new mesh and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all mesh_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

To place in a scene, attach this mesh to an instance using instance_set_base using the returned RID.


  • int mesh_get_blend_shape_count ( RID mesh ) const

Returns a mesh’s blend shape count.


Returns a mesh’s blend shape mode.


  • AABB mesh_get_custom_aabb ( RID mesh ) const

Returns a mesh’s custom aabb.


  • int mesh_get_surface_count ( RID mesh ) const

Returns a mesh’s number of surfaces.


  • void mesh_remove_surface ( RID mesh, int index )

Removes a mesh’s surface.


  • void mesh_set_blend_shape_count ( RID mesh, int amount )

Sets a mesh’s blend shape count.


Sets a mesh’s blend shape mode.


  • void mesh_set_custom_aabb ( RID mesh, AABB aabb )

Sets a mesh’s custom aabb.


  • AABB mesh_surface_get_aabb ( RID mesh, int surface ) const

Returns a mesh’s surface’s aabb.


Returns a mesh’s surface’s vertex buffer.


  • int mesh_surface_get_array_index_len ( RID mesh, int surface ) const

Returns a mesh’s surface’s amount of indices.


  • int mesh_surface_get_array_len ( RID mesh, int surface ) const

Returns a mesh’s surface’s amount of vertices.


  • Array mesh_surface_get_arrays ( RID mesh, int surface ) const

Returns a mesh’s surface’s buffer arrays.


  • Array mesh_surface_get_blend_shape_arrays ( RID mesh, int surface ) const

Returns a mesh’s surface’s arrays for blend shapes.


  • int mesh_surface_get_format ( RID mesh, int surface ) const

Returns the format of a mesh’s surface.


  • int mesh_surface_get_format_offset ( int format, int vertex_len, int index_len, int array_index ) const

Function is unused in Godot 3.x.


  • int mesh_surface_get_format_stride ( int format, int vertex_len, int index_len, int array_index ) const

Returns a mesh’s surface’s index buffer.


  • RID mesh_surface_get_material ( RID mesh, int surface ) const

Returns a mesh’s surface’s material.


Returns the primitive type of a mesh’s surface.


  • Array mesh_surface_get_skeleton_aabb ( RID mesh, int surface ) const

Returns the aabb of a mesh’s surface’s skeleton.


  • void mesh_surface_set_material ( RID mesh, int surface, RID material )

Sets a mesh’s surface’s material.


Updates a specific region of a vertex buffer for the specified surface. Warning: this function alters the vertex buffer directly with no safety mechanisms, you can easily corrupt your mesh.


Allocates space for the multimesh data. Format parameters determine how the data will be stored by OpenGL. See MultimeshTransformFormat, MultimeshColorFormat, and MultimeshCustomDataFormat for usage. Equivalent to MultiMesh.instance_count.


  • RID multimesh_create ( )

Creates a new multimesh on the VisualServer and returns an RID handle. This RID will be used in all multimesh_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

To place in a scene, attach this multimesh to an instance using instance_set_base using the returned RID.


  • AABB multimesh_get_aabb ( RID multimesh ) const

Calculates and returns the axis-aligned bounding box that encloses all instances within the multimesh.


  • int multimesh_get_instance_count ( RID multimesh ) const

Returns the number of instances allocated for this multimesh.


  • RID multimesh_get_mesh ( RID multimesh ) const

Returns the RID of the mesh that will be used in drawing this multimesh.


  • int multimesh_get_visible_instances ( RID multimesh ) const

Returns the number of visible instances for this multimesh.


  • Color multimesh_instance_get_color ( RID multimesh, int index ) const

Returns the color by which the specified instance will be modulated.


  • Color multimesh_instance_get_custom_data ( RID multimesh, int index ) const

Returns the custom data associated with the specified instance.


  • Transform multimesh_instance_get_transform ( RID multimesh, int index ) const

Returns the Transform of the specified instance.


Returns the Transform2D of the specified instance. For use when the multimesh is set to use 2D transforms.


  • void multimesh_instance_set_color ( RID multimesh, int index, Color color )

Sets the color by which this instance will be modulated. Equivalent to MultiMesh.set_instance_color.


  • void multimesh_instance_set_custom_data ( RID multimesh, int index, Color custom_data )

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_transform ( RID multimesh, int index, Transform transform )

Sets the Transform for this instance. Equivalent to MultiMesh.set_instance_transform.


  • void multimesh_instance_set_transform_2d ( RID multimesh, int index, Transform2D transform )

Sets the Transform2D for this instance. For use when multimesh is used in 2D. Equivalent to MultiMesh.set_instance_transform_2d.


Sets all data related to the instances in one go. This is especially useful when loading the data from disk or preparing the data from GDNative.

All data is packed in one large float array. An array may look like this: Transform for instance 1, color data for instance 1, custom data for instance 1, transform for instance 2, color data for instance 2, etc.

Transform is stored as 12 floats, Transform2D is stored as 8 floats, COLOR_8BIT / CUSTOM_DATA_8BIT is stored as 1 float (4 bytes as is) and COLOR_FLOAT / CUSTOM_DATA_FLOAT is stored as 4 floats.


  • void multimesh_set_mesh ( RID multimesh, RID mesh )

Sets the mesh to be drawn by the multimesh. Equivalent to MultiMesh.mesh.


  • void multimesh_set_visible_instances ( RID multimesh, int visible )

Sets the number of instances visible at a given time. If -1, all instances that have been allocated are drawn. Equivalent to MultiMesh.visible_instance_count.


  • RID omni_light_create ( )

Creates a new omni light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most light_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

To place in a scene, attach this omni light to an instance using instance_set_base using the returned RID.


  • RID particles_create ( )

Creates a particle system and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all particles_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

To place in a scene, attach these particles to an instance using instance_set_base using the returned RID.


  • AABB particles_get_current_aabb ( RID particles )

Calculates and returns the axis-aligned bounding box that contains all the particles. Equivalent to Particles.capture_aabb.


  • bool particles_get_emitting ( RID particles )

Returns true if particles are currently set to emitting.


  • bool particles_is_inactive ( RID particles )

Returns true if particles are not emitting and particles are set to inactive.


  • void particles_request_process ( RID particles )

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 instances_cull_aabb, instances_cull_convex, or instances_cull_ray.


  • void particles_restart ( RID particles )

Reset the particles on the next update. Equivalent to Particles.restart.


  • void particles_set_amount ( RID particles, int amount )

Sets the number of particles to be drawn and allocates the memory for them. Equivalent to Particles.amount.


  • void particles_set_custom_aabb ( RID particles, AABB aabb )

Sets a custom axis-aligned bounding box for the particle system. Equivalent to Particles.visibility_aabb.


Sets the draw order of the particles to one of the named enums from ParticlesDrawOrder. See ParticlesDrawOrder for options. Equivalent to Particles.draw_order.


  • void particles_set_draw_pass_mesh ( RID particles, int pass, RID mesh )

Sets the mesh to be used for the specified draw pass. Equivalent to Particles.draw_pass_1, Particles.draw_pass_2, Particles.draw_pass_3, and Particles.draw_pass_4.


  • void particles_set_draw_passes ( RID particles, int count )

Sets the number of draw passes to use. Equivalent to Particles.draw_passes.


  • void particles_set_emission_transform ( RID particles, Transform transform )

Sets the Transform that will be used by the particles when they first emit.


  • void particles_set_emitting ( RID particles, bool emitting )

If true, particles will emit over time. Setting to false does not reset the particles, but only stops their emission. Equivalent to Particles.emitting.


  • void particles_set_explosiveness_ratio ( RID particles, float ratio )

Sets the explosiveness ratio. Equivalent to Particles.explosiveness.


  • void particles_set_fixed_fps ( RID particles, int fps )

Sets the frame rate that the particle system rendering will be fixed to. Equivalent to Particles.fixed_fps.


  • void particles_set_fractional_delta ( RID particles, bool enable )

If true, uses fractional delta which smooths the movement of the particles. Equivalent to Particles.fract_delta.


  • void particles_set_lifetime ( RID particles, float lifetime )

Sets the lifetime of each particle in the system. Equivalent to Particles.lifetime.


  • void particles_set_one_shot ( RID particles, bool one_shot )

If true, particles will emit once and then stop. Equivalent to Particles.one_shot.


  • void particles_set_pre_process_time ( RID particles, float time )

Sets the preprocess time for the particles’ animation. This lets you delay starting an animation until after the particles have begun emitting. Equivalent to Particles.preprocess.


  • void particles_set_process_material ( RID particles, RID material )

Sets the material for processing the particles.

Note: This is not the material used to draw the materials. Equivalent to Particles.process_material.


  • void particles_set_randomness_ratio ( RID particles, float ratio )

Sets the emission randomness ratio. This randomizes the emission of particles within their phase. Equivalent to Particles.randomness.


  • void particles_set_speed_scale ( RID particles, float scale )

Sets the speed scale of the particle system. Equivalent to Particles.speed_scale.


  • void particles_set_use_local_coordinates ( RID particles, bool enable )

If true, particles use local coordinates. If false they use global coordinates. Equivalent to Particles.local_coords.


  • RID reflection_probe_create ( )

Creates a reflection probe and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all reflection_probe_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

To place in a scene, attach this reflection probe to an instance using instance_set_base using the returned RID.


  • void reflection_probe_set_as_interior ( RID probe, bool enable )

If true, reflections will ignore sky contribution. Equivalent to ReflectionProbe.interior_enable.


  • void reflection_probe_set_cull_mask ( RID probe, int layers )

Sets the render cull mask for this reflection probe. Only instances with a matching cull mask will be rendered by this probe. Equivalent to ReflectionProbe.cull_mask.


  • void reflection_probe_set_enable_box_projection ( RID probe, bool enable )

If true, uses box projection. This can make reflections look more correct in certain situations. Equivalent to ReflectionProbe.box_projection.


  • void reflection_probe_set_enable_shadows ( RID probe, bool enable )

If true, computes shadows in the reflection probe. This makes the reflection much slower to compute. Equivalent to ReflectionProbe.enable_shadows.


  • void reflection_probe_set_extents ( RID probe, Vector3 extents )

Sets the size of the area that the reflection probe will capture. Equivalent to ReflectionProbe.extents.


  • void reflection_probe_set_intensity ( RID probe, float intensity )

Sets the intensity of the reflection probe. Intensity modulates the strength of the reflection. Equivalent to ReflectionProbe.intensity.


  • void reflection_probe_set_interior_ambient ( RID probe, Color color )

Sets the ambient light color for this reflection probe when set to interior mode. Equivalent to ReflectionProbe.interior_ambient_color.


  • void reflection_probe_set_interior_ambient_energy ( RID probe, float energy )

Sets the energy multiplier for this reflection probes ambient light contribution when set to interior mode. Equivalent to ReflectionProbe.interior_ambient_energy.


  • void reflection_probe_set_interior_ambient_probe_contribution ( RID probe, float contrib )

Sets the contribution value for how much the reflection affects the ambient light for this reflection probe when set to interior mode. Useful so that ambient light matches the color of the room. Equivalent to ReflectionProbe.interior_ambient_contrib.


  • void reflection_probe_set_max_distance ( RID probe, float distance )

Sets the max distance away from the probe an object can be before it is culled. Equivalent to ReflectionProbe.max_distance.


  • void reflection_probe_set_origin_offset ( RID probe, Vector3 offset )

Sets the origin offset to be used when this reflection probe is in box project mode. Equivalent to ReflectionProbe.origin_offset.


Sets how often the reflection probe updates. Can either be once or every frame. See ReflectionProbeUpdateMode for options.


Schedules a callback to the corresponding named method on where after a frame has been drawn.

The callback method must use only 1 argument which will be called with userdata.


  • RID scenario_create ( )

Creates a scenario and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all scenario_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

The scenario is the 3D world that all the visual instances exist in.


Sets the ScenarioDebugMode for this scenario. See ScenarioDebugMode for options.


  • void scenario_set_environment ( RID scenario, RID environment )

Sets the environment that will be used with this scenario.


  • void scenario_set_fallback_environment ( RID scenario, RID environment )

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_reflection_atlas_size ( RID scenario, int size, int subdiv )

Sets the size of the reflection atlas shared by all reflection probes in this scenario.


Sets a boot image. The color defines the background color. If 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_debug_generate_wireframes ( bool generate )

If true, the engine will generate wireframes for use with the wireframe debug mode.


  • void set_default_clear_color ( Color color )

Sets the default clear color which is used when a specific clear color has not been selected.


  • void set_shader_async_hidden_forbidden ( bool forbidden )

If asynchronous shader compilation is enabled, this controls whether SpatialMaterial.ASYNC_MODE_HIDDEN is obeyed.

For instance, you may want to enable this temporarily before taking a screenshot. This ensures everything is visible even if shaders with async mode hidden are not ready yet.

Reflection probes use this internally to ensure they capture everything regardless the shaders are ready or not.


  • void set_shader_time_scale ( float scale )

Sets the scale to apply to the passage of time for the shaders’ TIME builtin.

The default value is 1.0, which means TIME will count the real time as it goes by, without narrowing or stretching it.


  • void set_use_occlusion_culling ( bool enable )

Enables or disables occlusion culling.


  • RID shader_create ( )

Creates an empty shader and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all shader_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


Returns a shader’s code.


  • RID shader_get_default_texture_param ( RID shader, String name ) const

Returns a default texture from a shader searched by name.


  • Array shader_get_param_list ( RID shader ) const

Returns the parameters of a shader.


  • void shader_set_code ( RID shader, String code )

Sets a shader’s code.


  • void shader_set_default_texture_param ( RID shader, String name, RID texture )

Sets a shader’s default texture. Overwrites the texture given by name.


  • void skeleton_allocate ( RID skeleton, int bones, bool is_2d_skeleton=false )

Allocates the GPU buffers for this skeleton.


Returns the Transform set for a specific bone of this skeleton.


Returns the Transform2D set for a specific bone of this skeleton.


  • void skeleton_bone_set_transform ( RID skeleton, int bone, Transform transform )

Sets the Transform for a specific bone of this skeleton.


  • void skeleton_bone_set_transform_2d ( RID skeleton, int bone, Transform2D transform )

Sets the Transform2D for a specific bone of this skeleton.


  • RID skeleton_create ( )

Creates a skeleton and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all skeleton_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


  • int skeleton_get_bone_count ( RID skeleton ) const

Returns the number of bones allocated for this skeleton.


  • RID sky_create ( )

Creates an empty sky and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all sky_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


  • void sky_set_texture ( RID sky, RID cube_map, int radiance_size )

Sets a sky’s texture.


  • RID spot_light_create ( )

Creates a spot light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID can be used in most light_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.

To place in a scene, attach this spot light to an instance using instance_set_base using the returned RID.


  • void sync ( )

Not implemented in Godot 3.x.


Allocates the GPU memory for the texture.


  • void texture_bind ( RID texture, int number )

Binds the texture to a texture slot.


  • RID texture_create ( )

Creates an empty texture and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all texture_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


  • RID texture_create_from_image ( Image image, int flags=7 )

Creates a texture, allocates the space for an image, and fills in the image.


  • Array texture_debug_usage ( )

Returns a list of all the textures and their information.


  • Image texture_get_data ( RID texture, int cube_side=0 ) const

Returns a copy of a texture’s image unless it’s a CubeMap, in which case it returns the RID of the image at one of the cubes sides.


  • int texture_get_depth ( RID texture ) const

Returns the depth of the texture.


  • int texture_get_flags ( RID texture ) const

Returns the flags of a texture.


  • Format texture_get_format ( RID texture ) const

Returns the format of the texture’s image.


  • int texture_get_height ( RID texture ) const

Returns the texture’s height.


  • String texture_get_path ( RID texture ) const

Returns the texture’s path.


  • int texture_get_texid ( RID texture ) const

Returns the opengl id of the texture’s image.


Returns the type of the texture, can be any of the TextureType.


  • int texture_get_width ( RID texture ) const

Returns the texture’s width.


  • void texture_set_data ( RID texture, Image image, int layer=0 )

Sets the texture’s image data. If it’s a CubeMap, it sets the image data at a cube side.


Sets a part of the data for a texture. Warning: this function calls the underlying graphics API directly and may corrupt your texture if used improperly.


  • void texture_set_flags ( RID texture, int flags )

Sets the texture’s flags. See TextureFlags for options.


  • void texture_set_path ( RID texture, String path )

Sets the texture’s path.


  • void texture_set_proxy ( RID proxy, RID base )

Creates an update link between two textures, similar to how ViewportTextures operate. When the base texture is the texture of a Viewport, every time the viewport renders a new frame, the proxy texture automatically receives an update.

For example, this code links a generic ImageTexture to the texture output of the Viewport using the VisualServer API:

  1. func _ready():
  2. var viewport_rid = get_viewport().get_viewport_rid()
  3. var viewport_texture_rid = VisualServer.viewport_get_texture(viewport_rid)
  4. var proxy_texture = ImageTexture.new()
  5. var viewport_texture_image_data = VisualServer.texture_get_data(viewport_texture_rid)
  6. proxy_texture.create_from_image(viewport_texture_image_data)
  7. var proxy_texture_rid = proxy_texture.get_rid()
  8. VisualServer.texture_set_proxy(proxy_texture_rid, viewport_texture_rid)
  9. $TextureRect.texture = proxy_texture

  • void texture_set_shrink_all_x2_on_set_data ( bool shrink )

If true, sets internal processes to shrink all image data to half the size.


  • void texture_set_size_override ( RID texture, int width, int height, int depth )

Resizes the texture to the specified dimensions.


  • void textures_keep_original ( bool enable )

If true, the image will be stored in the texture’s images array if overwritten.


  • void viewport_attach_camera ( RID viewport, RID camera )

Sets a viewport’s camera.


  • void viewport_attach_canvas ( RID viewport, RID canvas )

Sets a viewport’s canvas.


  • void viewport_attach_to_screen ( RID viewport, Rect2 rect=Rect2( 0, 0, 0, 0 ), int screen=0 )

Copies viewport to a region of the screen specified by rect. If Viewport.render_direct_to_screen is true, then viewport does not use a framebuffer and the contents of the viewport are rendered directly to screen. However, note that the root viewport is drawn last, therefore it will draw over the screen. Accordingly, you must set the root viewport to an area that does not cover the area that you have attached this viewport to.

For example, you can set the root viewport to not render at all with the following code:

  1. func _ready():
  2. get_viewport().set_attach_to_screen_rect(Rect2())
  3. $Viewport.set_attach_to_screen_rect(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 viewport_set_render_direct_to_screen.


  • RID viewport_create ( )

Creates an empty viewport and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all viewport_* VisualServer functions.

Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.


  • void viewport_detach ( RID viewport )

Detaches the viewport from the screen.


Returns a viewport’s render information. For options, see the ViewportRenderInfo constants.


  • RID viewport_get_texture ( RID viewport ) const

Returns the viewport’s last rendered frame.


  • void viewport_remove_canvas ( RID viewport, RID canvas )

Detaches a viewport from a canvas and vice versa.


  • void viewport_set_active ( RID viewport, bool active )

If true, sets the viewport active, else sets it inactive.


  • void viewport_set_canvas_stacking ( RID viewport, RID canvas, int layer, int sublayer )

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.


Sets the transformation of a viewport’s canvas.


Sets the clear mode of a viewport. See ViewportClearMode for options.


Sets the debug draw mode of a viewport. See ViewportDebugDraw for options.


  • void viewport_set_disable_3d ( RID viewport, bool disabled )

If true, a viewport’s 3D rendering is disabled.


  • void viewport_set_disable_environment ( RID viewport, bool disabled )

If true, rendering of a viewport’s environment is disabled.


  • void viewport_set_global_canvas_transform ( RID viewport, Transform2D transform )

Sets the viewport’s global transformation matrix.


  • void viewport_set_hdr ( RID viewport, bool enabled )

If true, the viewport renders to high dynamic range (HDR) instead of standard dynamic range (SDR). See also viewport_set_use_32_bpc_depth.

Note: Only available on the GLES3 backend.


  • void viewport_set_hide_canvas ( RID viewport, bool hidden )

If true, the viewport’s canvas is not rendered.


  • void viewport_set_hide_scenario ( RID viewport, bool hidden )

Currently unimplemented in Godot 3.x.


Sets the anti-aliasing mode. See ViewportMSAA for options.


  • void viewport_set_parent_viewport ( RID viewport, RID parent_viewport )

Sets the viewport’s parent to another viewport.


  • void viewport_set_render_direct_to_screen ( RID viewport, bool enabled )

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_scenario ( RID viewport, RID scenario )

Sets a viewport’s scenario.

The scenario contains information about the ScenarioDebugMode, environment information, reflection atlas etc.


  • void viewport_set_shadow_atlas_quadrant_subdivision ( RID viewport, int quadrant, int subdivision )

Sets the shadow atlas quadrant’s subdivision.


  • void viewport_set_shadow_atlas_size ( RID viewport, int size )

Sets the size of the shadow atlas’s images (used for omni and spot lights). The value will be rounded up to the nearest power of 2.


  • void viewport_set_sharpen_intensity ( RID viewport, float intensity )

Sets the sharpening intensity for the viewport. If set to a value greater than 0.0, contrast-adaptive sharpening will be applied to the 3D viewport. This has a low performance cost and can be used to recover some of the sharpness lost from using FXAA. Values around 0.5 generally give the best results. See also viewport_set_use_fxaa.


  • void viewport_set_size ( RID viewport, int width, int height )

Sets the viewport’s width and height.


  • void viewport_set_transparent_background ( RID viewport, bool enabled )

If true, the viewport renders its background as transparent.


Sets when the viewport should be updated. See ViewportUpdateMode constants for options.


Sets the viewport’s 2D/3D mode. See ViewportUsage constants for options.


  • void viewport_set_use_32_bpc_depth ( RID viewport, bool enabled )

If true, allocates the viewport’s framebuffer with full floating-point precision (32-bit) instead of half floating-point precision (16-bit). Only effective if viewport_set_use_32_bpc_depth is used on the same Viewport to set HDR to true.

Note: Only available on the GLES3 backend.


  • void viewport_set_use_arvr ( RID viewport, bool use_arvr )

If true, the viewport uses augmented or virtual reality technologies. See ARVRInterface.


  • void viewport_set_use_debanding ( RID viewport, bool debanding )

If true, uses a fast post-processing filter to make banding significantly less visible. In some cases, debanding may introduce a slightly noticeable dithering pattern. It’s recommended to enable debanding only when actually needed since the dithering pattern will make lossless-compressed screenshots larger.

Note: Only available on the GLES3 backend. Viewport.hdr must also be true for debanding to be effective.


  • void viewport_set_use_fxaa ( RID viewport, bool fxaa )

Enables fast approximate antialiasing for this viewport. FXAA is a popular screen-space antialiasing method, which is fast but will make the image look blurry, especially at lower resolutions. It can still work relatively well at large resolutions such as 1440p and 4K. Some of the lost sharpness can be recovered by enabling contrast-adaptive sharpening (see viewport_set_sharpen_intensity).


  • void viewport_set_vflip ( RID viewport, bool enabled )

If true, the viewport’s rendering is flipped vertically.