Server for anything visible.
Server for anything visible. The rendering server is the API backend for everything visible. The whole scene system mounts on it to display.
The rendering server is completely opaque, the internals are entirely implementation specific and cannot be accessed.
The rendering server can be used to bypass the scene system entirely.
Resources are created using the [code]*_create[/code] functions.
All objects are drawn to a viewport. You can use the [Viewport] attached to the [SceneTree] or you can create one yourself with [method viewport_create]. When using a custom scenario or canvas, the scenario or canvas needs to be attached to the viewport using [method viewport_set_scenario] or [method viewport_attach_canvas].
In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the rendering server from a running game, the scenario can be accessed from the scene tree from any [Node3D] node with [method Node3D.get_world_3d]. Otherwise, a scenario can be created with [method 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 [method instance_set_base]. The instance must also be attached to the scenario using [method 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.
https://docs.godotengine.org/en/latest/tutorials/performance/using_servers.html
Creates a camera and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]camera_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Sets the cull mask associated with this camera. The cull mask describes which 3D layers are rendered by this camera. Equivalent to [member Camera3D.cull_mask].
Sets the environment used by this camera. Equivalent to [member Camera3D.environment].
Sets camera to use frustum projection. This mode allows adjusting the [code]offset[/code] 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.
Sets camera to use perspective projection. Objects on the screen becomes smaller when they are far away.
Sets [Transform3D] of camera.
If [code]true[/code], preserves the horizontal aspect ratio which is equivalent to [constant Camera3D.KEEP_WIDTH]. If [code]false[/code], preserves the vertical aspect ratio which is equivalent to [constant Camera3D.KEEP_HEIGHT].
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 [code]canvas_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Clears the [CanvasItem] and removes all commands in it.
Sets the [CanvasItem] to copy a rect to the backbuffer.
Sets the index for the [CanvasItem].
Sets a new material to the [CanvasItem].
Sets if the [CanvasItem] uses its parent's material.
If this is enabled, the Z index of the parent will be added to the children's Z index.
Sets the [CanvasItem]'s Z index, i.e. its draw order (lower indexes are drawn first).
Attaches the canvas light to the canvas. Removes it from its previous canvas.
Creates a canvas light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Attaches a light occluder to the canvas. Removes it from its previous canvas.
Creates a light occluder and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_light_ocluder_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Enables or disables light occluder.
The light mask. See [LightOccluder2D] for more information on light masks.
Sets a light occluder's polygon.
Sets a light occluder's [Transform2D].
Sets the color for a light.
Enables or disables a canvas light.
Sets a canvas light's energy.
Sets a canvas light's height.
The light mask. See [LightOccluder2D] for more information on light masks.
The binary mask used to determine which layers this canvas light's shadows affects. See [LightOccluder2D] for more information on light masks.
The layer range that gets rendered with this light.
The mode of the light, see [enum CanvasLightMode] constants.
Sets the color of the canvas light's shadow.
Enables or disables the canvas light's shadow.
Sets the canvas light's shadow's filter, see [enum CanvasLightShadowFilter] constants.
Smoothens the shadow. The lower, the smoother.
Sets the texture to be used by a [PointLight2D]. Equivalent to [member PointLight2D.texture].
Sets the offset of a [PointLight2D]'s texture. Equivalent to [member PointLight2D.offset].
Sets the scale factor of a [PointLight2D]'s texture. Equivalent to [member PointLight2D.texture_scale].
Sets the canvas light's [Transform2D].
Sets the Z range of objects that will be affected by this light. Equivalent to [member Light2D.range_z_min] and [member Light2D.range_z_max].
Creates a new light occluder polygon and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]canvas_occluder_polygon_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Sets an occluder polygons cull mode. See [enum CanvasOccluderPolygonCullMode] constants.
Sets the shape of the occluder polygon.
A copy of the canvas item will be drawn with a local offset of the mirroring [Vector2].
Modulates all colors in the given canvas.
Creates a directional light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this directional light to an instance using [method instance_set_base] using the returned RID.
Creates an environment and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]environment_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Sets the values to be used with the "Adjustment" post-process effect. See [Environment] for more details.
Sets the [i]BGMode[/i] of the environment. Equivalent to [member Environment.background_mode].
Color displayed for clear areas of the scene (if using Custom color or Color+Sky background modes).
Sets the intensity of the background color.
Sets the maximum layer to use if using Canvas background mode.
Sets the [Sky] to be used as the environment's background when using [i]BGMode[/i] sky. Equivalent to [member Environment.sky].
Sets a custom field of view for the background [Sky]. Equivalent to [member Environment.sky_custom_fov].
Sets the rotation of the background [Sky] expressed as a [Basis]. Equivalent to [member Environment.sky_rotation], where the rotation vector is used to construct the [Basis].
Sets the variables to be used with the "screen space ambient occlusion" 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.
Enables filtering of the volumetric fog scattering buffer. This results in much smoother volumes with very few under-sampling artifacts.
Sets the resolution of the volumetric fog's froxel buffer. [code]size[/code] is modified by the screen's aspect ratio and then used to set the width and height of the buffer. While [code]depth[/code] is directly used to set the depth of the buffer.
Creates a new fog volume and allocates an RID.
Sets the size of the fog volume when shape is [constant FOG_VOLUME_SHAPE_ELLIPSOID] or [constant FOG_VOLUME_SHAPE_BOX].
Sets the [Material] of the fog volume. Can be either a [FogMaterial] or a custom [ShaderMaterial].
Sets the shape of the fog volume to either [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_BOX], or [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID] or [constant RenderingServer.FOG_VOLUME_SHAPE_WORLD].
Tries to free an object in the RenderingServer.
Returns the id of the test cube. Creates one if none exists.
Returns the id of the test texture. Creates one if none exists.
Returns the name of the video adapter (e.g. "GeForce GTX 1080/PCIe/SSE2").
[b]Note:[/b] When running a headless or server binary, this function returns an empty string.
Returns the vendor of the video adapter (e.g. "NVIDIA Corporation").
[b]Note:[/b] When running a headless or server binary, this function returns an empty string.
Returns the id of a white texture. Creates one if none exists.
Returns [code]true[/code] if changes have been made to the RenderingServer's data. [method force_draw] is usually called if this happens.
Not yet implemented. Always returns [code]false[/code].
Returns [code]true[/code] if the OS supports a certain feature. Features might be [code]s3tc[/code], [code]etc[/code], [code]etc2[/code] and [code]pvrtc[/code].
Attaches a unique Object ID to instance. Object ID must be attached to instance for proper culling with [method instances_cull_aabb], [method instances_cull_convex], and [method instances_cull_ray].
Attaches a skeleton to an instance. Removes the previous skeleton from the instance.
Creates a visual instance and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method 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 [method instance_set_base].
Creates a visual instance, adds it to the RenderingServer, and sets both base and scenario. It can be accessed with the RID that is returned. This RID will be used in all [code]instance_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Sets the shadow casting setting to one of [enum ShadowCastingSetting]. Equivalent to [member GeometryInstance3D.cast_shadow].
Sets the flag for a given [enum InstanceFlags]. See [enum InstanceFlags] for more details.
Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to [member GeometryInstance3D.material_override].
Sets the transparency for the given geometry instance. Equivalent to [member GeometryInstance3D.transparency].
Sets the visibility range values for the given geometry instance. Equivalent to [member GeometryInstance3D.visibility_range_begin] and related properties.
Sets the base of the instance. A base can be any of the 3D objects that are created in the RenderingServer that can be displayed. For example, any of the light types, mesh, multimesh, immediate geometry, particle system, reflection probe, lightmap, 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.
Sets the weight for a given blend shape associated with this instance.
Sets a custom AABB to use when culling objects from the view frustum. Equivalent to [method GeometryInstance3D.set_custom_aabb].
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 [member GeometryInstance3D.extra_cull_margin].
Sets the render layers that this instance will be drawn to. Equivalent to [member VisualInstance3D.layers].
Sets the scenario that the instance is in. The scenario is the 3D world that the objects will be displayed in.
Sets the override material of a specific surface. Equivalent to [method MeshInstance3D.set_surface_override_material].
Sets the world space transform of the instance. Equivalent to [member Node3D.transform].
Sets the visibility parent for the given instance. Equivalent to [member Node3D.visibility_parent].
Sets whether an instance is drawn or not. Equivalent to [member Node3D.visible].
Returns an array of object IDs intersecting with the provided AABB. Only visual 3D nodes are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GlobalScope.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] 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 convex shape. Only visual 3D nodes are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use [method @GlobalScope.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] 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 [MeshInstance3D] or [DirectionalLight3D]. Use [method @GlobalScope.instance_from_id] to obtain the actual nodes. A scenario RID must be provided, which is available in the [World3D] you want to query. This forces an update for all resources queued to update.
[b]Warning:[/b] This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
If [code]true[/code], this directional light will blend between shadow map splits resulting in a smoother transition between them. Equivalent to [member DirectionalLight3D.directional_shadow_blend_splits].
Sets the shadow mode for this directional light. Equivalent to [member DirectionalLight3D.directional_shadow_mode]. See [enum LightDirectionalShadowMode] for options.
If [code]true[/code], this light will not be used for anything except sky shaders. Use this for lights that impact your sky shader that you may want to hide from affecting the rest of the scene. For example, you may want to enable this when the sun in your sky shader falls below the horizon.
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 [member OmniLight3D.omni_shadow_mode].
Sets the color of the light. Equivalent to [member Light3D.light_color].
Sets the cull mask for this Light3D. Lights only affect objects in the selected layers. Equivalent to [member Light3D.light_cull_mask].
If [code]true[/code], light will subtract light instead of adding light. Equivalent to [member Light3D.light_negative].
Sets the specified light parameter. See [enum LightParam] for options. Equivalent to [method Light3D.set_param].
Not implemented in Godot 3.x.
If [code]true[/code], 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 [method instance_geometry_set_cast_shadows_setting]. Equivalent to [member Light3D.shadow_reverse_cull_face].
If [code]true[/code], light will cast shadows. Equivalent to [member Light3D.shadow_enabled].
Sets the color of the shadow cast by the light. Equivalent to [member Light3D.shadow_color].
Returns a mesh of a sphere with the given amount of horizontal and vertical subdivisions.
Creates an empty material and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]material_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Returns the value of a certain material's parameter.
Sets an object's next material.
Sets a material's parameter.
Sets a material's render priority.
Sets a shader material's shader.
Removes all surfaces from a mesh.
Creates a new mesh and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]mesh_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this mesh to an instance using [method instance_set_base] using the returned RID.
Returns a mesh's blend shape count.
Returns a mesh's blend shape mode.
Returns a mesh's custom aabb.
Returns a mesh's number of surfaces.
Sets a mesh's blend shape mode.
Sets a mesh's custom aabb.
Returns a mesh's surface's buffer arrays.
Returns a mesh's surface's arrays for blend shapes.
Returns a mesh's surface's material.
Sets a mesh's surface's material.
Creates a new multimesh on the RenderingServer and returns an [RID] handle. This RID will be used in all [code]multimesh_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this multimesh to an instance using [method instance_set_base] using the returned RID.
Calculates and returns the axis-aligned bounding box that encloses all instances within the multimesh.
Returns the number of instances allocated for this multimesh.
Returns the RID of the mesh that will be used in drawing this multimesh.
Returns the number of visible instances for this multimesh.
Returns the color by which the specified instance will be modulated.
Returns the custom data associated with the specified instance.
Returns the [Transform3D] of the specified instance.
Returns the [Transform2D] of the specified instance. For use when the multimesh is set to use 2D transforms.
Sets the color by which this instance will be modulated. Equivalent to [method MultiMesh.set_instance_color].
Sets the custom data for this instance. Custom data is passed as a [Color], but is interpreted as a [code]vec4[/code] in the shader. Equivalent to [method MultiMesh.set_instance_custom_data].
Sets the [Transform3D] for this instance. Equivalent to [method MultiMesh.set_instance_transform].
Sets the [Transform2D] for this instance. For use when multimesh is used in 2D. Equivalent to [method MultiMesh.set_instance_transform_2d].
Sets the mesh to be drawn by the multimesh. Equivalent to [member MultiMesh.mesh].
Sets the number of instances visible at a given time. If -1, all instances that have been allocated are drawn. Equivalent to [member MultiMesh.visible_instance_count].
Creates a new omni light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this omni light to an instance using [method instance_set_base] using the returned RID.
Creates a particle system and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]particles_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach these particles to an instance using [method instance_set_base] using the returned RID.
Calculates and returns the axis-aligned bounding box that contains all the particles. Equivalent to [method GPUParticles3D.capture_aabb].
Returns [code]true[/code] if particles are currently set to emitting.
Returns [code]true[/code] if particles are not emitting and particles are set to inactive.
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 [method instances_cull_aabb], [method instances_cull_convex], or [method instances_cull_ray].
Reset the particles on the next update. Equivalent to [method GPUParticles3D.restart].
Sets the number of particles to be drawn and allocates the memory for them. Equivalent to [member GPUParticles3D.amount].
Sets a custom axis-aligned bounding box for the particle system. Equivalent to [member GPUParticles3D.visibility_aabb].
Sets the draw order of the particles to one of the named enums from [enum ParticlesDrawOrder]. See [enum ParticlesDrawOrder] for options. Equivalent to [member GPUParticles3D.draw_order].
Sets the mesh to be used for the specified draw pass. Equivalent to [member GPUParticles3D.draw_pass_1], [member GPUParticles3D.draw_pass_2], [member GPUParticles3D.draw_pass_3], and [member GPUParticles3D.draw_pass_4].
Sets the number of draw passes to use. Equivalent to [member GPUParticles3D.draw_passes].
Sets the [Transform3D] that will be used by the particles when they first emit.
If [code]true[/code], particles will emit over time. Setting to false does not reset the particles, but only stops their emission. Equivalent to [member GPUParticles3D.emitting].
Sets the explosiveness ratio. Equivalent to [member GPUParticles3D.explosiveness].
Sets the frame rate that the particle system rendering will be fixed to. Equivalent to [member GPUParticles3D.fixed_fps].
If [code]true[/code], uses fractional delta which smooths the movement of the particles. Equivalent to [member GPUParticles3D.fract_delta].
Sets the lifetime of each particle in the system. Equivalent to [member GPUParticles3D.lifetime].
If [code]true[/code], particles will emit once and then stop. Equivalent to [member GPUParticles3D.one_shot].
Sets the preprocess time for the particles' animation. This lets you delay starting an animation until after the particles have begun emitting. Equivalent to [member GPUParticles3D.preprocess].
Sets the material for processing the particles.
[b]Note:[/b] This is not the material used to draw the materials. Equivalent to [member GPUParticles3D.process_material].
Sets the emission randomness ratio. This randomizes the emission of particles within their phase. Equivalent to [member GPUParticles3D.randomness].
Sets the speed scale of the particle system. Equivalent to [member GPUParticles3D.speed_scale].
If [code]true[/code], particles use local coordinates. If [code]false[/code] they use global coordinates. Equivalent to [member GPUParticles3D.local_coords].
Creates a reflection probe and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]reflection_probe_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this reflection probe to an instance using [method instance_set_base] using the returned RID.
If [code]true[/code], reflections will ignore sky contribution. Equivalent to [member ReflectionProbe.interior].
Sets the render cull mask for this reflection probe. Only instances with a matching cull mask will be rendered by this probe. Equivalent to [member ReflectionProbe.cull_mask].
If [code]true[/code], uses box projection. This can make reflections look more correct in certain situations. Equivalent to [member ReflectionProbe.box_projection].
If [code]true[/code], computes shadows in the reflection probe. This makes the reflection much slower to compute. Equivalent to [member ReflectionProbe.enable_shadows].
Sets the size of the area that the reflection probe will capture. Equivalent to [member ReflectionProbe.extents].
Sets the intensity of the reflection probe. Intensity modulates the strength of the reflection. Equivalent to [member ReflectionProbe.intensity].
Sets the max distance away from the probe an object can be before it is culled. Equivalent to [member ReflectionProbe.max_distance].
Sets the origin offset to be used when this reflection probe is in box project mode. Equivalent to [member ReflectionProbe.origin_offset].
Sets how often the reflection probe updates. Can either be once or every frame. See [enum ReflectionProbeUpdateMode] for options.
Schedules a callback to the corresponding named [code]method[/code] on [code]where[/code] after a frame has been drawn.
The callback method must use only 1 argument which will be called with [code]userdata[/code].
Creates a scenario and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]scenario_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
The scenario is the 3D world that all the visual instances exist in.
Sets the environment that will be used with this scenario.
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.
Sets a boot image. The color defines the background color. If [code]scale[/code] is [code]true[/code], the image will be scaled to fit the screen size. If [code]use_filter[/code] is [code]true[/code], the image will be scaled with linear interpolation. If [code]use_filter[/code] is [code]false[/code], the image will be scaled with nearest-neighbor interpolation.
If [code]true[/code], the engine will generate wireframes for use with the wireframe debug mode.
Sets the default clear color which is used when a specific clear color has not been selected.
Creates an empty shader and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]shader_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Returns a shader's code.
Returns a default texture from a shader searched by name.
Returns the parameters of a shader.
Sets a shader's default texture. Overwrites the texture given by name.
Returns the [Transform3D] set for a specific bone of this skeleton.
Returns the [Transform2D] set for a specific bone of this skeleton.
Sets the [Transform3D] for a specific bone of this skeleton.
Sets the [Transform2D] for a specific bone of this skeleton.
Creates a skeleton and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]skeleton_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Returns the number of bones allocated for this skeleton.
Creates an empty sky and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]sky_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Sets the material that the sky uses to render the background and reflection maps.
Creates a spot light and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most [code]light_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
To place in a scene, attach this spot light to an instance using [method instance_set_base] using the returned RID.
Sets a viewport's camera.
Sets a viewport's canvas.
Copies the viewport to a region of the screen specified by [code]rect[/code]. If [method viewport_set_render_direct_to_screen] is [code]true[/code], then the viewport does not use a framebuffer and the contents of the viewport are rendered directly to screen. However, note that the root viewport is drawn last, therefore it will draw over the screen. Accordingly, you must set the root viewport to an area that does not cover the area that you have attached this viewport to.
For example, you can set the root viewport to not render at all with the following code:
FIXME: The method seems to be non-existent.
[codeblocks]
[gdscript]
func _ready():
get_viewport().set_attach_to_screen_rect(Rect2())
$Viewport.set_attach_to_screen_rect(Rect2(0, 0, 600, 600))
[/gdscript]
[/codeblocks]
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 a further optimization see, [method viewport_set_render_direct_to_screen].
Creates an empty viewport and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all [code]viewport_*[/code] RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's [method free_rid] static method.
Returns the viewport's last rendered frame.
Detaches a viewport from a canvas and vice versa.
If [code]true[/code], sets the viewport active, else sets it inactive.
Sets the stacking order for a viewport's canvas.
[code]layer[/code] is the actual canvas layer, while [code]sublayer[/code] 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 [enum ViewportClearMode] for options.
Sets the debug draw mode of a viewport. See [enum ViewportDebugDraw] for options.
If [code]true[/code], the viewport's canvas is not rendered.
If [code]true[/code], rendering of a viewport's environment is disabled.
Sets the viewport's global transformation matrix.
Sets the anti-aliasing mode. See [enum ViewportMSAA] for options.
Sets the viewport's parent to another viewport.
If [code]true[/code], 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 [code]SCREEN_TEXTURE[/code]. 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.
Sets the scale at which we render 3D contents.
Sets a viewport's scenario.
The scenario contains information about environment information, reflection atlas etc.
Sets the shadow atlas quadrant's subdivision.
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.
Sets the viewport's width and height.
If [code]true[/code], the viewport renders its background as transparent.
Sets when the viewport should be updated. See [enum ViewportUpdateMode] constants for options.
If [code]true[/code], the viewport uses augmented or virtual reality technologies. See [XRInterface].
If [code]false[/code], disables rendering completely, but the engine logic is still being processed. You can call [method force_draw] to draw a frame even with rendering disabled.
Emitted at the end of the frame, after the RenderingServer has finished updating all the Viewports.
Emitted at the beginning of the frame, before the RenderingServer updates all the Viewports.
Marks an error that shows that the index array is empty.
Number of weights/bones per vertex.
The minimum Z-layer for canvas items.
The maximum Z-layer for canvas items.
Max number of glow levels that can be used with glow post-process effect.
Unused enum in Godot 3.x.
Shader is a 3D shader.
Shader is a 2D shader.
Shader is a particle shader.
Shader is a sky shader.
Shader is a fog shader.
Represents the size of the [enum ShaderMode] enum.
The minimum renderpriority of all materials.
The maximum renderpriority of all materials.
Array is a vertex array.
Array is a normal array.
Array is a tangent array.
Array is a color array.
Array is an UV coordinates array.
Array is an UV coordinates array for the second UV coordinates.
Array contains bone information.
Array is weight information.
Array is index array.
Represents the size of the [enum ArrayType] enum.
Flag used to mark a vertex array.
Flag used to mark a normal array.
Flag used to mark a tangent array.
Flag used to mark a color array.
Flag used to mark an UV coordinates array.
Flag used to mark an UV coordinates array for the second UV coordinates.
Flag used to mark a bone information array.
Flag used to mark a weights array.
Flag used to mark an index array.
Flag used to mark that the array contains 2D vertices.
Primitive to draw consists of points.
Primitive to draw consists of lines.
Primitive to draw consists of a line strip from start to end.
Primitive to draw consists of triangles.
Primitive to draw consists of a triangle strip (the last 3 vertices are always combined to make a triangle).
Represents the size of the [enum PrimitiveType] enum.
Blend shapes are normalized.
Blend shapes are relative to base weight.
Use [Transform2D] to store MultiMesh transform.
Use [Transform3D] to store MultiMesh transform.
Is a directional (sun) light.
Is an omni light.
Is a spot light.
The light's energy.
The light's influence on specularity.
The light's range.
The size of the light when using spot light or omni light. The angular size of the light when using directional light.
The light's attenuation.
The spotlight's angle.
The spotlight's attenuation.
Max distance that shadows will be rendered.
Proportion of shadow atlas occupied by the first split.
Proportion of shadow atlas occupied by the second split.
Proportion of shadow atlas occupied by the third split. The fourth split occupies the rest.
Proportion of shadow max distance where the shadow will start to fade out.
Normal bias used to offset shadow lookup by object normal. Can be used to fix self-shadowing artifacts.
Bias the shadow lookup to fix self-shadowing artifacts.
Sets the size of the directional shadow pancake. The pancake offsets the start of the shadow's camera frustum to provide a higher effective depth resolution for the shadow. However, a high pancake size can cause artifacts in the shadows of large objects that are close to the edge of the frustum. Reducing the pancake size can help. Setting the size to [code]0[/code] turns off the pancaking effect.
Blurs the edges of the shadow. Can be used to hide pixel artifacts in low resolution shadow maps. A high value can make shadows appear grainy and can cause other unwanted artifacts. Try to keep as near default as possible.
Represents the size of the [enum LightParam] enum.
Use a dual paraboloid shadow map for omni lights.
Use a cubemap shadow map for omni lights. Slower but better quality than dual paraboloid.
Use orthogonal shadow projection for directional light.
Use 2 splits for shadow projection when using directional light.
Use 4 splits for shadow projection when using directional light.
Lowest shadow filtering quality (fastest). Soft shadows are not available with this quality setting, which means the [member Light3D.shadow_blur] property is ignored if [member Light3D.light_size] and [member Light3D.light_angular_distance] is [code]0.0[/code].
[b]Note:[/b] The variable shadow blur performed by [member Light3D.light_size] and [member Light3D.light_angular_distance] is still effective when using hard shadow filtering. In this case, [member Light3D.shadow_blur] [i]is[/i] taken into account. However, the results will not be blurred, instead the blur amount is treated as a maximum radius for the penumbra.
Very low shadow filtering quality (faster). When using this quality setting, [member Light3D.shadow_blur] is automatically multiplied by 0.75× to avoid introducing too much noise. This division only applies to lights whose [member Light3D.light_size] or [member Light3D.light_angular_distance] is [code]0.0[/code]).
Low shadow filtering quality (fast).
Medium low shadow filtering quality (average).
High low shadow filtering quality (slow). When using this quality setting, [member Light3D.shadow_blur] is automatically multiplied by 1.5× to better make use of the high sample count. This increased blur also improves the stability of dynamic object shadows. This multiplier only applies to lights whose [member Light3D.light_size] or [member Light3D.light_angular_distance] is [code]0.0[/code]).
Highest low shadow filtering quality (slowest). When using this quality setting, [member Light3D.shadow_blur] is automatically multiplied by 2× to better make use of the high sample count. This increased blur also improves the stability of dynamic object shadows. This multiplier only applies to lights whose [member Light3D.light_size] or [member Light3D.light_angular_distance] is [code]0.0[/code]).
Reflection probe will update reflections once and then stop.
Reflection probe will update each frame. This mode is necessary to capture moving objects.
Draw particles in the order that they appear in the particles array.
Sort particles based on their lifetime.
Sort particles based on their distance to the camera.
[FogVolume] will be shaped like an ellipsoid.
[FogVolume] will be shaped like a box.
[FogVolume] will have no shape, will cover the whole world and will not be culled.
Do not update the viewport.
Update the viewport once then set to disabled.
Update the viewport whenever it is visible.
Always update the viewport.
The viewport is always cleared before drawing.
The viewport is never cleared before drawing.
The viewport is cleared once, then the clear mode is set to [constant VIEWPORT_CLEAR_NEVER].
Multisample antialiasing for 3D is disabled. This is the default value, and also the fastest setting.
Multisample antialiasing uses 2 samples per pixel for 3D. This has a moderate impact on performance.
Multisample antialiasing uses 4 samples per pixel for 3D. This has a high impact on performance.
Multisample antialiasing uses 8 samples per pixel for 3D. This has a very high impact on performance. Likely unsupported on low-end and older hardware.
Number of objects drawn in a single frame.
Number of vertices drawn in a single frame.
Number of draw calls during this frame.
Represents the size of the [enum ViewportRenderInfo] enum.
Debug draw is disabled. Default setting.
Objects are displayed without light information.
Objects are displayed with only light information.
Objects are displayed semi-transparent with additive blending so you can see where they are drawing over top of one another. A higher overdraw (represented by brighter colors) means you are wasting performance on drawing pixels that are being hidden behind others.
[b]Note:[/b] When using this debug draw mode, custom shaders will be ignored. This means vertex displacement won't be visible anymore.
Debug draw draws objects in wireframe.
Normal buffer is drawn instead of regular scene so you can see the per-pixel normals that will be used by post-processing effects.
Objects are displayed with only the albedo value from [VoxelGI]s.
Objects are displayed with only the lighting value from [VoxelGI]s.
Objects are displayed with only the emission color from [VoxelGI]s.
Draws the shadow atlas that stores shadows from [OmniLight3D]s and [SpotLight3D]s in the upper left quadrant of the [Viewport].
Draws the shadow atlas that stores shadows from [DirectionalLight3D]s in the upper left quadrant of the [Viewport].
Draws the screen space ambient occlusion texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have [member Environment.ssao_enabled] set in your [WorldEnvironment].
Colors each PSSM split for the [DirectionalLight3D]s in the scene a different color so you can see where the splits are. In order they will be colored red, green, blue, yellow.
Uses high quality importance sampling to process the radiance map. In general, this results in much higher quality than [constant Sky.PROCESS_MODE_REALTIME] but takes much longer to generate. This should not be used if you plan on changing the sky at runtime. If you are finding that the reflection is not blurry enough and is showing sparkles or fireflies, try increasing [member ProjectSettings.rendering/reflections/sky_reflections/ggx_samples].
Uses the fast filtering algorithm to process the radiance map. In general this results in lower quality, but substantially faster run times.
[b]Note:[/b] The fast filtering algorithm is limited to 256x256 cubemaps, so [member Sky.radiance_size] must be set to [constant Sky.RADIANCE_SIZE_256].
Use the clear color as background.
Use a specified color as the background.
Use a sky resource for the background.
Use a specified canvas layer as the background. This can be useful for instantiating a 2D scene in a 3D world.
Do not clear the background, use whatever was rendered last frame as the background.
Displays a camera feed in the background.
Represents the size of the [enum EnvironmentBG] enum.
Gather ambient light from whichever source is specified as the background.
Disable ambient light.
Specify a specific [Color] for ambient light.
Gather ambient light from the [Sky] regardless of what the background is.
Use the background for reflections.
Disable reflections.
Use the [Sky] for reflections regardless of what the background is.
Additive glow blending mode. Mostly used for particles, glows (bloom), lens flare, bright sources.
Screen glow blending mode. Increases brightness, used frequently with bloom.
Soft light glow blending mode. Modifies contrast, exposes shadows and highlights (vivid bloom).
Replace glow blending mode. Replaces all pixels' color by the glow value. This can be used to simulate a full-screen blur effect by tweaking the glow parameters to match the original image's brightness.
Mixes the glow with the underlying color to avoid increasing brightness as much while still maintaining a glow effect.
Output color as they came in.
Use the Reinhard tonemapper.
Use the filmic tonemapper.
Use the ACES tonemapper.
Lowest quality of screen space ambient occlusion.
Low quality screen space ambient occlusion.
Medium quality screen space ambient occlusion.
High quality screen space ambient occlusion.
Highest quality screen space ambient occlusion. Uses the adaptive setting which can be dynamically adjusted to smoothly balance performance and visual quality.
Calculate the DOF blur using a box filter. The fastest option, but results in obvious lines in blur pattern.
Calculates DOF blur using a hexagon shaped filter.
Calculates DOF blur using a circle shaped filter. Best quality and most realistic, but slowest. Use only for areas where a lot of performance can be dedicated to post-processing (e.g. cutscenes).
Lowest quality DOF blur. This is the fastest setting, but you may be able to see filtering artifacts.
Low quality DOF blur.
Medium quality DOF blur.
Highest quality DOF blur. Results in the smoothest looking blur by taking the most samples, but is also significantly slower.
The instance does not have a type.
The instance is a mesh.
The instance is a multimesh.
The instance is a particle emitter.
The instance is a light.
The instance is a reflection probe.
The instance is a decal.
The instance is a VoxelGI.
The instance is a lightmap.
Represents the size of the [enum InstanceType] enum.
A combination of the flags of geometry instances (mesh, multimesh, immediate and particles).
Allows the instance to be used in baked lighting.
Allows the instance to be used with dynamic global illumination.
When set, manually requests to draw geometry on next frame.
Represents the size of the [enum InstanceFlags] enum.
Disable shadows from this instance.
Cast shadows from this instance.
Disable backface culling when rendering the shadow of the object. This is slightly slower but may result in more correct shadows.
Only render the shadows from the object. The object itself will not be drawn.
Disable visibility range fading for the given instance.
Fade-out the given instance when it approaches its visibility range limits.
Fade-in the given instance's dependencies when reaching its visibility range limits.
The nine patch gets stretched where needed.
The nine patch gets filled with tiles where needed.
The nine patch gets filled with tiles where needed and stretches them a bit if needed.
Uses the default filter mode for this [Viewport].
The texture filter reads from the nearest pixel only. The simplest and fastest method of filtering, but the texture will look pixelized.
The texture filter blends between the nearest 4 pixels. Use this when you want to avoid a pixelated style, but do not want mipmaps.
The texture filter reads from the nearest pixel in the nearest mipmap. The fastest way to read from textures with mipmaps.
The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps.
The texture filter reads from the nearest pixel, but selects a mipmap based on the angle between the surface and the camera view. This reduces artifacts on surfaces that are almost in line with the camera.
The texture filter blends between the nearest 4 pixels and selects a mipmap based on the angle between the surface and the camera view. This reduces artifacts on surfaces that are almost in line with the camera. This is the slowest of the filtering options, but results in the highest quality texturing.
Max value for [enum CanvasItemTextureFilter] enum.
Uses the default repeat mode for this [Viewport].
Disables textures repeating. Instead, when reading UVs outside the 0-1 range, the value will be clamped to the edge of the texture, resulting in a stretched out look at the borders of the texture.
Enables the texture to repeat when UV coordinates are outside the 0-1 range. If using one of the linear filtering modes, this can result in artifacts at the edges of a texture when the sampler filters across the edges of the texture.
Flip the texture when repeating so that the edge lines up instead of abruptly changing.
Max value for [enum CanvasItemTextureRepeat] enum.
Adds light color additive to the canvas.
Adds light color subtractive to the canvas.
The light adds color depending on transparency.
Do not apply a filter to canvas light shadows.
Use PCF5 filtering to filter canvas light shadows.
Use PCF13 filtering to filter canvas light shadows.
Max value of the [enum CanvasLightShadowFilter] enum.
Culling of the canvas occluder is disabled.
Culling of the canvas occluder is clockwise.
Culling of the canvas occluder is counterclockwise.
Hardware supports shaders. This enum is currently unused in Godot 3.x.
Hardware supports multithreading. This enum is currently unused in Godot 3.x.