Class RenderingServerInstance
- Namespace
- Godot
- Assembly
- GodotSharp.dll
The rendering server is the API backend for everything visible. The whole scene system mounts on it to display. The rendering server is completely opaque: the internals are entirely implementation-specific and cannot be accessed.
The rendering server can be used to bypass the scene/Node system entirely. This can improve performance in cases where the scene system is the bottleneck, but won't improve performance otherwise (for instance, if the GPU is already fully utilized).
Resources are created using the *_create
functions. These functions return Rids which are not references to the objects themselves, but opaque pointers towards these objects.
All objects are drawn to a viewport. You can use the Viewport attached to the SceneTree or you can create one yourself with ViewportCreate(). When using a custom scenario or canvas, the scenario or canvas needs to be attached to the viewport using ViewportSetScenario(Rid, Rid) or ViewportAttachCanvas(Rid, Rid).
Scenarios: In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the rendering server from a running game, the scenario can be accessed from the scene tree from any Node3D node with GetWorld3D(). Otherwise, a scenario can be created with ScenarioCreate().
Similarly, in 2D, a canvas is needed to draw all canvas items.
3D: In 3D, all visible objects are comprised of a resource and an instance. A resource can be a mesh, a particle system, a light, or any other 3D object. In order to be visible resources must be attached to an instance using InstanceSetBase(Rid, Rid). The instance must also be attached to the scenario using InstanceSetScenario(Rid, Rid) in order to be visible. RenderingServer methods that don't have a prefix are usually 3D-specific (but not always).
2D: In 2D, all visible objects are some form of canvas item. In order to be visible, a canvas item needs to be the child of a canvas attached to a viewport, or it needs to be the child of another canvas item that is eventually attached to the canvas. 2D-specific RenderingServer methods generally start with canvas_*
.
Headless mode: Starting the engine with the --headless
command line argument disables all rendering and window management functions. Most functions from RenderingServer will return dummy values in this case.
[GodotClassName("RenderingServer")]
public class RenderingServerInstance : GodotObject, IDisposable
- Inheritance
-
RenderingServerInstance
- Implements
- Inherited Members
Properties
RenderLoopEnabled
If false
, disables rendering completely, but the engine logic is still being processed. You can call ForceDraw(bool, double) to draw a frame even with rendering disabled.
public bool RenderLoopEnabled { get; set; }
Property Value
Methods
BakeRenderUV2(Rid, Array<Rid>, Vector2I)
Bakes the material data of the Mesh passed in the base
parameter with optional materialOverrides
to a set of Images of size imageSize
. Returns an array of Images containing material properties as specified in RenderingServer.BakeChannels.
public Array<Image> BakeRenderUV2(Rid @base, Array<Rid> materialOverrides, Vector2I imageSize)
Parameters
Returns
CallOnRenderThread(Callable)
As the RenderingServer actual logic may run on an separate thread, accessing its internals from the main (or any other) thread will result in errors. To make it easier to run code that can safely access the rendering internals (such as RenderingDevice and similar RD classes), push a callable via this function so it will be executed on the render thread.
public void CallOnRenderThread(Callable callable)
Parameters
callable
Callable
CameraAttributesCreate()
Creates a camera attributes object and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all camera_attributes_
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent resource is CameraAttributes.
public Rid CameraAttributesCreate()
Returns
CameraAttributesSetAutoExposure(Rid, bool, float, float, float, float)
Sets the parameters to use with the auto-exposure effect. These parameters take on the same meaning as their counterparts in CameraAttributes and CameraAttributesPractical.
public void CameraAttributesSetAutoExposure(Rid cameraAttributes, bool enable, float minSensitivity, float maxSensitivity, float speed, float scale)
Parameters
CameraAttributesSetDofBlur(Rid, bool, float, float, bool, float, float, float)
Sets the parameters to use with the DOF blur effect. These parameters take on the same meaning as their counterparts in CameraAttributesPractical.
public void CameraAttributesSetDofBlur(Rid cameraAttributes, bool farEnable, float farDistance, float farTransition, bool nearEnable, float nearDistance, float nearTransition, float amount)
Parameters
cameraAttributes
RidfarEnable
boolfarDistance
floatfarTransition
floatnearEnable
boolnearDistance
floatnearTransition
floatamount
float
CameraAttributesSetDofBlurBokehShape(DofBokehShape)
Sets the shape of the DOF bokeh pattern. Different shapes may be used to achieve artistic effect, or to meet performance targets. For more detail on available options see RenderingServer.DofBokehShape.
public void CameraAttributesSetDofBlurBokehShape(RenderingServer.DofBokehShape shape)
Parameters
shape
RenderingServer.DofBokehShape
CameraAttributesSetDofBlurQuality(DofBlurQuality, bool)
Sets the quality level of the DOF blur effect to one of the options in RenderingServer.DofBlurQuality. useJitter
can be used to jitter samples taken during the blur pass to hide artifacts at the cost of looking more fuzzy.
public void CameraAttributesSetDofBlurQuality(RenderingServer.DofBlurQuality quality, bool useJitter)
Parameters
quality
RenderingServer.DofBlurQualityuseJitter
bool
CameraAttributesSetExposure(Rid, float, float)
Sets the exposure values that will be used by the renderers. The normalization amount is used to bake a given Exposure Value (EV) into rendering calculations to reduce the dynamic range of the scene.
The normalization factor can be calculated from exposure value (EV100) as follows:
func get_exposure_normalization(float ev100):
return 1.0 / (pow(2.0, ev100) * 1.2)
The exposure value can be calculated from aperture (in f-stops), shutter speed (in seconds), and sensitivity (in ISO) as follows:
func get_exposure(float aperture, float shutter_speed, float sensitivity):
return log2((aperture * aperture) / shutterSpeed * (100.0 / sensitivity))
public void CameraAttributesSetExposure(Rid cameraAttributes, float multiplier, float normalization)
Parameters
CameraCreate()
Creates a 3D camera and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all camera_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent node is Camera3D.
public Rid CameraCreate()
Returns
CameraSetCameraAttributes(Rid, Rid)
Sets the camera_attributes created with CameraAttributesCreate() to the given camera.
public void CameraSetCameraAttributes(Rid camera, Rid effects)
Parameters
CameraSetCullMask(Rid, uint)
Sets the cull mask associated with this camera. The cull mask describes which 3D layers are rendered by this camera. Equivalent to CullMask.
public void CameraSetCullMask(Rid camera, uint layers)
Parameters
CameraSetEnvironment(Rid, Rid)
Sets the environment used by this camera. Equivalent to Environment.
public void CameraSetEnvironment(Rid camera, Rid env)
Parameters
CameraSetFrustum(Rid, float, Vector2, float, float)
Sets camera to use frustum projection. This mode allows adjusting the offset
argument to create "tilted frustum" effects.
public void CameraSetFrustum(Rid camera, float size, Vector2 offset, float zNear, float zFar)
Parameters
CameraSetOrthogonal(Rid, float, float, float)
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.
public void CameraSetOrthogonal(Rid camera, float size, float zNear, float zFar)
Parameters
CameraSetPerspective(Rid, float, float, float)
Sets camera to use perspective projection. Objects on the screen becomes smaller when they are far away.
public void CameraSetPerspective(Rid camera, float fovyDegrees, float zNear, float zFar)
Parameters
CameraSetTransform(Rid, Transform3D)
Sets Transform3D of camera.
public void CameraSetTransform(Rid camera, Transform3D transform)
Parameters
camera
Ridtransform
Transform3D
CameraSetUseVerticalAspect(Rid, bool)
If true
, preserves the horizontal aspect ratio which is equivalent to Width. If false
, preserves the vertical aspect ratio which is equivalent to Height.
public void CameraSetUseVerticalAspect(Rid camera, bool enable)
Parameters
CanvasCreate()
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_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
public Rid CanvasCreate()
Returns
CanvasItemAddAnimationSlice(Rid, double, double, double, double)
Subsequent drawing commands will be ignored unless they fall within the specified animation slice. This is a faster way to implement animations that loop on background rather than redrawing constantly.
public void CanvasItemAddAnimationSlice(Rid item, double animationLength, double sliceBegin, double sliceEnd, double offset = 0)
Parameters
CanvasItemAddCircle(Rid, Vector2, float, Color)
Draws a circle on the CanvasItem pointed to by the item
Rid. See also DrawCircle(Vector2, float, Color).
public void CanvasItemAddCircle(Rid item, Vector2 pos, float radius, Color color)
Parameters
CanvasItemAddClipIgnore(Rid, bool)
If ignore
is true
, ignore clipping on items drawn with this canvas item until this is called again with ignore
set to false.
public void CanvasItemAddClipIgnore(Rid item, bool ignore)
Parameters
CanvasItemAddLcdTextureRectRegion(Rid, Rect2, Rid, Rect2, Color)
public void CanvasItemAddLcdTextureRectRegion(Rid item, Rect2 rect, Rid texture, Rect2 srcRect, Color modulate)
Parameters
CanvasItemAddLine(Rid, Vector2, Vector2, Color, float, bool)
Draws a line on the CanvasItem pointed to by the item
Rid. See also DrawLine(Vector2, Vector2, Color, float, bool).
public void CanvasItemAddLine(Rid item, Vector2 from, Vector2 to, Color color, float width = -1, bool antialiased = false)
Parameters
CanvasItemAddMesh(Rid, Rid, Transform2D?, Color?, Rid)
Draws a mesh created with MeshCreate() with given transform
, modulate
color, and texture
. This is used internally by MeshInstance2D.
public void CanvasItemAddMesh(Rid item, Rid mesh, Transform2D? transform = null, Color? modulate = null, Rid texture = default)
Parameters
item
Ridmesh
Ridtransform
Transform2D?If the parameter is null, then the default value is
Transform2D.Identity
.modulate
Color?If the parameter is null, then the default value is
new Color(1, 1, 1, 1)
.texture
Rid
CanvasItemAddMsdfTextureRectRegion(Rid, Rect2, Rid, Rect2, Color?, int, float, float)
public void CanvasItemAddMsdfTextureRectRegion(Rid item, Rect2 rect, Rid texture, Rect2 srcRect, Color? modulate = null, int outlineSize = 0, float pxRange = 1, float scale = 1)
Parameters
item
Ridrect
Rect2texture
RidsrcRect
Rect2modulate
Color?If the parameter is null, then the default value is
new Color(1, 1, 1, 1)
.outlineSize
intpxRange
floatscale
float
CanvasItemAddMultiline(Rid, Vector2[], Color[], float)
Draws a 2D multiline on the CanvasItem pointed to by the item
Rid. See also DrawMultiline(Vector2[], Color, float) and DrawMultilineColors(Vector2[], Color[], float).
public void CanvasItemAddMultiline(Rid item, Vector2[] points, Color[] colors, float width = -1)
Parameters
CanvasItemAddMultimesh(Rid, Rid, Rid)
Draws a 2D MultiMesh on the CanvasItem pointed to by the item
Rid. See also DrawMultimesh(MultiMesh, Texture2D).
public void CanvasItemAddMultimesh(Rid item, Rid mesh, Rid texture = default)
Parameters
CanvasItemAddNinePatch(Rid, Rect2, Rect2, Rid, Vector2, Vector2, NinePatchAxisMode, NinePatchAxisMode, bool, Color?)
Draws a nine-patch rectangle on the CanvasItem pointed to by the item
Rid.
public void CanvasItemAddNinePatch(Rid item, Rect2 rect, Rect2 source, Rid texture, Vector2 topleft, Vector2 bottomright, RenderingServer.NinePatchAxisMode xAxisMode = NinePatchAxisMode.Stretch, RenderingServer.NinePatchAxisMode yAxisMode = NinePatchAxisMode.Stretch, bool drawCenter = true, Color? modulate = null)
Parameters
item
Ridrect
Rect2source
Rect2texture
Ridtopleft
Vector2bottomright
Vector2xAxisMode
RenderingServer.NinePatchAxisModeyAxisMode
RenderingServer.NinePatchAxisModedrawCenter
boolmodulate
Color?If the parameter is null, then the default value is
new Color(1, 1, 1, 1)
.
CanvasItemAddParticles(Rid, Rid, Rid)
Draws particles on the CanvasItem pointed to by the item
Rid.
public void CanvasItemAddParticles(Rid item, Rid particles, Rid texture)
Parameters
CanvasItemAddPolygon(Rid, Vector2[], Color[], Vector2[], Rid)
Draws a 2D polygon on the CanvasItem pointed to by the item
Rid. If you need more flexibility (such as being able to use bones), use CanvasItemAddTriangleArray(Rid, int[], Vector2[], Color[], Vector2[], int[], float[], Rid, int) instead. See also DrawPolygon(Vector2[], Color[], Vector2[], Texture2D).
public void CanvasItemAddPolygon(Rid item, Vector2[] points, Color[] colors, Vector2[] uvs = null, Rid texture = default)
Parameters
item
Ridpoints
Vector2[]colors
Color[]uvs
Vector2[]If the parameter is null, then the default value is
Array.Empty<Vector2>()
.texture
Rid
CanvasItemAddPolyline(Rid, Vector2[], Color[], float, bool)
Draws a 2D polyline on the CanvasItem pointed to by the item
Rid. See also DrawPolyline(Vector2[], Color, float, bool) and DrawPolylineColors(Vector2[], Color[], float, bool).
public void CanvasItemAddPolyline(Rid item, Vector2[] points, Color[] colors, float width = -1, bool antialiased = false)
Parameters
CanvasItemAddPrimitive(Rid, Vector2[], Color[], Vector2[], Rid)
Draws a 2D primitive on the CanvasItem pointed to by the item
Rid. See also DrawPrimitive(Vector2[], Color[], Vector2[], Texture2D).
public void CanvasItemAddPrimitive(Rid item, Vector2[] points, Color[] colors, Vector2[] uvs, Rid texture)
Parameters
CanvasItemAddRect(Rid, Rect2, Color)
Draws a rectangle on the CanvasItem pointed to by the item
Rid. See also DrawRect(Rect2, Color, bool, float).
public void CanvasItemAddRect(Rid item, Rect2 rect, Color color)
Parameters
CanvasItemAddSetTransform(Rid, Transform2D)
Sets a Transform2D that will be used to transform subsequent canvas item commands.
public void CanvasItemAddSetTransform(Rid item, Transform2D transform)
Parameters
item
Ridtransform
Transform2D
CanvasItemAddTextureRect(Rid, Rect2, Rid, bool, Color?, bool)
Draws a 2D textured rectangle on the CanvasItem pointed to by the item
Rid. See also DrawTextureRect(Texture2D, Rect2, bool, Color?, bool) and DrawRect(Rid, Rect2, bool, Color?, bool).
public void CanvasItemAddTextureRect(Rid item, Rect2 rect, Rid texture, bool tile = false, Color? modulate = null, bool transpose = false)
Parameters
item
Ridrect
Rect2texture
Ridtile
boolmodulate
Color?If the parameter is null, then the default value is
new Color(1, 1, 1, 1)
.transpose
bool
CanvasItemAddTextureRectRegion(Rid, Rect2, Rid, Rect2, Color?, bool, bool)
Draws the specified region of a 2D textured rectangle on the CanvasItem pointed to by the item
Rid. See also DrawTextureRectRegion(Texture2D, Rect2, Rect2, Color?, bool, bool) and DrawRectRegion(Rid, Rect2, Rect2, Color?, bool, bool).
public void CanvasItemAddTextureRectRegion(Rid item, Rect2 rect, Rid texture, Rect2 srcRect, Color? modulate = null, bool transpose = false, bool clipUV = true)
Parameters
item
Ridrect
Rect2texture
RidsrcRect
Rect2modulate
Color?If the parameter is null, then the default value is
new Color(1, 1, 1, 1)
.transpose
boolclipUV
bool
CanvasItemAddTriangleArray(Rid, int[], Vector2[], Color[], Vector2[], int[], float[], Rid, int)
Draws a triangle array on the CanvasItem pointed to by the item
Rid. This is internally used by Line2D and StyleBoxFlat for rendering. CanvasItemAddTriangleArray(Rid, int[], Vector2[], Color[], Vector2[], int[], float[], Rid, int) is highly flexible, but more complex to use than CanvasItemAddPolygon(Rid, Vector2[], Color[], Vector2[], Rid).
Note:
count
is unused and can be left unspecified.
public void CanvasItemAddTriangleArray(Rid item, int[] indices, Vector2[] points, Color[] colors, Vector2[] uvs = null, int[] bones = null, float[] weights = null, Rid texture = default, int count = -1)
Parameters
item
Ridindices
int[]points
Vector2[]colors
Color[]uvs
Vector2[]If the parameter is null, then the default value is
Array.Empty<Vector2>()
.bones
int[]If the parameter is null, then the default value is
Array.Empty<int>()
.weights
float[]If the parameter is null, then the default value is
Array.Empty<float>()
.texture
Ridcount
int
CanvasItemClear(Rid)
Clears the CanvasItem and removes all commands in it.
public void CanvasItemClear(Rid item)
Parameters
item
Rid
CanvasItemCreate()
Creates a new CanvasItem instance and returns its Rid. It can be accessed with the RID that is returned. This RID will be used in all canvas_item_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent node is CanvasItem.
public Rid CanvasItemCreate()
Returns
CanvasItemSetCanvasGroupMode(Rid, CanvasGroupMode, float, bool, float, bool)
Sets the canvas group mode used during 2D rendering for the canvas item specified by the item
RID. For faster but more limited clipping, use CanvasItemSetClip(Rid, bool) instead.
Note: The equivalent node functionality is found in CanvasGroup and ClipChildren.
public void CanvasItemSetCanvasGroupMode(Rid item, RenderingServer.CanvasGroupMode mode, float clearMargin = 5, bool fitEmpty = false, float fitMargin = 0, bool blurMipmaps = false)
Parameters
item
Ridmode
RenderingServer.CanvasGroupModeclearMargin
floatfitEmpty
boolfitMargin
floatblurMipmaps
bool
CanvasItemSetClip(Rid, bool)
If clip
is true
, makes the canvas item specified by the item
RID not draw anything outside of its rect's coordinates. This clipping is fast, but works only with axis-aligned rectangles. This means that rotation is ignored by the clipping rectangle. For more advanced clipping shapes, use CanvasItemSetCanvasGroupMode(Rid, CanvasGroupMode, float, bool, float, bool) instead.
Note: The equivalent node functionality is found in ClipText, RichTextLabel (always enabled) and more.
public void CanvasItemSetClip(Rid item, bool clip)
Parameters
CanvasItemSetCopyToBackbuffer(Rid, bool, Rect2)
Sets the CanvasItem to copy a rect to the backbuffer.
public void CanvasItemSetCopyToBackbuffer(Rid item, bool enabled, Rect2 rect)
Parameters
CanvasItemSetCustomRect(Rid, bool, Rect2?)
If useCustomRect
is true
, sets the custom visibility rectangle (used for culling) to rect
for the canvas item specified by item
. Setting a custom visibility rect can reduce CPU load when drawing lots of 2D instances. If useCustomRect
is false
, automatically computes a visibility rectangle based on the canvas item's draw commands.
public void CanvasItemSetCustomRect(Rid item, bool useCustomRect, Rect2? rect = null)
Parameters
item
RiduseCustomRect
boolrect
Rect2?If the parameter is null, then the default value is
new Rect2(new Vector2(0, 0), new Vector2(0, 0))
.
CanvasItemSetDefaultTextureFilter(Rid, CanvasItemTextureFilter)
Sets the default texture filter mode for the canvas item specified by the item
RID. Equivalent to TextureFilter.
public void CanvasItemSetDefaultTextureFilter(Rid item, RenderingServer.CanvasItemTextureFilter filter)
Parameters
item
Ridfilter
RenderingServer.CanvasItemTextureFilter
CanvasItemSetDefaultTextureRepeat(Rid, CanvasItemTextureRepeat)
Sets the default texture repeat mode for the canvas item specified by the item
RID. Equivalent to TextureRepeat.
public void CanvasItemSetDefaultTextureRepeat(Rid item, RenderingServer.CanvasItemTextureRepeat repeat)
Parameters
item
Ridrepeat
RenderingServer.CanvasItemTextureRepeat
CanvasItemSetDistanceFieldMode(Rid, bool)
If enabled
is true
, enables multichannel signed distance field rendering mode for the canvas item specified by the item
RID. This is meant to be used for font rendering, or with specially generated images using msdfgen.
public void CanvasItemSetDistanceFieldMode(Rid item, bool enabled)
Parameters
CanvasItemSetDrawBehindParent(Rid, bool)
If enabled
is true
, draws the canvas item specified by the item
RID behind its parent. Equivalent to ShowBehindParent.
public void CanvasItemSetDrawBehindParent(Rid item, bool enabled)
Parameters
CanvasItemSetDrawIndex(Rid, int)
Sets the index for the CanvasItem.
public void CanvasItemSetDrawIndex(Rid item, int index)
Parameters
CanvasItemSetLightMask(Rid, int)
Sets the light mask
for the canvas item specified by the item
RID. Equivalent to LightMask.
public void CanvasItemSetLightMask(Rid item, int mask)
Parameters
CanvasItemSetMaterial(Rid, Rid)
Sets a new material
to the canvas item specified by the item
RID. Equivalent to Material.
public void CanvasItemSetMaterial(Rid item, Rid material)
Parameters
CanvasItemSetModulate(Rid, Color)
Multiplies the color of the canvas item specified by the item
RID, while affecting its children. See also CanvasItemSetSelfModulate(Rid, Color). Equivalent to Modulate.
public void CanvasItemSetModulate(Rid item, Color color)
Parameters
CanvasItemSetParent(Rid, Rid)
Sets a parent CanvasItem to the CanvasItem. The item will inherit transform, modulation and visibility from its parent, like CanvasItem nodes in the scene tree.
public void CanvasItemSetParent(Rid item, Rid parent)
Parameters
CanvasItemSetSelfModulate(Rid, Color)
Multiplies the color of the canvas item specified by the item
RID, without affecting its children. See also CanvasItemSetModulate(Rid, Color). Equivalent to SelfModulate.
public void CanvasItemSetSelfModulate(Rid item, Color color)
Parameters
CanvasItemSetSortChildrenByY(Rid, bool)
If enabled
is true
, child nodes with the lowest Y position are drawn before those with a higher Y position. Y-sorting only affects children that inherit from the canvas item specified by the item
RID, not the canvas item itself. Equivalent to YSortEnabled.
public void CanvasItemSetSortChildrenByY(Rid item, bool enabled)
Parameters
CanvasItemSetTransform(Rid, Transform2D)
Sets the transform
of the canvas item specified by the item
RID. This affects where and how the item will be drawn. Child canvas items' transforms are multiplied by their parent's transform. Equivalent to Transform.
public void CanvasItemSetTransform(Rid item, Transform2D transform)
Parameters
item
Ridtransform
Transform2D
CanvasItemSetUseParentMaterial(Rid, bool)
Sets if the CanvasItem uses its parent's material.
public void CanvasItemSetUseParentMaterial(Rid item, bool enabled)
Parameters
CanvasItemSetVisibilityLayer(Rid, uint)
Sets the rendering visibility layer associated with this CanvasItem. Only Viewport nodes with a matching rendering mask will render this CanvasItem.
public void CanvasItemSetVisibilityLayer(Rid item, uint visibilityLayer)
Parameters
CanvasItemSetVisibilityNotifier(Rid, bool, Rect2, Callable, Callable)
Sets the given CanvasItem as visibility notifier. area
defines the area of detecting visibility. enterCallable
is called when the CanvasItem enters the screen, exitCallable
is called when the CanvasItem exits the screen. If enable
is false
, the item will no longer function as notifier.
This method can be used to manually mimic VisibleOnScreenNotifier2D.
public void CanvasItemSetVisibilityNotifier(Rid item, bool enable, Rect2 area, Callable enterCallable, Callable exitCallable)
Parameters
CanvasItemSetVisible(Rid, bool)
Sets the visibility of the CanvasItem.
public void CanvasItemSetVisible(Rid item, bool visible)
Parameters
CanvasItemSetZAsRelativeToParent(Rid, bool)
If this is enabled, the Z index of the parent will be added to the children's Z index.
public void CanvasItemSetZAsRelativeToParent(Rid item, bool enabled)
Parameters
CanvasItemSetZIndex(Rid, int)
Sets the CanvasItem's Z index, i.e. its draw order (lower indexes are drawn first).
public void CanvasItemSetZIndex(Rid item, int zIndex)
Parameters
CanvasLightAttachToCanvas(Rid, Rid)
Attaches the canvas light to the canvas. Removes it from its previous canvas.
public void CanvasLightAttachToCanvas(Rid light, Rid canvas)
Parameters
CanvasLightCreate()
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 canvas_light_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent node is Light2D.
public Rid CanvasLightCreate()
Returns
CanvasLightOccluderAttachToCanvas(Rid, Rid)
Attaches a light occluder to the canvas. Removes it from its previous canvas.
public void CanvasLightOccluderAttachToCanvas(Rid occluder, Rid canvas)
Parameters
CanvasLightOccluderCreate()
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 canvas_light_occluder_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent node is LightOccluder2D.
public Rid CanvasLightOccluderCreate()
Returns
CanvasLightOccluderSetAsSdfCollision(Rid, bool)
public void CanvasLightOccluderSetAsSdfCollision(Rid occluder, bool enable)
Parameters
CanvasLightOccluderSetEnabled(Rid, bool)
Enables or disables light occluder.
public void CanvasLightOccluderSetEnabled(Rid occluder, bool enabled)
Parameters
CanvasLightOccluderSetLightMask(Rid, int)
The light mask. See LightOccluder2D for more information on light masks.
public void CanvasLightOccluderSetLightMask(Rid occluder, int mask)
Parameters
CanvasLightOccluderSetPolygon(Rid, Rid)
Sets a light occluder's polygon.
public void CanvasLightOccluderSetPolygon(Rid occluder, Rid polygon)
Parameters
CanvasLightOccluderSetTransform(Rid, Transform2D)
Sets a light occluder's Transform2D.
public void CanvasLightOccluderSetTransform(Rid occluder, Transform2D transform)
Parameters
occluder
Ridtransform
Transform2D
CanvasLightSetBlendMode(Rid, CanvasLightBlendMode)
Sets the blend mode for the given canvas light. See RenderingServer.CanvasLightBlendMode for options. Equivalent to BlendMode.
public void CanvasLightSetBlendMode(Rid light, RenderingServer.CanvasLightBlendMode mode)
Parameters
light
Ridmode
RenderingServer.CanvasLightBlendMode
CanvasLightSetColor(Rid, Color)
Sets the color for a light.
public void CanvasLightSetColor(Rid light, Color color)
Parameters
CanvasLightSetEnabled(Rid, bool)
Enables or disables a canvas light.
public void CanvasLightSetEnabled(Rid light, bool enabled)
Parameters
CanvasLightSetEnergy(Rid, float)
Sets a canvas light's energy.
public void CanvasLightSetEnergy(Rid light, float energy)
Parameters
CanvasLightSetHeight(Rid, float)
Sets a canvas light's height.
public void CanvasLightSetHeight(Rid light, float height)
Parameters
CanvasLightSetItemCullMask(Rid, int)
The light mask. See LightOccluder2D for more information on light masks.
public void CanvasLightSetItemCullMask(Rid light, int mask)
Parameters
CanvasLightSetItemShadowCullMask(Rid, int)
The binary mask used to determine which layers this canvas light's shadows affects. See LightOccluder2D for more information on light masks.
public void CanvasLightSetItemShadowCullMask(Rid light, int mask)
Parameters
CanvasLightSetLayerRange(Rid, int, int)
The layer range that gets rendered with this light.
public void CanvasLightSetLayerRange(Rid light, int minLayer, int maxLayer)
Parameters
CanvasLightSetMode(Rid, CanvasLightMode)
The mode of the light, see RenderingServer.CanvasLightMode constants.
public void CanvasLightSetMode(Rid light, RenderingServer.CanvasLightMode mode)
Parameters
light
Ridmode
RenderingServer.CanvasLightMode
CanvasLightSetShadowColor(Rid, Color)
Sets the color of the canvas light's shadow.
public void CanvasLightSetShadowColor(Rid light, Color color)
Parameters
CanvasLightSetShadowEnabled(Rid, bool)
Enables or disables the canvas light's shadow.
public void CanvasLightSetShadowEnabled(Rid light, bool enabled)
Parameters
CanvasLightSetShadowFilter(Rid, CanvasLightShadowFilter)
Sets the canvas light's shadow's filter, see RenderingServer.CanvasLightShadowFilter constants.
public void CanvasLightSetShadowFilter(Rid light, RenderingServer.CanvasLightShadowFilter filter)
Parameters
light
Ridfilter
RenderingServer.CanvasLightShadowFilter
CanvasLightSetShadowSmooth(Rid, float)
Smoothens the shadow. The lower, the smoother.
public void CanvasLightSetShadowSmooth(Rid light, float smooth)
Parameters
CanvasLightSetTexture(Rid, Rid)
Sets the texture to be used by a PointLight2D. Equivalent to Texture.
public void CanvasLightSetTexture(Rid light, Rid texture)
Parameters
CanvasLightSetTextureOffset(Rid, Vector2)
Sets the offset of a PointLight2D's texture. Equivalent to Offset.
public void CanvasLightSetTextureOffset(Rid light, Vector2 offset)
Parameters
CanvasLightSetTextureScale(Rid, float)
Sets the scale factor of a PointLight2D's texture. Equivalent to TextureScale.
public void CanvasLightSetTextureScale(Rid light, float scale)
Parameters
CanvasLightSetTransform(Rid, Transform2D)
Sets the canvas light's Transform2D.
public void CanvasLightSetTransform(Rid light, Transform2D transform)
Parameters
light
Ridtransform
Transform2D
CanvasLightSetZRange(Rid, int, int)
Sets the Z range of objects that will be affected by this light. Equivalent to RangeZMin and RangeZMax.
public void CanvasLightSetZRange(Rid light, int minZ, int maxZ)
Parameters
CanvasOccluderPolygonCreate()
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 canvas_occluder_polygon_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent resource is OccluderPolygon2D.
public Rid CanvasOccluderPolygonCreate()
Returns
CanvasOccluderPolygonSetCullMode(Rid, CanvasOccluderPolygonCullMode)
Sets an occluder polygons cull mode. See RenderingServer.CanvasOccluderPolygonCullMode constants.
public void CanvasOccluderPolygonSetCullMode(Rid occluderPolygon, RenderingServer.CanvasOccluderPolygonCullMode mode)
Parameters
occluderPolygon
Ridmode
RenderingServer.CanvasOccluderPolygonCullMode
CanvasOccluderPolygonSetShape(Rid, Vector2[], bool)
Sets the shape of the occluder polygon.
public void CanvasOccluderPolygonSetShape(Rid occluderPolygon, Vector2[] shape, bool closed)
Parameters
CanvasSetDisableScale(bool)
public void CanvasSetDisableScale(bool disable)
Parameters
disable
bool
CanvasSetItemMirroring(Rid, Rid, Vector2)
A copy of the canvas item will be drawn with a local offset of the mirroring Vector2.
public void CanvasSetItemMirroring(Rid canvas, Rid item, Vector2 mirroring)
Parameters
CanvasSetModulate(Rid, Color)
Modulates all colors in the given canvas.
public void CanvasSetModulate(Rid canvas, Color color)
Parameters
CanvasSetShadowTextureSize(int)
Sets the ProjectSettings.rendering/2d/shadow_atlas/size
to use for Light2D shadow rendering (in pixels). The value is rounded up to the nearest power of 2.
public void CanvasSetShadowTextureSize(int size)
Parameters
size
int
CanvasTextureCreate()
Creates a canvas texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_texture_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method. See also Texture2DCreate(Image).
Note: The equivalent resource is CanvasTexture and is only meant to be used in 2D rendering, not 3D.
public Rid CanvasTextureCreate()
Returns
CanvasTextureSetChannel(Rid, CanvasTextureChannel, Rid)
Sets the channel
's texture
for the canvas texture specified by the canvasTexture
RID. Equivalent to DiffuseTexture, NormalTexture and SpecularTexture.
public void CanvasTextureSetChannel(Rid canvasTexture, RenderingServer.CanvasTextureChannel channel, Rid texture)
Parameters
canvasTexture
Ridchannel
RenderingServer.CanvasTextureChanneltexture
Rid
CanvasTextureSetShadingParameters(Rid, Color, float)
Sets the baseColor
and shininess
to use for the canvas texture specified by the canvasTexture
RID. Equivalent to SpecularColor and SpecularShininess.
public void CanvasTextureSetShadingParameters(Rid canvasTexture, Color baseColor, float shininess)
Parameters
CanvasTextureSetTextureFilter(Rid, CanvasItemTextureFilter)
Sets the texture filter
mode to use for the canvas texture specified by the canvasTexture
RID.
public void CanvasTextureSetTextureFilter(Rid canvasTexture, RenderingServer.CanvasItemTextureFilter filter)
Parameters
canvasTexture
Ridfilter
RenderingServer.CanvasItemTextureFilter
CanvasTextureSetTextureRepeat(Rid, CanvasItemTextureRepeat)
Sets the texture repeat
mode to use for the canvas texture specified by the canvasTexture
RID.
public void CanvasTextureSetTextureRepeat(Rid canvasTexture, RenderingServer.CanvasItemTextureRepeat repeat)
Parameters
canvasTexture
Ridrepeat
RenderingServer.CanvasItemTextureRepeat
CreateLocalRenderingDevice()
Creates a RenderingDevice that can be used to do draw and compute operations on a separate thread. Cannot draw to the screen nor share data with the global RenderingDevice.
Note: When using the OpenGL backend or when running in headless mode, this function always returns null
.
public RenderingDevice CreateLocalRenderingDevice()
Returns
DebugCanvasItemGetRect(Rid)
Returns the bounding rectangle for a canvas item in local space, as calculated by the renderer. This bound is used internally for culling.
Warning: This function is intended for debugging in the editor, and will pass through and return a zero Rect2 in exported projects.
public Rect2 DebugCanvasItemGetRect(Rid item)
Parameters
item
Rid
Returns
DecalCreate()
Creates a decal and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all decal_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
To place in a scene, attach this decal to an instance using InstanceSetBase(Rid, Rid) using the returned RID.
Note: The equivalent node is Decal.
public Rid DecalCreate()
Returns
DecalSetAlbedoMix(Rid, float)
Sets the albedoMix
in the decal specified by the decal
RID. Equivalent to AlbedoMix.
public void DecalSetAlbedoMix(Rid decal, float albedoMix)
Parameters
DecalSetCullMask(Rid, uint)
Sets the cull mask
in the decal specified by the decal
RID. Equivalent to CullMask.
public void DecalSetCullMask(Rid decal, uint mask)
Parameters
DecalSetDistanceFade(Rid, bool, float, float)
Sets the distance fade parameters in the decal specified by the decal
RID. Equivalent to DistanceFadeEnabled, DistanceFadeBegin and DistanceFadeLength.
public void DecalSetDistanceFade(Rid decal, bool enabled, float begin, float length)
Parameters
DecalSetEmissionEnergy(Rid, float)
Sets the emission energy
in the decal specified by the decal
RID. Equivalent to EmissionEnergy.
public void DecalSetEmissionEnergy(Rid decal, float energy)
Parameters
DecalSetFade(Rid, float, float)
Sets the upper fade (above
) and lower fade (below
) in the decal specified by the decal
RID. Equivalent to UpperFade and LowerFade.
public void DecalSetFade(Rid decal, float above, float below)
Parameters
DecalSetModulate(Rid, Color)
Sets the color multiplier in the decal specified by the decal
RID to color
. Equivalent to Modulate.
public void DecalSetModulate(Rid decal, Color color)
Parameters
DecalSetNormalFade(Rid, float)
Sets the normal fade
in the decal specified by the decal
RID. Equivalent to NormalFade.
public void DecalSetNormalFade(Rid decal, float fade)
Parameters
DecalSetSize(Rid, Vector3)
Sets the size
of the decal specified by the decal
RID. Equivalent to Size.
public void DecalSetSize(Rid decal, Vector3 size)
Parameters
DecalSetTexture(Rid, DecalTexture, Rid)
Sets the texture
in the given texture type
slot for the specified decal. Equivalent to Godot.Decal.SetTexture(Godot.Decal.DecalTexture,Godot.Texture2D).
public void DecalSetTexture(Rid decal, RenderingServer.DecalTexture type, Rid texture)
Parameters
decal
Ridtype
RenderingServer.DecalTexturetexture
Rid
DecalsSetFilter(DecalFilter)
Sets the texture filter
mode to use when rendering decals. This parameter is global and cannot be set on a per-decal basis.
public void DecalsSetFilter(RenderingServer.DecalFilter filter)
Parameters
filter
RenderingServer.DecalFilter
DirectionalLightCreate()
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 light_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
To place in a scene, attach this directional light to an instance using InstanceSetBase(Rid, Rid) using the returned RID.
Note: The equivalent node is DirectionalLight3D.
public Rid DirectionalLightCreate()
Returns
DirectionalShadowAtlasSetSize(int, bool)
Sets the size
of the directional light shadows in 3D. See also ProjectSettings.rendering/lights_and_shadows/directional_shadow/size
. This parameter is global and cannot be set on a per-viewport basis.
public void DirectionalShadowAtlasSetSize(int size, bool is16Bits)
Parameters
DirectionalSoftShadowFilterSetQuality(ShadowQuality)
Sets the filter quality
for directional light shadows in 3D. See also ProjectSettings.rendering/lights_and_shadows/directional_shadow/soft_shadow_filter_quality
. This parameter is global and cannot be set on a per-viewport basis.
public void DirectionalSoftShadowFilterSetQuality(RenderingServer.ShadowQuality quality)
Parameters
quality
RenderingServer.ShadowQuality
EnvironmentBakePanorama(Rid, bool, Vector2I)
Generates and returns an Image containing the radiance map for the specified environment
RID's sky. This supports built-in sky material and custom sky shaders. If bakeIrradiance
is true
, the irradiance map is saved instead of the radiance map. The radiance map is used to render reflected light, while the irradiance map is used to render ambient light. See also SkyBakePanorama(Rid, float, bool, Vector2I).
Note: The image is saved in linear color space without any tonemapping performed, which means it will look too dark if viewed directly in an image editor.
Note:
size
should be a 2:1 aspect ratio for the generated panorama to have square pixels. For radiance maps, there is no point in using a height greater than RadianceSize, as it won't increase detail. Irradiance maps only contain low-frequency data, so there is usually no point in going past a size of 128×64 pixels when saving an irradiance map.
public Image EnvironmentBakePanorama(Rid environment, bool bakeIrradiance, Vector2I size)
Parameters
Returns
EnvironmentCreate()
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 environment_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent resource is Environment.
public Rid EnvironmentCreate()
Returns
EnvironmentGlowSetUseBicubicUpscale(bool)
If enable
is true
, enables bicubic upscaling for glow which improves quality at the cost of performance. Equivalent to ProjectSettings.rendering/environment/glow/upscale_mode
.
public void EnvironmentGlowSetUseBicubicUpscale(bool enable)
Parameters
enable
bool
EnvironmentSetAdjustment(Rid, bool, float, float, float, bool, Rid)
Sets the values to be used with the "adjustments" post-process effect. See Environment for more details.
public void EnvironmentSetAdjustment(Rid env, bool enable, float brightness, float contrast, float saturation, bool use1DColorCorrection, Rid colorCorrection)
Parameters
env
Ridenable
boolbrightness
floatcontrast
floatsaturation
floatuse1DColorCorrection
boolcolorCorrection
Rid
EnvironmentSetAmbientLight(Rid, Color, EnvironmentAmbientSource, float, float, EnvironmentReflectionSource)
Sets the values to be used for ambient light rendering. See Environment for more details.
public void EnvironmentSetAmbientLight(Rid env, Color color, RenderingServer.EnvironmentAmbientSource ambient = EnvironmentAmbientSource.Bg, float energy = 1, float skyContibution = 0, RenderingServer.EnvironmentReflectionSource reflectionSource = EnvironmentReflectionSource.Bg)
Parameters
env
Ridcolor
Colorambient
RenderingServer.EnvironmentAmbientSourceenergy
floatskyContibution
floatreflectionSource
RenderingServer.EnvironmentReflectionSource
EnvironmentSetBackground(Rid, EnvironmentBG)
Sets the environment's background mode. Equivalent to BackgroundMode.
public void EnvironmentSetBackground(Rid env, RenderingServer.EnvironmentBG bg)
Parameters
env
Ridbg
RenderingServer.EnvironmentBG
EnvironmentSetBgColor(Rid, Color)
Color displayed for clear areas of the scene. Only effective if using the Color background mode.
public void EnvironmentSetBgColor(Rid env, Color color)
Parameters
EnvironmentSetBgEnergy(Rid, float, float)
Sets the intensity of the background color.
public void EnvironmentSetBgEnergy(Rid env, float multiplier, float exposureValue)
Parameters
EnvironmentSetCanvasMaxLayer(Rid, int)
Sets the maximum layer to use if using Canvas background mode.
public void EnvironmentSetCanvasMaxLayer(Rid env, int maxLayer)
Parameters
EnvironmentSetFog(Rid, bool, Color, float, float, float, float, float, float, float)
Configures fog for the specified environment RID. See fog_*
properties in Environment for more information.
public void EnvironmentSetFog(Rid env, bool enable, Color lightColor, float lightEnergy, float sunScatter, float density, float height, float heightDensity, float aerialPerspective, float skyAffect)
Parameters
env
Ridenable
boollightColor
ColorlightEnergy
floatsunScatter
floatdensity
floatheight
floatheightDensity
floataerialPerspective
floatskyAffect
float
EnvironmentSetGlow(Rid, bool, float[], float, float, float, float, EnvironmentGlowBlendMode, float, float, float, float, Rid)
Configures glow for the specified environment RID. See glow_*
properties in Environment for more information.
public void EnvironmentSetGlow(Rid env, bool enable, float[] levels, float intensity, float strength, float mix, float bloomThreshold, RenderingServer.EnvironmentGlowBlendMode blendMode, float hdrBleedThreshold, float hdrBleedScale, float hdrLuminanceCap, float glowMapStrength, Rid glowMap)
Parameters
env
Ridenable
boollevels
float[]intensity
floatstrength
floatmix
floatbloomThreshold
floatblendMode
RenderingServer.EnvironmentGlowBlendModehdrBleedThreshold
floathdrBleedScale
floathdrLuminanceCap
floatglowMapStrength
floatglowMap
Rid
EnvironmentSetSdfgi(Rid, bool, int, float, EnvironmentSdfgiyScale, bool, float, bool, float, float, float)
Configures signed distance field global illumination for the specified environment RID. See sdfgi_*
properties in Environment for more information.
public void EnvironmentSetSdfgi(Rid env, bool enable, int cascades, float minCellSize, RenderingServer.EnvironmentSdfgiyScale yScale, bool useOcclusion, float bounceFeedback, bool readSky, float energy, float normalBias, float probeBias)
Parameters
env
Ridenable
boolcascades
intminCellSize
floatyScale
RenderingServer.EnvironmentSdfgiyScaleuseOcclusion
boolbounceFeedback
floatreadSky
boolenergy
floatnormalBias
floatprobeBias
float
EnvironmentSetSdfgiFramesToConverge(EnvironmentSdfgiFramesToConverge)
Sets the number of frames to use for converging signed distance field global illumination. Equivalent to ProjectSettings.rendering/global_illumination/sdfgi/frames_to_converge
.
public void EnvironmentSetSdfgiFramesToConverge(RenderingServer.EnvironmentSdfgiFramesToConverge frames)
Parameters
EnvironmentSetSdfgiFramesToUpdateLight(EnvironmentSdfgiFramesToUpdateLight)
Sets the update speed for dynamic lights' indirect lighting when computing signed distance field global illumination. Equivalent to ProjectSettings.rendering/global_illumination/sdfgi/frames_to_update_lights
.
public void EnvironmentSetSdfgiFramesToUpdateLight(RenderingServer.EnvironmentSdfgiFramesToUpdateLight frames)
Parameters
EnvironmentSetSdfgiRayCount(EnvironmentSdfgiRayCount)
Sets the number of rays to throw per frame when computing signed distance field global illumination. Equivalent to ProjectSettings.rendering/global_illumination/sdfgi/probe_ray_count
.
public void EnvironmentSetSdfgiRayCount(RenderingServer.EnvironmentSdfgiRayCount rayCount)
Parameters
rayCount
RenderingServer.EnvironmentSdfgiRayCount
EnvironmentSetSky(Rid, Rid)
public void EnvironmentSetSky(Rid env, Rid sky)
Parameters
EnvironmentSetSkyCustomFov(Rid, float)
Sets a custom field of view for the background Sky. Equivalent to SkyCustomFov.
public void EnvironmentSetSkyCustomFov(Rid env, float scale)
Parameters
EnvironmentSetSkyOrientation(Rid, Basis)
Sets the rotation of the background Sky expressed as a Basis. Equivalent to SkyRotation, where the rotation vector is used to construct the Basis.
public void EnvironmentSetSkyOrientation(Rid env, Basis orientation)
Parameters
EnvironmentSetSsao(Rid, bool, float, float, float, float, float, float, float, float)
Sets the variables to be used with the screen-space ambient occlusion (SSAO) post-process effect. See Environment for more details.
public void EnvironmentSetSsao(Rid env, bool enable, float radius, float intensity, float power, float detail, float horizon, float sharpness, float lightAffect, float aOChannelAffect)
Parameters
env
Ridenable
boolradius
floatintensity
floatpower
floatdetail
floathorizon
floatsharpness
floatlightAffect
floataOChannelAffect
float
EnvironmentSetSsaoQuality(EnvironmentSsaoQuality, bool, float, int, float, float)
Sets the quality level of the screen-space ambient occlusion (SSAO) post-process effect. See Environment for more details.
public void EnvironmentSetSsaoQuality(RenderingServer.EnvironmentSsaoQuality quality, bool halfSize, float adaptiveTarget, int blurPasses, float fadeOutFrom, float fadeOutTo)
Parameters
quality
RenderingServer.EnvironmentSsaoQualityhalfSize
booladaptiveTarget
floatblurPasses
intfadeOutFrom
floatfadeOutTo
float
EnvironmentSetSsilQuality(EnvironmentSsilQuality, bool, float, int, float, float)
Sets the quality level of the screen-space indirect lighting (SSIL) post-process effect. See Environment for more details.
public void EnvironmentSetSsilQuality(RenderingServer.EnvironmentSsilQuality quality, bool halfSize, float adaptiveTarget, int blurPasses, float fadeOutFrom, float fadeOutTo)
Parameters
quality
RenderingServer.EnvironmentSsilQualityhalfSize
booladaptiveTarget
floatblurPasses
intfadeOutFrom
floatfadeOutTo
float
EnvironmentSetSsr(Rid, bool, int, float, float, float)
Sets the variables to be used with the screen-space reflections (SSR) post-process effect. See Environment for more details.
public void EnvironmentSetSsr(Rid env, bool enable, int maxSteps, float fadeIn, float fadeOut, float depthTolerance)
Parameters
EnvironmentSetSsrRoughnessQuality(EnvironmentSsrRoughnessQuality)
public void EnvironmentSetSsrRoughnessQuality(RenderingServer.EnvironmentSsrRoughnessQuality quality)
Parameters
EnvironmentSetTonemap(Rid, EnvironmentToneMapper, float, float)
Sets the variables to be used with the "tonemap" post-process effect. See Environment for more details.
public void EnvironmentSetTonemap(Rid env, RenderingServer.EnvironmentToneMapper toneMapper, float exposure, float white)
Parameters
env
RidtoneMapper
RenderingServer.EnvironmentToneMapperexposure
floatwhite
float
EnvironmentSetVolumetricFog(Rid, bool, float, Color, Color, float, float, float, float, float, bool, float, float, float)
Sets the variables to be used with the volumetric fog post-process effect. See Environment for more details.
public void EnvironmentSetVolumetricFog(Rid env, bool enable, float density, Color albedo, Color emission, float emissionEnergy, float anisotropy, float length, float pDetailSpread, float gIInject, bool temporalReprojection, float temporalReprojectionAmount, float ambientInject, float skyAffect)
Parameters
env
Ridenable
booldensity
floatalbedo
Coloremission
ColoremissionEnergy
floatanisotropy
floatlength
floatpDetailSpread
floatgIInject
floattemporalReprojection
booltemporalReprojectionAmount
floatambientInject
floatskyAffect
float
EnvironmentSetVolumetricFogFilterActive(bool)
Enables filtering of the volumetric fog scattering buffer. This results in much smoother volumes with very few under-sampling artifacts.
public void EnvironmentSetVolumetricFogFilterActive(bool active)
Parameters
active
bool
EnvironmentSetVolumetricFogVolumeSize(int, int)
Sets the resolution of the volumetric fog's froxel buffer. size
is modified by the screen's aspect ratio and then used to set the width and height of the buffer. While depth
is directly used to set the depth of the buffer.
public void EnvironmentSetVolumetricFogVolumeSize(int size, int depth)
Parameters
FogVolumeCreate()
Creates a new fog volume and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all fog_volume_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent node is FogVolume.
public Rid FogVolumeCreate()
Returns
FogVolumeSetMaterial(Rid, Rid)
Sets the Material of the fog volume. Can be either a FogMaterial or a custom ShaderMaterial.
public void FogVolumeSetMaterial(Rid fogVolume, Rid material)
Parameters
FogVolumeSetShape(Rid, FogVolumeShape)
public void FogVolumeSetShape(Rid fogVolume, RenderingServer.FogVolumeShape shape)
Parameters
fogVolume
Ridshape
RenderingServer.FogVolumeShape
FogVolumeSetSize(Rid, Vector3)
public void FogVolumeSetSize(Rid fogVolume, Vector3 size)
Parameters
ForceDraw(bool, double)
Forces redrawing of all viewports at once. Must be called from the main thread.
public void ForceDraw(bool swapBuffers = true, double frameStep = 0)
Parameters
ForceSync()
Forces a synchronization between the CPU and GPU, which may be required in certain cases. Only call this when needed, as CPU-GPU synchronization has a performance cost.
public void ForceSync()
FreeRid(Rid)
Tries to free an object in the RenderingServer. To avoid memory leaks, this should be called after using an object as memory management does not occur automatically when using RenderingServer directly.
public void FreeRid(Rid rid)
Parameters
rid
Rid
GISetUseHalfResolution(bool)
If halfResolution
is true
, renders VoxelGI and SDFGI (SdfgiEnabled) buffers at halved resolution on each axis (e.g. 960×540 when the viewport size is 1920×1080). This improves performance significantly when VoxelGI or SDFGI is enabled, at the cost of artifacts that may be visible on polygon edges. The loss in quality becomes less noticeable as the viewport resolution increases. LightmapGI rendering is not affected by this setting. Equivalent to ProjectSettings.rendering/global_illumination/gi/use_half_resolution
.
public void GISetUseHalfResolution(bool halfResolution)
Parameters
halfResolution
bool
GetDefaultClearColor()
Returns the default clear color which is used when a specific clear color has not been selected. See also SetDefaultClearColor(Color).
public Color GetDefaultClearColor()
Returns
GetFrameSetupTimeCpu()
Returns the time taken to setup rendering on the CPU in milliseconds. This value is shared across all viewports and does not require ViewportSetMeasureRenderTime(Rid, bool) to be enabled on a viewport to be queried. See also ViewportGetMeasuredRenderTimeCpu(Rid).
public double GetFrameSetupTimeCpu()
Returns
GetRenderingDevice()
Returns the global RenderingDevice.
Note: When using the OpenGL backend or when running in headless mode, this function always returns null
.
public RenderingDevice GetRenderingDevice()
Returns
GetRenderingInfo(RenderingInfo)
Returns a statistic about the rendering engine which can be used for performance profiling. See RenderingServer.RenderingInfo for a list of values that can be queried. See also ViewportGetRenderInfo(Rid, ViewportRenderInfoType, ViewportRenderInfo), which returns information specific to a viewport.
Note: Only 3D rendering is currently taken into account by some of these values, such as the number of draw calls.
Note: Rendering information is not available until at least 2 frames have been rendered by the engine. If rendering information is not available, GetRenderingInfo(RenderingInfo) returns 0
. To print rendering information in _ready()
successfully, use the following:
func _ready():
for _i in 2:
await get_tree().process_frame
print(RenderingServer.get_rendering_info(RENDERING_INFO_TOTAL_DRAW_CALLS_IN_FRAME))</code></pre>
public ulong GetRenderingInfo(RenderingServer.RenderingInfo info)
Parameters
Returns
GetShaderParameterList(Rid)
Returns the parameters of a shader.
public Array<Dictionary> GetShaderParameterList(Rid shader)
Parameters
shader
Rid
Returns
GetTestCube()
Returns the RID of the test cube. This mesh will be created and returned on the first call to GetTestCube(), then it will be cached for subsequent calls. See also MakeSphereMesh(int, int, float).
public Rid GetTestCube()
Returns
GetTestTexture()
Returns the RID of a 256×256 texture with a testing pattern on it (in Rgb8 format). This texture will be created and returned on the first call to GetTestTexture(), then it will be cached for subsequent calls. See also GetWhiteTexture().
Example of getting the test texture and applying it to a Sprite2D node:
var texture_rid = RenderingServer.get_test_texture()
var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid))
$Sprite2D.texture = texture
public Rid GetTestTexture()
Returns
GetVideoAdapterApiVersion()
Returns the version of the graphics video adapter currently in use (e.g. "1.2.189" for Vulkan, "3.3.0 NVIDIA 510.60.02" for OpenGL). This version may be different from the actual latest version supported by the hardware, as Godot may not always request the latest version. See also GetVideoAdapterDriverInfo().
Note: When running a headless or server binary, this function returns an empty string.
public string GetVideoAdapterApiVersion()
Returns
GetVideoAdapterName()
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.
Note: On the web platform, some browsers such as Firefox may report a different, fixed GPU name such as "GeForce GTX 980" (regardless of the user's actual GPU model). This is done to make fingerprinting more difficult.
public string GetVideoAdapterName()
Returns
GetVideoAdapterType()
Returns the type of the video adapter. Since dedicated graphics cards from a given generation will usually be significantly faster than integrated graphics made in the same generation, the device type can be used as a basis for automatic graphics settings adjustment. However, this is not always true, so make sure to provide users with a way to manually override graphics settings.
Note: When using the OpenGL backend or when running in headless mode, this function always returns Other.
public RenderingDevice.DeviceType GetVideoAdapterType()
Returns
GetVideoAdapterVendor()
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.
public string GetVideoAdapterVendor()
Returns
GetWhiteTexture()
Returns the ID of a 4×4 white texture (in Rgb8 format). This texture will be created and returned on the first call to GetWhiteTexture(), then it will be cached for subsequent calls. See also GetTestTexture().
Example of getting the white texture and applying it to a Sprite2D node:
var texture_rid = RenderingServer.get_white_texture()
var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid))
$Sprite2D.texture = texture
public Rid GetWhiteTexture()
Returns
GlobalShaderParameterAdd(StringName, GlobalShaderParameterType, Variant)
Creates a new global shader uniform.
Note: Global shader parameter names are case-sensitive.
public void GlobalShaderParameterAdd(StringName name, RenderingServer.GlobalShaderParameterType type, Variant defaultValue)
Parameters
name
StringNametype
RenderingServer.GlobalShaderParameterTypedefaultValue
Variant
GlobalShaderParameterGet(StringName)
Returns the value of the global shader uniform specified by name
.
Note: GlobalShaderParameterGet(StringName) has a large performance penalty as the rendering thread needs to synchronize with the calling thread, which is slow. Do not use this method during gameplay to avoid stuttering. If you need to read values in a script after setting them, consider creating an autoload where you store the values you need to query at the same time you're setting them as global parameters.
public Variant GlobalShaderParameterGet(StringName name)
Parameters
name
StringName
Returns
GlobalShaderParameterGetList()
Returns the list of global shader uniform names.
Note: GlobalShaderParameterGet(StringName) has a large performance penalty as the rendering thread needs to synchronize with the calling thread, which is slow. Do not use this method during gameplay to avoid stuttering. If you need to read values in a script after setting them, consider creating an autoload where you store the values you need to query at the same time you're setting them as global parameters.
public Array<StringName> GlobalShaderParameterGetList()
Returns
GlobalShaderParameterGetType(StringName)
Returns the type associated to the global shader uniform specified by name
.
Note: GlobalShaderParameterGet(StringName) has a large performance penalty as the rendering thread needs to synchronize with the calling thread, which is slow. Do not use this method during gameplay to avoid stuttering. If you need to read values in a script after setting them, consider creating an autoload where you store the values you need to query at the same time you're setting them as global parameters.
public RenderingServer.GlobalShaderParameterType GlobalShaderParameterGetType(StringName name)
Parameters
name
StringName
Returns
GlobalShaderParameterRemove(StringName)
Removes the global shader uniform specified by name
.
public void GlobalShaderParameterRemove(StringName name)
Parameters
name
StringName
GlobalShaderParameterSet(StringName, Variant)
Sets the global shader uniform name
to value
.
public void GlobalShaderParameterSet(StringName name, Variant value)
Parameters
name
StringNamevalue
Variant
GlobalShaderParameterSetOverride(StringName, Variant)
Overrides the global shader uniform name
with value
. Equivalent to the ShaderGlobalsOverride node.
public void GlobalShaderParameterSetOverride(StringName name, Variant value)
Parameters
name
StringNamevalue
Variant
HasChanged()
Returns true
if changes have been made to the RenderingServer's data. ForceDraw(bool, double) is usually called if this happens.
public bool HasChanged()
Returns
HasFeature(Features)
Not yet implemented. Always returns false
.
public bool HasFeature(RenderingServer.Features feature)
Parameters
feature
RenderingServer.Features
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
HasOsFeature(string)
Returns true
if the OS supports a certain feature
. Features might be s3tc
, etc
, and etc2
.
public bool HasOsFeature(string feature)
Parameters
feature
string
Returns
InstanceAttachObjectInstanceId(Rid, ulong)
Attaches a unique Object ID to instance. Object ID must be attached to instance for proper culling with InstancesCullAabb(Aabb, Rid), InstancesCullConvex(Array<Plane>, Rid), and InstancesCullRay(Vector3, Vector3, Rid).
public void InstanceAttachObjectInstanceId(Rid instance, ulong id)
Parameters
InstanceAttachSkeleton(Rid, Rid)
Attaches a skeleton to an instance. Removes the previous skeleton from the instance.
public void InstanceAttachSkeleton(Rid instance, Rid skeleton)
Parameters
InstanceCreate()
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 instance_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
An instance is a way of placing a 3D object in the scenario. Objects like particles, meshes, reflection probes and decals need to be associated with an instance to be visible in the scenario using InstanceSetBase(Rid, Rid).
Note: The equivalent node is VisualInstance3D.
public Rid InstanceCreate()
Returns
InstanceCreate2(Rid, Rid)
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 instance_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method. This is a shorthand for using InstanceCreate() and setting the base and scenario manually.
public Rid InstanceCreate2(Rid @base, Rid scenario)
Parameters
Returns
InstanceGeometryGetShaderParameter(Rid, StringName)
Returns the value of the per-instance shader uniform from the specified 3D geometry instance. Equivalent to GetInstanceShaderParameter(StringName).
Note: Per-instance shader parameter names are case-sensitive.
public Variant InstanceGeometryGetShaderParameter(Rid instance, StringName parameter)
Parameters
instance
Ridparameter
StringName
Returns
InstanceGeometryGetShaderParameterDefaultValue(Rid, StringName)
Returns the default value of the per-instance shader uniform from the specified 3D geometry instance. Equivalent to GetInstanceShaderParameter(StringName).
public Variant InstanceGeometryGetShaderParameterDefaultValue(Rid instance, StringName parameter)
Parameters
instance
Ridparameter
StringName
Returns
InstanceGeometryGetShaderParameterList(Rid)
Returns a dictionary of per-instance shader uniform names of the per-instance shader uniform from the specified 3D geometry instance. The returned dictionary is in PropertyInfo format, with the keys name
, class_name
, type
, hint
, hint_string
and usage
. Equivalent to GetInstanceShaderParameter(StringName).
public Array<Dictionary> InstanceGeometryGetShaderParameterList(Rid instance)
Parameters
instance
Rid
Returns
InstanceGeometrySetCastShadowsSetting(Rid, ShadowCastingSetting)
Sets the shadow casting setting to one of RenderingServer.ShadowCastingSetting. Equivalent to CastShadow.
public void InstanceGeometrySetCastShadowsSetting(Rid instance, RenderingServer.ShadowCastingSetting shadowCastingSetting)
Parameters
instance
RidshadowCastingSetting
RenderingServer.ShadowCastingSetting
InstanceGeometrySetFlag(Rid, InstanceFlags, bool)
Sets the flag for a given RenderingServer.InstanceFlags. See RenderingServer.InstanceFlags for more details.
public void InstanceGeometrySetFlag(Rid instance, RenderingServer.InstanceFlags flag, bool enabled)
Parameters
instance
Ridflag
RenderingServer.InstanceFlagsenabled
bool
InstanceGeometrySetLightmap(Rid, Rid, Rect2, int)
Sets the lightmap GI instance to use for the specified 3D geometry instance. The lightmap UV scale for the specified instance (equivalent to GILightmapScale) and lightmap atlas slice must also be specified.
public void InstanceGeometrySetLightmap(Rid instance, Rid lightmap, Rect2 lightmapUVScale, int lightmapSlice)
Parameters
InstanceGeometrySetLodBias(Rid, float)
Sets the level of detail bias to use when rendering the specified 3D geometry instance. Higher values result in higher detail from further away. Equivalent to LodBias.
public void InstanceGeometrySetLodBias(Rid instance, float lodBias)
Parameters
InstanceGeometrySetMaterialOverlay(Rid, Rid)
Sets a material that will be rendered for all surfaces on top of active materials for the mesh associated with this instance. Equivalent to MaterialOverlay.
public void InstanceGeometrySetMaterialOverlay(Rid instance, Rid material)
Parameters
InstanceGeometrySetMaterialOverride(Rid, Rid)
Sets a material that will override the material for all surfaces on the mesh associated with this instance. Equivalent to MaterialOverride.
public void InstanceGeometrySetMaterialOverride(Rid instance, Rid material)
Parameters
InstanceGeometrySetShaderParameter(Rid, StringName, Variant)
Sets the per-instance shader uniform on the specified 3D geometry instance. Equivalent to SetInstanceShaderParameter(StringName, Variant).
public void InstanceGeometrySetShaderParameter(Rid instance, StringName parameter, Variant value)
Parameters
instance
Ridparameter
StringNamevalue
Variant
InstanceGeometrySetTransparency(Rid, float)
Sets the transparency for the given geometry instance. Equivalent to Transparency.
A transparency of 0.0
is fully opaque, while 1.0
is fully transparent. Values greater than 0.0
(exclusive) will force the geometry's materials to go through the transparent pipeline, which is slower to render and can exhibit rendering issues due to incorrect transparency sorting. However, unlike using a transparent material, setting transparency
to a value greater than 0.0
(exclusive) will not disable shadow rendering.
In spatial shaders, 1.0 - transparency
is set as the default value of the ALPHA
built-in.
Note:
transparency
is clamped between 0.0
and 1.0
, so this property cannot be used to make transparent materials more opaque than they originally are.
public void InstanceGeometrySetTransparency(Rid instance, float transparency)
Parameters
InstanceGeometrySetVisibilityRange(Rid, float, float, float, float, VisibilityRangeFadeMode)
Sets the visibility range values for the given geometry instance. Equivalent to VisibilityRangeBegin and related properties.
public void InstanceGeometrySetVisibilityRange(Rid instance, float min, float max, float minMargin, float maxMargin, RenderingServer.VisibilityRangeFadeMode fadeMode)
Parameters
instance
Ridmin
floatmax
floatminMargin
floatmaxMargin
floatfadeMode
RenderingServer.VisibilityRangeFadeMode
InstanceSetBase(Rid, Rid)
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, particle system, reflection probe, decal, lightmap, voxel GI and visibility notifiers are all types that can be set as the base of an instance in order to be displayed in the scenario.
public void InstanceSetBase(Rid instance, Rid @base)
Parameters
InstanceSetBlendShapeWeight(Rid, int, float)
Sets the weight for a given blend shape associated with this instance.
public void InstanceSetBlendShapeWeight(Rid instance, int shape, float weight)
Parameters
InstanceSetCustomAabb(Rid, Aabb)
Sets a custom AABB to use when culling objects from the view frustum. Equivalent to setting CustomAabb.
public void InstanceSetCustomAabb(Rid instance, Aabb aabb)
Parameters
InstanceSetExtraVisibilityMargin(Rid, float)
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 ExtraCullMargin.
public void InstanceSetExtraVisibilityMargin(Rid instance, float margin)
Parameters
InstanceSetIgnoreCulling(Rid, bool)
If true
, ignores both frustum and occlusion culling on the specified 3D geometry instance. This is not the same as IgnoreOcclusionCulling, which only ignores occlusion culling and leaves frustum culling intact.
public void InstanceSetIgnoreCulling(Rid instance, bool enabled)
Parameters
InstanceSetLayerMask(Rid, uint)
Sets the render layers that this instance will be drawn to. Equivalent to Layers.
public void InstanceSetLayerMask(Rid instance, uint mask)
Parameters
InstanceSetPivotData(Rid, float, bool)
Sets the sorting offset and switches between using the bounding box or instance origin for depth sorting.
public void InstanceSetPivotData(Rid instance, float sortingOffset, bool useAabbCenter)
Parameters
InstanceSetScenario(Rid, Rid)
Sets the scenario that the instance is in. The scenario is the 3D world that the objects will be displayed in.
public void InstanceSetScenario(Rid instance, Rid scenario)
Parameters
InstanceSetSurfaceOverrideMaterial(Rid, int, Rid)
Sets the override material of a specific surface. Equivalent to SetSurfaceOverrideMaterial(int, Material).
public void InstanceSetSurfaceOverrideMaterial(Rid instance, int surface, Rid material)
Parameters
InstanceSetTransform(Rid, Transform3D)
Sets the world space transform of the instance. Equivalent to GlobalTransform.
public void InstanceSetTransform(Rid instance, Transform3D transform)
Parameters
instance
Ridtransform
Transform3D
InstanceSetVisibilityParent(Rid, Rid)
Sets the visibility parent for the given instance. Equivalent to VisibilityParent.
public void InstanceSetVisibilityParent(Rid instance, Rid parent)
Parameters
InstanceSetVisible(Rid, bool)
Sets whether an instance is drawn or not. Equivalent to Visible.
public void InstanceSetVisible(Rid instance, bool visible)
Parameters
InstancesCullAabb(Aabb, Rid)
Returns an array of object IDs intersecting with the provided AABB. Only 3D nodes that inherit from VisualInstance3D are considered, such as MeshInstance3D or DirectionalLight3D. Use @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.
Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
public long[] InstancesCullAabb(Aabb aabb, Rid scenario = default)
Parameters
Returns
- long[]
InstancesCullConvex(Array<Plane>, Rid)
Returns an array of object IDs intersecting with the provided convex shape. Only 3D nodes that inherit from VisualInstance3D are considered, such as MeshInstance3D or DirectionalLight3D. Use @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.
Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
public long[] InstancesCullConvex(Array<Plane> convex, Rid scenario = default)
Parameters
Returns
- long[]
InstancesCullRay(Vector3, Vector3, Rid)
Returns an array of object IDs intersecting with the provided 3D ray. Only 3D nodes that inherit from VisualInstance3D are considered, such as MeshInstance3D or DirectionalLight3D. Use @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.
Warning: This function is primarily intended for editor usage. For in-game use cases, prefer physics collision.
public long[] InstancesCullRay(Vector3 from, Vector3 to, Rid scenario = default)
Parameters
Returns
- long[]
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
LightDirectionalSetBlendSplits(Rid, bool)
If true
, this directional light will blend between shadow map splits resulting in a smoother transition between them. Equivalent to DirectionalShadowBlendSplits.
public void LightDirectionalSetBlendSplits(Rid light, bool enable)
Parameters
LightDirectionalSetShadowMode(Rid, LightDirectionalShadowMode)
Sets the shadow mode for this directional light. Equivalent to DirectionalShadowMode. See RenderingServer.LightDirectionalShadowMode for options.
public void LightDirectionalSetShadowMode(Rid light, RenderingServer.LightDirectionalShadowMode mode)
Parameters
light
Ridmode
RenderingServer.LightDirectionalShadowMode
LightDirectionalSetSkyMode(Rid, LightDirectionalSkyMode)
If true
, 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.
public void LightDirectionalSetSkyMode(Rid light, RenderingServer.LightDirectionalSkyMode mode)
Parameters
light
Ridmode
RenderingServer.LightDirectionalSkyMode
LightOmniSetShadowMode(Rid, LightOmniShadowMode)
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 OmniShadowMode.
public void LightOmniSetShadowMode(Rid light, RenderingServer.LightOmniShadowMode mode)
Parameters
light
Ridmode
RenderingServer.LightOmniShadowMode
LightProjectorsSetFilter(LightProjectorFilter)
Sets the texture filter mode to use when rendering light projectors. This parameter is global and cannot be set on a per-light basis.
public void LightProjectorsSetFilter(RenderingServer.LightProjectorFilter filter)
Parameters
LightSetBakeMode(Rid, LightBakeMode)
Sets the bake mode to use for the specified 3D light. Equivalent to LightBakeMode.
public void LightSetBakeMode(Rid light, RenderingServer.LightBakeMode bakeMode)
Parameters
light
RidbakeMode
RenderingServer.LightBakeMode
LightSetColor(Rid, Color)
Sets the color of the light. Equivalent to LightColor.
public void LightSetColor(Rid light, Color color)
Parameters
LightSetCullMask(Rid, uint)
Sets the cull mask for this 3D light. Lights only affect objects in the selected layers. Equivalent to LightCullMask.
public void LightSetCullMask(Rid light, uint mask)
Parameters
LightSetDistanceFade(Rid, bool, float, float, float)
Sets the distance fade for this 3D light. This acts as a form of level of detail (LOD) and can be used to improve performance. Equivalent to DistanceFadeEnabled, DistanceFadeBegin, DistanceFadeShadow, and DistanceFadeLength.
public void LightSetDistanceFade(Rid decal, bool enabled, float begin, float shadow, float length)
Parameters
LightSetMaxSdfgiCascade(Rid, uint)
Sets the maximum SDFGI cascade in which the 3D light's indirect lighting is rendered. Higher values allow the light to be rendered in SDFGI further away from the camera.
public void LightSetMaxSdfgiCascade(Rid light, uint cascade)
Parameters
LightSetNegative(Rid, bool)
If true
, the 3D light will subtract light instead of adding light. Equivalent to LightNegative.
public void LightSetNegative(Rid light, bool enable)
Parameters
LightSetParam(Rid, LightParam, float)
Sets the specified 3D light parameter. See RenderingServer.LightParam for options. Equivalent to Godot.Light3D.SetParam(Godot.Light3D.Param,System.Single).
public void LightSetParam(Rid light, RenderingServer.LightParam param, float value)
Parameters
light
Ridparam
RenderingServer.LightParamvalue
float
LightSetProjector(Rid, Rid)
Sets the projector texture to use for the specified 3D light. Equivalent to LightProjector.
public void LightSetProjector(Rid light, Rid texture)
Parameters
LightSetReverseCullFaceMode(Rid, bool)
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 InstanceGeometrySetCastShadowsSetting(Rid, ShadowCastingSetting). Equivalent to ShadowReverseCullFace.
public void LightSetReverseCullFaceMode(Rid light, bool enabled)
Parameters
LightSetShadow(Rid, bool)
If true
, light will cast shadows. Equivalent to ShadowEnabled.
public void LightSetShadow(Rid light, bool enabled)
Parameters
LightmapCreate()
Creates a new lightmap global illumination instance and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all lightmap_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent node is LightmapGI.
public Rid LightmapCreate()
Returns
LightmapGetProbeCaptureBspTree(Rid)
public int[] LightmapGetProbeCaptureBspTree(Rid lightmap)
Parameters
lightmap
Rid
Returns
- int[]
LightmapGetProbeCapturePoints(Rid)
public Vector3[] LightmapGetProbeCapturePoints(Rid lightmap)
Parameters
lightmap
Rid
Returns
- Vector3[]
LightmapGetProbeCaptureSh(Rid)
public Color[] LightmapGetProbeCaptureSh(Rid lightmap)
Parameters
lightmap
Rid
Returns
- Color[]
LightmapGetProbeCaptureTetrahedra(Rid)
public int[] LightmapGetProbeCaptureTetrahedra(Rid lightmap)
Parameters
lightmap
Rid
Returns
- int[]
LightmapSetBakedExposureNormalization(Rid, float)
Used to inform the renderer what exposure normalization value was used while baking the lightmap. This value will be used and modulated at run time to ensure that the lightmap maintains a consistent level of exposure even if the scene-wide exposure normalization is changed at run time. For more information see CameraAttributesSetExposure(Rid, float, float).
public void LightmapSetBakedExposureNormalization(Rid lightmap, float bakedExposure)
Parameters
LightmapSetProbeBounds(Rid, Aabb)
public void LightmapSetProbeBounds(Rid lightmap, Aabb bounds)
Parameters
LightmapSetProbeCaptureData(Rid, Vector3[], Color[], int[], int[])
public void LightmapSetProbeCaptureData(Rid lightmap, Vector3[] points, Color[] pointSh, int[] tetrahedra, int[] bspTree)
Parameters
LightmapSetProbeCaptureUpdateSpeed(float)
public void LightmapSetProbeCaptureUpdateSpeed(float speed)
Parameters
speed
float
LightmapSetProbeInterior(Rid, bool)
public void LightmapSetProbeInterior(Rid lightmap, bool interior)
Parameters
LightmapSetTextures(Rid, Rid, bool)
Set the textures on the given lightmap
GI instance to the texture array pointed to by the light
RID. If the lightmap texture was baked with Directional set to true
, then usesSh
must also be true
.
public void LightmapSetTextures(Rid lightmap, Rid light, bool usesSh)
Parameters
MakeSphereMesh(int, int, float)
Returns a mesh of a sphere with the given number of horizontal subdivisions, vertical subdivisions and radius. See also GetTestCube().
public Rid MakeSphereMesh(int latitudes, int longitudes, float radius)
Parameters
Returns
MaterialCreate()
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 material_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent resource is Material.
public Rid MaterialCreate()
Returns
MaterialGetParam(Rid, StringName)
Returns the value of a certain material's parameter.
public Variant MaterialGetParam(Rid material, StringName parameter)
Parameters
material
Ridparameter
StringName
Returns
MaterialSetNextPass(Rid, Rid)
Sets an object's next material.
public void MaterialSetNextPass(Rid material, Rid nextMaterial)
Parameters
MaterialSetParam(Rid, StringName, Variant)
Sets a material's parameter.
public void MaterialSetParam(Rid material, StringName parameter, Variant value)
Parameters
material
Ridparameter
StringNamevalue
Variant
MaterialSetRenderPriority(Rid, int)
Sets a material's render priority.
public void MaterialSetRenderPriority(Rid material, int priority)
Parameters
MaterialSetShader(Rid, Rid)
Sets a shader material's shader.
public void MaterialSetShader(Rid shaderMaterial, Rid shader)
Parameters
MeshAddSurface(Rid, Dictionary)
public void MeshAddSurface(Rid mesh, Dictionary surface)
Parameters
mesh
Ridsurface
Dictionary
MeshAddSurfaceFromArrays(Rid, PrimitiveType, Array, Array, Dictionary, ArrayFormat)
public void MeshAddSurfaceFromArrays(Rid mesh, RenderingServer.PrimitiveType primitive, Array arrays, Array blendShapes = null, Dictionary lods = null, RenderingServer.ArrayFormat compressFormat = ArrayFormat.FlagFormatVersion1)
Parameters
mesh
Ridprimitive
RenderingServer.PrimitiveTypearrays
ArrayblendShapes
Arraylods
DictionarycompressFormat
RenderingServer.ArrayFormat
MeshClear(Rid)
Removes all surfaces from a mesh.
public void MeshClear(Rid mesh)
Parameters
mesh
Rid
MeshCreate()
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 mesh_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
To place in a scene, attach this mesh to an instance using InstanceSetBase(Rid, Rid) using the returned RID.
Note: The equivalent resource is Mesh.
public Rid MeshCreate()
Returns
MeshCreateFromSurfaces(Array<Dictionary>, int)
public Rid MeshCreateFromSurfaces(Array<Dictionary> surfaces, int blendShapeCount = 0)
Parameters
surfaces
Array<Dictionary>blendShapeCount
int
Returns
MeshGetBlendShapeCount(Rid)
Returns a mesh's blend shape count.
public int MeshGetBlendShapeCount(Rid mesh)
Parameters
mesh
Rid
Returns
MeshGetBlendShapeMode(Rid)
Returns a mesh's blend shape mode.
public RenderingServer.BlendShapeMode MeshGetBlendShapeMode(Rid mesh)
Parameters
mesh
Rid
Returns
MeshGetCustomAabb(Rid)
Returns a mesh's custom aabb.
public Aabb MeshGetCustomAabb(Rid mesh)
Parameters
mesh
Rid
Returns
MeshGetSurface(Rid, int)
public Dictionary MeshGetSurface(Rid mesh, int surface)
Parameters
Returns
MeshGetSurfaceCount(Rid)
Returns a mesh's number of surfaces.
public int MeshGetSurfaceCount(Rid mesh)
Parameters
mesh
Rid
Returns
MeshSetBlendShapeMode(Rid, BlendShapeMode)
Sets a mesh's blend shape mode.
public void MeshSetBlendShapeMode(Rid mesh, RenderingServer.BlendShapeMode mode)
Parameters
mesh
Ridmode
RenderingServer.BlendShapeMode
MeshSetCustomAabb(Rid, Aabb)
Sets a mesh's custom aabb.
public void MeshSetCustomAabb(Rid mesh, Aabb aabb)
Parameters
MeshSetShadowMesh(Rid, Rid)
public void MeshSetShadowMesh(Rid mesh, Rid shadowMesh)
Parameters
MeshSurfaceGetArrays(Rid, int)
Returns a mesh's surface's buffer arrays.
public Array MeshSurfaceGetArrays(Rid mesh, int surface)
Parameters
Returns
MeshSurfaceGetBlendShapeArrays(Rid, int)
Returns a mesh's surface's arrays for blend shapes.
public Array<Array> MeshSurfaceGetBlendShapeArrays(Rid mesh, int surface)
Parameters
Returns
MeshSurfaceGetFormatAttributeStride(ArrayFormat, int)
Returns the stride of the attribute buffer for a mesh with given format
.
public uint MeshSurfaceGetFormatAttributeStride(RenderingServer.ArrayFormat format, int vertexCount)
Parameters
format
RenderingServer.ArrayFormatvertexCount
int
Returns
MeshSurfaceGetFormatNormalTangentStride(ArrayFormat, int)
Returns the stride of the combined normals and tangents for a mesh with given format
. Note importantly that, while normals and tangents are in the vertex buffer with vertices, they are only interleaved with each other and so have a different stride than vertex positions.
public uint MeshSurfaceGetFormatNormalTangentStride(RenderingServer.ArrayFormat format, int vertexCount)
Parameters
format
RenderingServer.ArrayFormatvertexCount
int
Returns
MeshSurfaceGetFormatOffset(ArrayFormat, int, int)
Returns the offset of a given attribute by arrayIndex
in the start of its respective buffer.
public uint MeshSurfaceGetFormatOffset(RenderingServer.ArrayFormat format, int vertexCount, int arrayIndex)
Parameters
format
RenderingServer.ArrayFormatvertexCount
intarrayIndex
int
Returns
MeshSurfaceGetFormatSkinStride(ArrayFormat, int)
Returns the stride of the skin buffer for a mesh with given format
.
public uint MeshSurfaceGetFormatSkinStride(RenderingServer.ArrayFormat format, int vertexCount)
Parameters
format
RenderingServer.ArrayFormatvertexCount
int
Returns
MeshSurfaceGetFormatVertexStride(ArrayFormat, int)
Returns the stride of the vertex positions for a mesh with given format
. Note importantly that vertex positions are stored consecutively and are not interleaved with the other attributes in the vertex buffer (normals and tangents).
public uint MeshSurfaceGetFormatVertexStride(RenderingServer.ArrayFormat format, int vertexCount)
Parameters
format
RenderingServer.ArrayFormatvertexCount
int
Returns
MeshSurfaceGetMaterial(Rid, int)
Returns a mesh's surface's material.
public Rid MeshSurfaceGetMaterial(Rid mesh, int surface)
Parameters
Returns
MeshSurfaceSetMaterial(Rid, int, Rid)
Sets a mesh's surface's material.
public void MeshSurfaceSetMaterial(Rid mesh, int surface, Rid material)
Parameters
MeshSurfaceUpdateAttributeRegion(Rid, int, int, byte[])
public void MeshSurfaceUpdateAttributeRegion(Rid mesh, int surface, int offset, byte[] data)
Parameters
MeshSurfaceUpdateSkinRegion(Rid, int, int, byte[])
public void MeshSurfaceUpdateSkinRegion(Rid mesh, int surface, int offset, byte[] data)
Parameters
MeshSurfaceUpdateVertexRegion(Rid, int, int, byte[])
public void MeshSurfaceUpdateVertexRegion(Rid mesh, int surface, int offset, byte[] data)
Parameters
MultimeshAllocateData(Rid, int, MultimeshTransformFormat, bool, bool)
public void MultimeshAllocateData(Rid multimesh, int instances, RenderingServer.MultimeshTransformFormat transformFormat, bool colorFormat = false, bool customDataFormat = false)
Parameters
multimesh
Ridinstances
inttransformFormat
RenderingServer.MultimeshTransformFormatcolorFormat
boolcustomDataFormat
bool
MultimeshCreate()
Creates a new multimesh on the RenderingServer and returns an Rid handle. This RID will be used in all multimesh_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
To place in a scene, attach this multimesh to an instance using InstanceSetBase(Rid, Rid) using the returned RID.
Note: The equivalent resource is MultiMesh.
public Rid MultimeshCreate()
Returns
MultimeshGetAabb(Rid)
Calculates and returns the axis-aligned bounding box that encloses all instances within the multimesh.
public Aabb MultimeshGetAabb(Rid multimesh)
Parameters
multimesh
Rid
Returns
MultimeshGetBuffer(Rid)
Returns the MultiMesh data (such as instance transforms, colors, etc). See MultimeshSetBuffer(Rid, float[]) for a description of the returned data.
Note: If the buffer is in the engine's internal cache, it will have to be fetched from GPU memory and possibly decompressed. This means MultimeshGetBuffer(Rid) is potentially a slow operation and should be avoided whenever possible.
public float[] MultimeshGetBuffer(Rid multimesh)
Parameters
multimesh
Rid
Returns
- float[]
MultimeshGetInstanceCount(Rid)
Returns the number of instances allocated for this multimesh.
public int MultimeshGetInstanceCount(Rid multimesh)
Parameters
multimesh
Rid
Returns
MultimeshGetMesh(Rid)
Returns the RID of the mesh that will be used in drawing this multimesh.
public Rid MultimeshGetMesh(Rid multimesh)
Parameters
multimesh
Rid
Returns
MultimeshGetVisibleInstances(Rid)
Returns the number of visible instances for this multimesh.
public int MultimeshGetVisibleInstances(Rid multimesh)
Parameters
multimesh
Rid
Returns
MultimeshInstanceGetColor(Rid, int)
Returns the color by which the specified instance will be modulated.
public Color MultimeshInstanceGetColor(Rid multimesh, int index)
Parameters
Returns
MultimeshInstanceGetCustomData(Rid, int)
Returns the custom data associated with the specified instance.
public Color MultimeshInstanceGetCustomData(Rid multimesh, int index)
Parameters
Returns
MultimeshInstanceGetTransform(Rid, int)
Returns the Transform3D of the specified instance.
public Transform3D MultimeshInstanceGetTransform(Rid multimesh, int index)
Parameters
Returns
MultimeshInstanceGetTransform2D(Rid, int)
Returns the Transform2D of the specified instance. For use when the multimesh is set to use 2D transforms.
public Transform2D MultimeshInstanceGetTransform2D(Rid multimesh, int index)
Parameters
Returns
MultimeshInstanceSetColor(Rid, int, Color)
Sets the color by which this instance will be modulated. Equivalent to SetInstanceColor(int, Color).
public void MultimeshInstanceSetColor(Rid multimesh, int index, Color color)
Parameters
MultimeshInstanceSetCustomData(Rid, int, Color)
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 SetInstanceCustomData(int, Color).
public void MultimeshInstanceSetCustomData(Rid multimesh, int index, Color customData)
Parameters
MultimeshInstanceSetTransform(Rid, int, Transform3D)
Sets the Transform3D for this instance. Equivalent to SetInstanceTransform(int, Transform3D).
public void MultimeshInstanceSetTransform(Rid multimesh, int index, Transform3D transform)
Parameters
multimesh
Ridindex
inttransform
Transform3D
MultimeshInstanceSetTransform2D(Rid, int, Transform2D)
Sets the Transform2D for this instance. For use when multimesh is used in 2D. Equivalent to SetInstanceTransform2D(int, Transform2D).
public void MultimeshInstanceSetTransform2D(Rid multimesh, int index, Transform2D transform)
Parameters
multimesh
Ridindex
inttransform
Transform2D
MultimeshSetBuffer(Rid, float[])
Set the entire data to use for drawing the multimesh
at once to buffer
(such as instance transforms and colors). buffer
's size must match the number of instances multiplied by the per-instance data size (which depends on the enabled MultiMesh fields). Otherwise, an error message is printed and nothing is rendered. See also MultimeshGetBuffer(Rid).
The per-instance data size and expected data order is:
2D:
- Position: 8 floats (8 floats for Transform2D)
- Position + Vertex color: 12 floats (8 floats for Transform2D, 4 floats for Color)
- Position + Custom data: 12 floats (8 floats for Transform2D, 4 floats of custom data)
- Position + Vertex color + Custom data: 16 floats (8 floats for Transform2D, 4 floats for Color, 4 floats of custom data)
3D:
- Position: 12 floats (12 floats for Transform3D)
- Position + Vertex color: 16 floats (12 floats for Transform3D, 4 floats for Color)
- Position + Custom data: 16 floats (12 floats for Transform3D, 4 floats of custom data)
- Position + Vertex color + Custom data: 20 floats (12 floats for Transform3D, 4 floats for Color, 4 floats of custom data)
public void MultimeshSetBuffer(Rid multimesh, float[] buffer)
Parameters
MultimeshSetMesh(Rid, Rid)
Sets the mesh to be drawn by the multimesh. Equivalent to Mesh.
public void MultimeshSetMesh(Rid multimesh, Rid mesh)
Parameters
MultimeshSetVisibleInstances(Rid, int)
Sets the number of instances visible at a given time. If -1, all instances that have been allocated are drawn. Equivalent to VisibleInstanceCount.
public void MultimeshSetVisibleInstances(Rid multimesh, int visible)
Parameters
OccluderCreate()
Creates an occluder instance and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all occluder_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent resource is Occluder3D (not to be confused with the OccluderInstance3D node).
public Rid OccluderCreate()
Returns
OccluderSetMesh(Rid, Vector3[], int[])
Sets the mesh data for the given occluder RID, which controls the shape of the occlusion culling that will be performed.
public void OccluderSetMesh(Rid occluder, Vector3[] vertices, int[] indices)
Parameters
OmniLightCreate()
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 light_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
To place in a scene, attach this omni light to an instance using InstanceSetBase(Rid, Rid) using the returned RID.
Note: The equivalent node is OmniLight3D.
public Rid OmniLightCreate()
Returns
ParticlesCollisionCreate()
Creates a new 3D GPU particle collision or attractor and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID can be used in most particles_collision_*
RenderingServer functions.
Note: The equivalent nodes are GpuParticlesCollision3D and GpuParticlesAttractor3D.
public Rid ParticlesCollisionCreate()
Returns
ParticlesCollisionHeightFieldUpdate(Rid)
Requests an update for the 3D GPU particle collision heightfield. This may be automatically called by the 3D GPU particle collision heightfield depending on its UpdateMode.
public void ParticlesCollisionHeightFieldUpdate(Rid particlesCollision)
Parameters
particlesCollision
Rid
ParticlesCollisionSetAttractorAttenuation(Rid, float)
Sets the attenuation curve
for the 3D GPU particles attractor specified by the particlesCollision
RID. Only used for attractors, not colliders. Equivalent to Attenuation.
public void ParticlesCollisionSetAttractorAttenuation(Rid particlesCollision, float curve)
Parameters
ParticlesCollisionSetAttractorDirectionality(Rid, float)
Sets the directionality amount
for the 3D GPU particles attractor specified by the particlesCollision
RID. Only used for attractors, not colliders. Equivalent to Directionality.
public void ParticlesCollisionSetAttractorDirectionality(Rid particlesCollision, float amount)
Parameters
ParticlesCollisionSetAttractorStrength(Rid, float)
Sets the strength
for the 3D GPU particles attractor specified by the particlesCollision
RID. Only used for attractors, not colliders. Equivalent to Strength.
public void ParticlesCollisionSetAttractorStrength(Rid particlesCollision, float strength)
Parameters
ParticlesCollisionSetBoxExtents(Rid, Vector3)
Sets the extents
for the 3D GPU particles collision by the particlesCollision
RID. Equivalent to Size, Size, Size, Size or Size depending on the particlesCollision
type.
public void ParticlesCollisionSetBoxExtents(Rid particlesCollision, Vector3 extents)
Parameters
ParticlesCollisionSetCollisionType(Rid, ParticlesCollisionType)
Sets the collision or attractor shape type
for the 3D GPU particles collision or attractor specified by the particlesCollision
RID.
public void ParticlesCollisionSetCollisionType(Rid particlesCollision, RenderingServer.ParticlesCollisionType type)
Parameters
particlesCollision
Ridtype
RenderingServer.ParticlesCollisionType
ParticlesCollisionSetCullMask(Rid, uint)
Sets the cull mask
for the 3D GPU particles collision or attractor specified by the particlesCollision
RID. Equivalent to CullMask or CullMask depending on the particlesCollision
type.
public void ParticlesCollisionSetCullMask(Rid particlesCollision, uint mask)
Parameters
ParticlesCollisionSetFieldTexture(Rid, Rid)
Sets the signed distance field texture
for the 3D GPU particles collision specified by the particlesCollision
RID. Equivalent to Texture or Texture depending on the particlesCollision
type.
public void ParticlesCollisionSetFieldTexture(Rid particlesCollision, Rid texture)
Parameters
ParticlesCollisionSetHeightFieldResolution(Rid, ParticlesCollisionHeightfieldResolution)
Sets the heightmap resolution
for the 3D GPU particles heightfield collision specified by the particlesCollision
RID. Equivalent to Resolution.
public void ParticlesCollisionSetHeightFieldResolution(Rid particlesCollision, RenderingServer.ParticlesCollisionHeightfieldResolution resolution)
Parameters
particlesCollision
Ridresolution
RenderingServer.ParticlesCollisionHeightfieldResolution
ParticlesCollisionSetSphereRadius(Rid, float)
Sets the radius
for the 3D GPU particles sphere collision or attractor specified by the particlesCollision
RID. Equivalent to Radius or Radius depending on the particlesCollision
type.
public void ParticlesCollisionSetSphereRadius(Rid particlesCollision, float radius)
Parameters
ParticlesCreate()
Creates a GPU-based 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 particles_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
To place in a scene, attach these particles to an instance using InstanceSetBase(Rid, Rid) using the returned RID.
Note: The equivalent nodes are GpuParticles2D and GpuParticles3D.
Note: All particles_*
methods only apply to GPU-based particles, not CPU-based particles. CpuParticles2D and CpuParticles3D do not have equivalent RenderingServer functions available, as these use MultiMeshInstance2D and MultiMeshInstance3D under the hood (see multimesh_*
methods).
public Rid ParticlesCreate()
Returns
ParticlesEmit(Rid, Transform3D, Vector3, Color, Color, uint)
Manually emits particles from the particles
instance.
public void ParticlesEmit(Rid particles, Transform3D transform, Vector3 velocity, Color color, Color custom, uint emitFlags)
Parameters
ParticlesGetCurrentAabb(Rid)
Calculates and returns the axis-aligned bounding box that contains all the particles. Equivalent to CaptureAabb().
public Aabb ParticlesGetCurrentAabb(Rid particles)
Parameters
particles
Rid
Returns
ParticlesGetEmitting(Rid)
Returns true
if particles are currently set to emitting.
public bool ParticlesGetEmitting(Rid particles)
Parameters
particles
Rid
Returns
ParticlesIsInactive(Rid)
Returns true
if particles are not emitting and particles are set to inactive.
public bool ParticlesIsInactive(Rid particles)
Parameters
particles
Rid
Returns
ParticlesRequestProcess(Rid)
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 InstancesCullAabb(Aabb, Rid), InstancesCullConvex(Array<Plane>, Rid), or InstancesCullRay(Vector3, Vector3, Rid).
public void ParticlesRequestProcess(Rid particles)
Parameters
particles
Rid
ParticlesRestart(Rid)
Reset the particles on the next update. Equivalent to Restart().
public void ParticlesRestart(Rid particles)
Parameters
particles
Rid
ParticlesSetAmount(Rid, int)
Sets the number of particles to be drawn and allocates the memory for them. Equivalent to Amount.
public void ParticlesSetAmount(Rid particles, int amount)
Parameters
ParticlesSetAmountRatio(Rid, float)
Sets the amount ratio for particles to be emitted. Equivalent to AmountRatio.
public void ParticlesSetAmountRatio(Rid particles, float ratio)
Parameters
ParticlesSetCollisionBaseSize(Rid, float)
public void ParticlesSetCollisionBaseSize(Rid particles, float size)
Parameters
ParticlesSetCustomAabb(Rid, Aabb)
Sets a custom axis-aligned bounding box for the particle system. Equivalent to VisibilityAabb.
public void ParticlesSetCustomAabb(Rid particles, Aabb aabb)
Parameters
ParticlesSetDrawOrder(Rid, ParticlesDrawOrder)
Sets the draw order of the particles to one of the named enums from RenderingServer.ParticlesDrawOrder. See RenderingServer.ParticlesDrawOrder for options. Equivalent to DrawOrder.
public void ParticlesSetDrawOrder(Rid particles, RenderingServer.ParticlesDrawOrder order)
Parameters
particles
Ridorder
RenderingServer.ParticlesDrawOrder
ParticlesSetDrawPassMesh(Rid, int, Rid)
Sets the mesh to be used for the specified draw pass. Equivalent to DrawPass1, DrawPass2, DrawPass3, and DrawPass4.
public void ParticlesSetDrawPassMesh(Rid particles, int pass, Rid mesh)
Parameters
ParticlesSetDrawPasses(Rid, int)
Sets the number of draw passes to use. Equivalent to DrawPasses.
public void ParticlesSetDrawPasses(Rid particles, int count)
Parameters
ParticlesSetEmissionTransform(Rid, Transform3D)
Sets the Transform3D that will be used by the particles when they first emit.
public void ParticlesSetEmissionTransform(Rid particles, Transform3D transform)
Parameters
particles
Ridtransform
Transform3D
ParticlesSetEmitterVelocity(Rid, Vector3)
Sets the velocity of a particle node, that will be used by InheritVelocityRatio.
public void ParticlesSetEmitterVelocity(Rid particles, Vector3 velocity)
Parameters
ParticlesSetEmitting(Rid, bool)
If true
, particles will emit over time. Setting to false does not reset the particles, but only stops their emission. Equivalent to Emitting.
public void ParticlesSetEmitting(Rid particles, bool emitting)
Parameters
ParticlesSetExplosivenessRatio(Rid, float)
Sets the explosiveness ratio. Equivalent to Explosiveness.
public void ParticlesSetExplosivenessRatio(Rid particles, float ratio)
Parameters
ParticlesSetFixedFps(Rid, int)
Sets the frame rate that the particle system rendering will be fixed to. Equivalent to FixedFps.
public void ParticlesSetFixedFps(Rid particles, int fps)
Parameters
ParticlesSetFractionalDelta(Rid, bool)
If true
, uses fractional delta which smooths the movement of the particles. Equivalent to FractDelta.
public void ParticlesSetFractionalDelta(Rid particles, bool enable)
Parameters
ParticlesSetInterpToEnd(Rid, float)
Sets the value that informs a ParticleProcessMaterial to rush all particles towards the end of their lifetime.
public void ParticlesSetInterpToEnd(Rid particles, float factor)
Parameters
ParticlesSetInterpolate(Rid, bool)
public void ParticlesSetInterpolate(Rid particles, bool enable)
Parameters
ParticlesSetLifetime(Rid, double)
Sets the lifetime of each particle in the system. Equivalent to Lifetime.
public void ParticlesSetLifetime(Rid particles, double lifetime)
Parameters
ParticlesSetMode(Rid, ParticlesMode)
Sets whether the GPU particles specified by the particles
RID should be rendered in 2D or 3D according to mode
.
public void ParticlesSetMode(Rid particles, RenderingServer.ParticlesMode mode)
Parameters
particles
Ridmode
RenderingServer.ParticlesMode
ParticlesSetOneShot(Rid, bool)
If true
, particles will emit once and then stop. Equivalent to OneShot.
public void ParticlesSetOneShot(Rid particles, bool oneShot)
Parameters
ParticlesSetPreProcessTime(Rid, double)
Sets the preprocess time for the particles' animation. This lets you delay starting an animation until after the particles have begun emitting. Equivalent to Preprocess.
public void ParticlesSetPreProcessTime(Rid particles, double time)
Parameters
ParticlesSetProcessMaterial(Rid, Rid)
Sets the material for processing the particles.
Note: This is not the material used to draw the materials. Equivalent to ProcessMaterial.
public void ParticlesSetProcessMaterial(Rid particles, Rid material)
Parameters
ParticlesSetRandomnessRatio(Rid, float)
Sets the emission randomness ratio. This randomizes the emission of particles within their phase. Equivalent to Randomness.
public void ParticlesSetRandomnessRatio(Rid particles, float ratio)
Parameters
ParticlesSetSpeedScale(Rid, double)
Sets the speed scale of the particle system. Equivalent to SpeedScale.
public void ParticlesSetSpeedScale(Rid particles, double scale)
Parameters
ParticlesSetSubemitter(Rid, Rid)
public void ParticlesSetSubemitter(Rid particles, Rid subemitterParticles)
Parameters
ParticlesSetTrailBindPoses(Rid, Array<Transform3D>)
public void ParticlesSetTrailBindPoses(Rid particles, Array<Transform3D> bindPoses)
Parameters
particles
RidbindPoses
Array<Transform3D>
ParticlesSetTrails(Rid, bool, float)
If enable
is true
, enables trails for the particles
with the specified lengthSec
in seconds. Equivalent to TrailEnabled and TrailLifetime.
public void ParticlesSetTrails(Rid particles, bool enable, float lengthSec)
Parameters
ParticlesSetTransformAlign(Rid, ParticlesTransformAlign)
public void ParticlesSetTransformAlign(Rid particles, RenderingServer.ParticlesTransformAlign align)
Parameters
particles
Ridalign
RenderingServer.ParticlesTransformAlign
ParticlesSetUseLocalCoordinates(Rid, bool)
If true
, particles use local coordinates. If false
they use global coordinates. Equivalent to LocalCoords.
public void ParticlesSetUseLocalCoordinates(Rid particles, bool enable)
Parameters
PositionalSoftShadowFilterSetQuality(ShadowQuality)
Sets the filter quality for omni and spot light shadows in 3D. See also ProjectSettings.rendering/lights_and_shadows/positional_shadow/soft_shadow_filter_quality
. This parameter is global and cannot be set on a per-viewport basis.
public void PositionalSoftShadowFilterSetQuality(RenderingServer.ShadowQuality quality)
Parameters
quality
RenderingServer.ShadowQuality
ReflectionProbeCreate()
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 reflection_probe_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
To place in a scene, attach this reflection probe to an instance using InstanceSetBase(Rid, Rid) using the returned RID.
Note: The equivalent node is ReflectionProbe.
public Rid ReflectionProbeCreate()
Returns
ReflectionProbeSetAmbientColor(Rid, Color)
Sets the reflection probe's custom ambient light color. Equivalent to AmbientColor.
public void ReflectionProbeSetAmbientColor(Rid probe, Color color)
Parameters
ReflectionProbeSetAmbientEnergy(Rid, float)
Sets the reflection probe's custom ambient light energy. Equivalent to AmbientColorEnergy.
public void ReflectionProbeSetAmbientEnergy(Rid probe, float energy)
Parameters
ReflectionProbeSetAmbientMode(Rid, ReflectionProbeAmbientMode)
Sets the reflection probe's ambient light mode. Equivalent to AmbientMode.
public void ReflectionProbeSetAmbientMode(Rid probe, RenderingServer.ReflectionProbeAmbientMode mode)
Parameters
probe
Ridmode
RenderingServer.ReflectionProbeAmbientMode
ReflectionProbeSetAsInterior(Rid, bool)
If true
, reflections will ignore sky contribution. Equivalent to Interior.
public void ReflectionProbeSetAsInterior(Rid probe, bool enable)
Parameters
ReflectionProbeSetCullMask(Rid, uint)
Sets the render cull mask for this reflection probe. Only instances with a matching cull mask will be rendered by this probe. Equivalent to CullMask.
public void ReflectionProbeSetCullMask(Rid probe, uint layers)
Parameters
ReflectionProbeSetEnableBoxProjection(Rid, bool)
If true
, uses box projection. This can make reflections look more correct in certain situations. Equivalent to BoxProjection.
public void ReflectionProbeSetEnableBoxProjection(Rid probe, bool enable)
Parameters
ReflectionProbeSetEnableShadows(Rid, bool)
If true
, computes shadows in the reflection probe. This makes the reflection much slower to compute. Equivalent to EnableShadows.
public void ReflectionProbeSetEnableShadows(Rid probe, bool enable)
Parameters
ReflectionProbeSetIntensity(Rid, float)
Sets the intensity of the reflection probe. Intensity modulates the strength of the reflection. Equivalent to Intensity.
public void ReflectionProbeSetIntensity(Rid probe, float intensity)
Parameters
ReflectionProbeSetMaxDistance(Rid, float)
Sets the max distance away from the probe an object can be before it is culled. Equivalent to MaxDistance.
public void ReflectionProbeSetMaxDistance(Rid probe, float distance)
Parameters
ReflectionProbeSetMeshLodThreshold(Rid, float)
Sets the mesh level of detail to use in the reflection probe rendering. Higher values will use less detailed versions of meshes that have LOD variations generated, which can improve performance. Equivalent to MeshLodThreshold.
public void ReflectionProbeSetMeshLodThreshold(Rid probe, float pixels)
Parameters
ReflectionProbeSetOriginOffset(Rid, Vector3)
Sets the origin offset to be used when this reflection probe is in box project mode. Equivalent to OriginOffset.
public void ReflectionProbeSetOriginOffset(Rid probe, Vector3 offset)
Parameters
ReflectionProbeSetResolution(Rid, int)
Sets the resolution to use when rendering the specified reflection probe. The resolution
is specified for each cubemap face: for instance, specifying 512
will allocate 6 faces of 512×512 each (plus mipmaps for roughness levels).
public void ReflectionProbeSetResolution(Rid probe, int resolution)
Parameters
ReflectionProbeSetSize(Rid, Vector3)
Sets the size of the area that the reflection probe will capture. Equivalent to Size.
public void ReflectionProbeSetSize(Rid probe, Vector3 size)
Parameters
ReflectionProbeSetUpdateMode(Rid, ReflectionProbeUpdateMode)
Sets how often the reflection probe updates. Can either be once or every frame. See RenderingServer.ReflectionProbeUpdateMode for options.
public void ReflectionProbeSetUpdateMode(Rid probe, RenderingServer.ReflectionProbeUpdateMode mode)
Parameters
probe
Ridmode
RenderingServer.ReflectionProbeUpdateMode
RequestFrameDrawnCallback(Callable)
Schedules a callback to the given callable after a frame has been drawn.
public void RequestFrameDrawnCallback(Callable callable)
Parameters
callable
Callable
ScenarioCreate()
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 scenario_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
The scenario is the 3D world that all the visual instances exist in.
public Rid ScenarioCreate()
Returns
ScenarioSetCameraAttributes(Rid, Rid)
Sets the camera attributes (effects
) that will be used with this scenario. See also CameraAttributes.
public void ScenarioSetCameraAttributes(Rid scenario, Rid effects)
Parameters
ScenarioSetEnvironment(Rid, Rid)
Sets the environment that will be used with this scenario. See also Environment.
public void ScenarioSetEnvironment(Rid scenario, Rid environment)
Parameters
ScenarioSetFallbackEnvironment(Rid, Rid)
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.
public void ScenarioSetFallbackEnvironment(Rid scenario, Rid environment)
Parameters
ScreenSpaceRoughnessLimiterSetActive(bool, float, float)
Sets the screen-space roughness limiter parameters, such as whether it should be enabled and its thresholds. Equivalent to ProjectSettings.rendering/anti_aliasing/screen_space_roughness_limiter/enabled
, ProjectSettings.rendering/anti_aliasing/screen_space_roughness_limiter/amount
and ProjectSettings.rendering/anti_aliasing/screen_space_roughness_limiter/limit
.
public void ScreenSpaceRoughnessLimiterSetActive(bool enable, float amount, float limit)
Parameters
SetBootImage(Image, Color, bool, bool)
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 useFilter
is true
, the image will be scaled with linear interpolation. If useFilter
is false
, the image will be scaled with nearest-neighbor interpolation.
public void SetBootImage(Image image, Color color, bool scale, bool useFilter = true)
Parameters
SetDebugGenerateWireframes(bool)
This method is currently unimplemented and does nothing if called with generate
set to true
.
public void SetDebugGenerateWireframes(bool generate)
Parameters
generate
bool
SetDefaultClearColor(Color)
Sets the default clear color which is used when a specific clear color has not been selected. See also GetDefaultClearColor().
public void SetDefaultClearColor(Color color)
Parameters
color
Color
ShaderCreate()
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 shader_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent resource is Shader.
public Rid ShaderCreate()
Returns
ShaderGetCode(Rid)
Returns a shader's source code as a string.
public string ShaderGetCode(Rid shader)
Parameters
shader
Rid
Returns
ShaderGetDefaultTextureParameter(Rid, StringName, int)
Returns a default texture from a shader searched by name.
Note: If the sampler array is used use index
to access the specified texture.
public Rid ShaderGetDefaultTextureParameter(Rid shader, StringName name, int index = 0)
Parameters
shader
Ridname
StringNameindex
int
Returns
ShaderGetParameterDefault(Rid, StringName)
Returns the default value for the specified shader uniform. This is usually the value written in the shader source code.
public Variant ShaderGetParameterDefault(Rid shader, StringName name)
Parameters
shader
Ridname
StringName
Returns
ShaderSetCode(Rid, string)
Sets the shader's source code (which triggers recompilation after being changed).
public void ShaderSetCode(Rid shader, string code)
Parameters
ShaderSetDefaultTextureParameter(Rid, StringName, Rid, int)
Sets a shader's default texture. Overwrites the texture given by name.
Note: If the sampler array is used use index
to access the specified texture.
public void ShaderSetDefaultTextureParameter(Rid shader, StringName name, Rid texture, int index = 0)
Parameters
shader
Ridname
StringNametexture
Ridindex
int
ShaderSetPathHint(Rid, string)
Sets the path hint for the specified shader. This should generally match the Shader resource's ResourcePath.
public void ShaderSetPathHint(Rid shader, string path)
Parameters
SkeletonAllocateData(Rid, int, bool)
public void SkeletonAllocateData(Rid skeleton, int bones, bool is2DSkeleton = false)
Parameters
SkeletonBoneGetTransform(Rid, int)
Returns the Transform3D set for a specific bone of this skeleton.
public Transform3D SkeletonBoneGetTransform(Rid skeleton, int bone)
Parameters
Returns
SkeletonBoneGetTransform2D(Rid, int)
Returns the Transform2D set for a specific bone of this skeleton.
public Transform2D SkeletonBoneGetTransform2D(Rid skeleton, int bone)
Parameters
Returns
SkeletonBoneSetTransform(Rid, int, Transform3D)
Sets the Transform3D for a specific bone of this skeleton.
public void SkeletonBoneSetTransform(Rid skeleton, int bone, Transform3D transform)
Parameters
skeleton
Ridbone
inttransform
Transform3D
SkeletonBoneSetTransform2D(Rid, int, Transform2D)
Sets the Transform2D for a specific bone of this skeleton.
public void SkeletonBoneSetTransform2D(Rid skeleton, int bone, Transform2D transform)
Parameters
skeleton
Ridbone
inttransform
Transform2D
SkeletonCreate()
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 skeleton_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
public Rid SkeletonCreate()
Returns
SkeletonGetBoneCount(Rid)
Returns the number of bones allocated for this skeleton.
public int SkeletonGetBoneCount(Rid skeleton)
Parameters
skeleton
Rid
Returns
SkeletonSetBaseTransform2D(Rid, Transform2D)
public void SkeletonSetBaseTransform2D(Rid skeleton, Transform2D baseTransform)
Parameters
skeleton
RidbaseTransform
Transform2D
SkyBakePanorama(Rid, float, bool, Vector2I)
Generates and returns an Image containing the radiance map for the specified sky
RID. This supports built-in sky material and custom sky shaders. If bakeIrradiance
is true
, the irradiance map is saved instead of the radiance map. The radiance map is used to render reflected light, while the irradiance map is used to render ambient light. See also EnvironmentBakePanorama(Rid, bool, Vector2I).
Note: The image is saved in linear color space without any tonemapping performed, which means it will look too dark if viewed directly in an image editor. energy
values above 1.0
can be used to brighten the resulting image.
Note:
size
should be a 2:1 aspect ratio for the generated panorama to have square pixels. For radiance maps, there is no point in using a height greater than RadianceSize, as it won't increase detail. Irradiance maps only contain low-frequency data, so there is usually no point in going past a size of 128×64 pixels when saving an irradiance map.
public Image SkyBakePanorama(Rid sky, float energy, bool bakeIrradiance, Vector2I size)
Parameters
Returns
SkyCreate()
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 sky_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
public Rid SkyCreate()
Returns
SkySetMaterial(Rid, Rid)
Sets the material that the sky uses to render the background, ambient and reflection maps.
public void SkySetMaterial(Rid sky, Rid material)
Parameters
SkySetMode(Rid, SkyMode)
Sets the process mode
of the sky specified by the sky
RID. Equivalent to ProcessMode.
public void SkySetMode(Rid sky, RenderingServer.SkyMode mode)
Parameters
sky
Ridmode
RenderingServer.SkyMode
SkySetRadianceSize(Rid, int)
Sets the radianceSize
of the sky specified by the sky
RID (in pixels). Equivalent to RadianceSize.
public void SkySetRadianceSize(Rid sky, int radianceSize)
Parameters
SpotLightCreate()
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 light_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
To place in a scene, attach this spot light to an instance using InstanceSetBase(Rid, Rid) using the returned RID.
public Rid SpotLightCreate()
Returns
SubSurfaceScatteringSetQuality(SubSurfaceScatteringQuality)
Sets ProjectSettings.rendering/environment/subsurface_scattering/subsurface_scattering_quality
to use when rendering materials that have subsurface scattering enabled.
public void SubSurfaceScatteringSetQuality(RenderingServer.SubSurfaceScatteringQuality quality)
Parameters
SubSurfaceScatteringSetScale(float, float)
Sets the ProjectSettings.rendering/environment/subsurface_scattering/subsurface_scattering_scale
and ProjectSettings.rendering/environment/subsurface_scattering/subsurface_scattering_depth_scale
to use when rendering materials that have subsurface scattering enabled.
public void SubSurfaceScatteringSetScale(float scale, float depthScale)
Parameters
Texture2DCreate(Image)
Creates a 2-dimensional texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all texture_2d_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent resource is Texture2D.
Note: Not to be confused with TextureCreate(RDTextureFormat, RDTextureView, Array<byte[]>), which creates the graphics API's own texture type as opposed to the Godot-specific Texture2D resource.
public Rid Texture2DCreate(Image image)
Parameters
image
Image
Returns
Texture2DGet(Rid)
Returns an Image instance from the given texture
Rid.
Example of getting the test texture from GetTestTexture() and applying it to a Sprite2D node:
var texture_rid = RenderingServer.get_test_texture()
var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid))
$Sprite2D.texture = texture
public Image Texture2DGet(Rid texture)
Parameters
texture
Rid
Returns
Texture2DLayerGet(Rid, int)
public Image Texture2DLayerGet(Rid texture, int layer)
Parameters
Returns
Texture2DLayeredCreate(Array<Image>, TextureLayeredType)
Creates a 2-dimensional layered texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all texture_2d_layered_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent resource is TextureLayered.
public Rid Texture2DLayeredCreate(Array<Image> layers, RenderingServer.TextureLayeredType layeredType)
Parameters
layers
Array<Image>layeredType
RenderingServer.TextureLayeredType
Returns
Texture2DLayeredPlaceholderCreate(TextureLayeredType)
Creates a placeholder for a 2-dimensional layered texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all texture_2d_layered_*
RenderingServer functions, although it does nothing when used. See also Texture2DPlaceholderCreate().
Note: The equivalent resource is PlaceholderTextureLayered.
public Rid Texture2DLayeredPlaceholderCreate(RenderingServer.TextureLayeredType layeredType)
Parameters
layeredType
RenderingServer.TextureLayeredType
Returns
Texture2DPlaceholderCreate()
Creates a placeholder for a 2-dimensional layered texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all texture_2d_layered_*
RenderingServer functions, although it does nothing when used. See also Texture2DLayeredPlaceholderCreate(TextureLayeredType)
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent resource is PlaceholderTexture2D.
public Rid Texture2DPlaceholderCreate()
Returns
Texture2DUpdate(Rid, Image, int)
Updates the texture specified by the texture
Rid with the data in image
. A layer
must also be specified, which should be 0
when updating a single-layer texture (Texture2D).
Note: The image
must have the same width, height and format as the current texture
data. Otherwise, an error will be printed and the original texture won't be modified. If you need to use different width, height or format, use TextureReplace(Rid, Rid) instead.
public void Texture2DUpdate(Rid texture, Image image, int layer)
Parameters
Texture3DCreate(Format, int, int, int, bool, Array<Image>)
Note: The equivalent resource is Texture3D.
public Rid Texture3DCreate(Image.Format format, int width, int height, int depth, bool mipmaps, Array<Image> data)
Parameters
Returns
Texture3DGet(Rid)
public Array<Image> Texture3DGet(Rid texture)
Parameters
texture
Rid
Returns
Texture3DPlaceholderCreate()
Creates a placeholder for a 3-dimensional texture and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all texture_3d_*
RenderingServer functions, although it does nothing when used.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent resource is PlaceholderTexture3D.
public Rid Texture3DPlaceholderCreate()
Returns
Texture3DUpdate(Rid, Array<Image>)
Updates the texture specified by the texture
Rid's data with the data in data
. All the texture's layers must be replaced at once.
Note: The texture
must have the same width, height, depth and format as the current texture data. Otherwise, an error will be printed and the original texture won't be modified. If you need to use different width, height, depth or format, use TextureReplace(Rid, Rid) instead.
public void Texture3DUpdate(Rid texture, Array<Image> data)
Parameters
TextureGetFormat(Rid)
Returns the Image.Format for the texture.
public Image.Format TextureGetFormat(Rid texture)
Parameters
texture
Rid
Returns
TextureGetNativeHandle(Rid, bool)
Returns the internal graphics handle for this texture object. For use when communicating with third-party APIs mostly with GDExtension.
Note: This function returns a uint64_t
which internally maps to a GLuint
(OpenGL) or VkImage
(Vulkan).
public ulong TextureGetNativeHandle(Rid texture, bool srgb = false)
Parameters
Returns
TextureGetPath(Rid)
public string TextureGetPath(Rid texture)
Parameters
texture
Rid
Returns
TextureGetRdTexture(Rid, bool)
Returns a texture Rid that can be used with RenderingDevice.
public Rid TextureGetRdTexture(Rid texture, bool srgb = false)
Parameters
Returns
TextureProxyCreate(Rid)
Deprecated. ProxyTexture was removed in Godot 4, so this method does nothing when called and always returns a null Rid.
[Obsolete("This method is deprecated.")]
public Rid TextureProxyCreate(Rid @base)
Parameters
base
Rid
Returns
TextureProxyUpdate(Rid, Rid)
Deprecated. ProxyTexture was removed in Godot 4, so this method cannot be used anymore.
[Obsolete("This method is deprecated.")]
public void TextureProxyUpdate(Rid texture, Rid proxyTo)
Parameters
TextureRdCreate(Rid, TextureLayeredType)
Creates a new texture object based on a texture created directly on the RenderingDevice. If the texture contains layers, layerType
is used to define the layer type.
public Rid TextureRdCreate(Rid rdTexture, RenderingServer.TextureLayeredType layerType = TextureLayeredType.Layered2DArray)
Parameters
rdTexture
RidlayerType
RenderingServer.TextureLayeredType
Returns
TextureReplace(Rid, Rid)
Replaces texture
's texture data by the texture specified by the byTexture
RID, without changing texture
's RID.
public void TextureReplace(Rid texture, Rid byTexture)
Parameters
TextureSetForceRedrawIfVisible(Rid, bool)
public void TextureSetForceRedrawIfVisible(Rid texture, bool enable)
Parameters
TextureSetPath(Rid, string)
public void TextureSetPath(Rid texture, string path)
Parameters
TextureSetSizeOverride(Rid, int, int)
public void TextureSetSizeOverride(Rid texture, int width, int height)
Parameters
ViewportAttachCamera(Rid, Rid)
Sets a viewport's camera.
public void ViewportAttachCamera(Rid viewport, Rid camera)
Parameters
ViewportAttachCanvas(Rid, Rid)
Sets a viewport's canvas.
public void ViewportAttachCanvas(Rid viewport, Rid canvas)
Parameters
ViewportAttachToScreen(Rid, Rect2?, int)
Copies the viewport to a region of the screen specified by rect
. If ViewportSetRenderDirectToScreen(Rid, bool) is true
, 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.
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 ViewportSetRenderDirectToScreen(Rid, bool).
public void ViewportAttachToScreen(Rid viewport, Rect2? rect = null, int screen = 0)
Parameters
viewport
Ridrect
Rect2?If the parameter is null, then the default value is
new Rect2(new Vector2(0, 0), new Vector2(0, 0))
.screen
int
ViewportCreate()
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 viewport_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent node is Viewport.
public Rid ViewportCreate()
Returns
ViewportGetMeasuredRenderTimeCpu(Rid)
Returns the CPU time taken to render the last frame in milliseconds. This only includes time spent in rendering-related operations; scripts' _process
functions and other engine subsystems are not included in this readout. To get a complete readout of CPU time spent to render the scene, sum the render times of all viewports that are drawn every frame plus GetFrameSetupTimeCpu(). Unlike GetFramesPerSecond(), this method will accurately reflect CPU utilization even if framerate is capped via V-Sync or MaxFps. See also ViewportGetMeasuredRenderTimeGpu(Rid).
Note: Requires measurements to be enabled on the specified viewport
using ViewportSetMeasureRenderTime(Rid, bool). Otherwise, this method returns 0.0
.
public double ViewportGetMeasuredRenderTimeCpu(Rid viewport)
Parameters
viewport
Rid
Returns
ViewportGetMeasuredRenderTimeGpu(Rid)
Returns the GPU time taken to render the last frame in milliseconds. To get a complete readout of GPU time spent to render the scene, sum the render times of all viewports that are drawn every frame. Unlike GetFramesPerSecond(), this method accurately reflects GPU utilization even if framerate is capped via V-Sync or MaxFps. See also ViewportGetMeasuredRenderTimeGpu(Rid).
Note: Requires measurements to be enabled on the specified viewport
using ViewportSetMeasureRenderTime(Rid, bool). Otherwise, this method returns 0.0
.
Note: When GPU utilization is low enough during a certain period of time, GPUs will decrease their power state (which in turn decreases core and memory clock speeds). This can cause the reported GPU time to increase if GPU utilization is kept low enough by a framerate cap (compared to what it would be at the GPU's highest power state). Keep this in mind when benchmarking using ViewportGetMeasuredRenderTimeGpu(Rid). This behavior can be overridden in the graphics driver settings at the cost of higher power usage.
public double ViewportGetMeasuredRenderTimeGpu(Rid viewport)
Parameters
viewport
Rid
Returns
ViewportGetRenderInfo(Rid, ViewportRenderInfoType, ViewportRenderInfo)
Returns a statistic about the rendering engine which can be used for performance profiling. This is separated into render pass type
s, each of them having the same info
s you can query (different passes will return different values). See RenderingServer.ViewportRenderInfoType for a list of render pass types and RenderingServer.ViewportRenderInfo for a list of information that can be queried.
See also GetRenderingInfo(RenderingInfo), which returns global information across all viewports.
Note: Viewport rendering information is not available until at least 2 frames have been rendered by the engine. If rendering information is not available, ViewportGetRenderInfo(Rid, ViewportRenderInfoType, ViewportRenderInfo) returns 0
. To print rendering information in _ready()
successfully, use the following:
func _ready():
for _i in 2:
await get_tree().process_frame
print(
RenderingServer.viewport_get_render_info(get_viewport().get_viewport_rid(),
RenderingServer.VIEWPORT_RENDER_INFO_TYPE_VISIBLE,
RenderingServer.VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME)
)</code></pre>
public int ViewportGetRenderInfo(Rid viewport, RenderingServer.ViewportRenderInfoType type, RenderingServer.ViewportRenderInfo info)
Parameters
viewport
Ridtype
RenderingServer.ViewportRenderInfoTypeinfo
RenderingServer.ViewportRenderInfo
Returns
ViewportGetRenderTarget(Rid)
Returns the render target for the viewport.
public Rid ViewportGetRenderTarget(Rid viewport)
Parameters
viewport
Rid
Returns
ViewportGetTexture(Rid)
Returns the viewport's last rendered frame.
public Rid ViewportGetTexture(Rid viewport)
Parameters
viewport
Rid
Returns
ViewportRemoveCanvas(Rid, Rid)
Detaches a viewport from a canvas and vice versa.
public void ViewportRemoveCanvas(Rid viewport, Rid canvas)
Parameters
ViewportSetActive(Rid, bool)
If true
, sets the viewport active, else sets it inactive.
public void ViewportSetActive(Rid viewport, bool active)
Parameters
ViewportSetCanvasCullMask(Rid, uint)
Sets the rendering mask associated with this Viewport. Only CanvasItem nodes with a matching rendering visibility layer will be rendered by this Viewport.
public void ViewportSetCanvasCullMask(Rid viewport, uint canvasCullMask)
Parameters
ViewportSetCanvasStacking(Rid, Rid, int, int)
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.
public void ViewportSetCanvasStacking(Rid viewport, Rid canvas, int layer, int sublayer)
Parameters
ViewportSetCanvasTransform(Rid, Rid, Transform2D)
Sets the transformation of a viewport's canvas.
public void ViewportSetCanvasTransform(Rid viewport, Rid canvas, Transform2D offset)
Parameters
viewport
Ridcanvas
Ridoffset
Transform2D
ViewportSetClearMode(Rid, ViewportClearMode)
Sets the clear mode of a viewport. See RenderingServer.ViewportClearMode for options.
public void ViewportSetClearMode(Rid viewport, RenderingServer.ViewportClearMode clearMode)
Parameters
viewport
RidclearMode
RenderingServer.ViewportClearMode
ViewportSetDebugDraw(Rid, ViewportDebugDraw)
Sets the debug draw mode of a viewport. See RenderingServer.ViewportDebugDraw for options.
public void ViewportSetDebugDraw(Rid viewport, RenderingServer.ViewportDebugDraw draw)
Parameters
viewport
Riddraw
RenderingServer.ViewportDebugDraw
ViewportSetDefaultCanvasItemTextureFilter(Rid, CanvasItemTextureFilter)
Sets the default texture filtering mode for the specified viewport
RID. See RenderingServer.CanvasItemTextureFilter for options.
public void ViewportSetDefaultCanvasItemTextureFilter(Rid viewport, RenderingServer.CanvasItemTextureFilter filter)
Parameters
viewport
Ridfilter
RenderingServer.CanvasItemTextureFilter
ViewportSetDefaultCanvasItemTextureRepeat(Rid, CanvasItemTextureRepeat)
Sets the default texture repeat mode for the specified viewport
RID. See RenderingServer.CanvasItemTextureRepeat for options.
public void ViewportSetDefaultCanvasItemTextureRepeat(Rid viewport, RenderingServer.CanvasItemTextureRepeat repeat)
Parameters
viewport
Ridrepeat
RenderingServer.CanvasItemTextureRepeat
ViewportSetDisable2D(Rid, bool)
If true
, the viewport's canvas (i.e. 2D and GUI elements) is not rendered.
public void ViewportSetDisable2D(Rid viewport, bool disable)
Parameters
ViewportSetDisable3D(Rid, bool)
If true
, the viewport's 3D elements are not rendered.
public void ViewportSetDisable3D(Rid viewport, bool disable)
Parameters
ViewportSetEnvironmentMode(Rid, ViewportEnvironmentMode)
Sets the viewport's environment mode which allows enabling or disabling rendering of 3D environment over 2D canvas. When disabled, 2D will not be affected by the environment. When enabled, 2D will be affected by the environment if the environment background mode is Canvas. The default behavior is to inherit the setting from the viewport's parent. If the topmost parent is also set to Inherit, then the behavior will be the same as if it was set to Enabled.
public void ViewportSetEnvironmentMode(Rid viewport, RenderingServer.ViewportEnvironmentMode mode)
Parameters
viewport
Ridmode
RenderingServer.ViewportEnvironmentMode
ViewportSetFsrSharpness(Rid, float)
Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference.
public void ViewportSetFsrSharpness(Rid viewport, float sharpness)
Parameters
ViewportSetGlobalCanvasTransform(Rid, Transform2D)
Sets the viewport's global transformation matrix.
public void ViewportSetGlobalCanvasTransform(Rid viewport, Transform2D transform)
Parameters
viewport
Ridtransform
Transform2D
ViewportSetMeasureRenderTime(Rid, bool)
Sets the measurement for the given viewport
RID (obtained using GetViewportRid()). Once enabled, ViewportGetMeasuredRenderTimeCpu(Rid) and ViewportGetMeasuredRenderTimeGpu(Rid) will return values greater than 0.0
when queried with the given viewport
.
public void ViewportSetMeasureRenderTime(Rid viewport, bool enable)
Parameters
ViewportSetMsaa2D(Rid, ViewportMsaa)
Sets the multisample anti-aliasing mode for 2D/Canvas on the specified viewport
RID. See RenderingServer.ViewportMsaa for options.
public void ViewportSetMsaa2D(Rid viewport, RenderingServer.ViewportMsaa msaa)
Parameters
viewport
Ridmsaa
RenderingServer.ViewportMsaa
ViewportSetMsaa3D(Rid, ViewportMsaa)
Sets the multisample anti-aliasing mode for 3D on the specified viewport
RID. See RenderingServer.ViewportMsaa for options.
public void ViewportSetMsaa3D(Rid viewport, RenderingServer.ViewportMsaa msaa)
Parameters
viewport
Ridmsaa
RenderingServer.ViewportMsaa
ViewportSetOcclusionCullingBuildQuality(ViewportOcclusionCullingBuildQuality)
Sets the ProjectSettings.rendering/occlusion_culling/bvh_build_quality
to use for occlusion culling. This parameter is global and cannot be set on a per-viewport basis.
public void ViewportSetOcclusionCullingBuildQuality(RenderingServer.ViewportOcclusionCullingBuildQuality quality)
Parameters
ViewportSetOcclusionRaysPerThread(int)
Sets the ProjectSettings.rendering/occlusion_culling/occlusion_rays_per_thread
to use for occlusion culling. This parameter is global and cannot be set on a per-viewport basis.
public void ViewportSetOcclusionRaysPerThread(int raysPerThread)
Parameters
raysPerThread
int
ViewportSetParentViewport(Rid, Rid)
Sets the viewport's parent to the viewport specified by the parentViewport
RID.
public void ViewportSetParentViewport(Rid viewport, Rid parentViewport)
Parameters
ViewportSetPositionalShadowAtlasQuadrantSubdivision(Rid, int, int)
Sets the number of subdivisions to use in the specified shadow atlas quadrant
for omni and spot shadows. See also Godot.Viewport.SetPositionalShadowAtlasQuadrantSubdiv(System.Int32,Godot.Viewport.PositionalShadowAtlasQuadrantSubdiv).
public void ViewportSetPositionalShadowAtlasQuadrantSubdivision(Rid viewport, int quadrant, int subdivision)
Parameters
ViewportSetPositionalShadowAtlasSize(Rid, int, bool)
Sets the size
of the shadow atlas's images (used for omni and spot lights) on the viewport specified by the viewport
RID. The value is rounded up to the nearest power of 2. If use16Bits
is true
, use 16 bits for the omni/spot shadow depth map. Enabling this results in shadows having less precision and may result in shadow acne, but can lead to performance improvements on some devices.
Note: If this is set to 0
, no positional shadows will be visible at all. This can improve performance significantly on low-end systems by reducing both the CPU and GPU load (as fewer draw calls are needed to draw the scene without shadows).
public void ViewportSetPositionalShadowAtlasSize(Rid viewport, int size, bool use16Bits = false)
Parameters
ViewportSetRenderDirectToScreen(Rid, bool)
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.
public void ViewportSetRenderDirectToScreen(Rid viewport, bool enabled)
Parameters
ViewportSetScaling3DMode(Rid, ViewportScaling3DMode)
Sets the 3D resolution scaling mode. Bilinear scaling renders at different resolution to either undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is an upscaling technology that produces high quality images at fast framerates by using a spatially aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces significantly higher image quality. FSR should be used where possible.
public void ViewportSetScaling3DMode(Rid viewport, RenderingServer.ViewportScaling3DMode scaling3DMode)
Parameters
viewport
Ridscaling3DMode
RenderingServer.ViewportScaling3DMode
ViewportSetScaling3DScale(Rid, float)
Scales the 3D render buffer based on the viewport size uses an image filter specified in RenderingServer.ViewportScaling3DMode to scale the output image to the full viewport size. Values lower than 1.0
can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater than 1.0
are only valid for bilinear mode and can be used to improve 3D rendering quality at a high performance cost (supersampling). See also RenderingServer.ViewportMsaa for multi-sample antialiasing, which is significantly cheaper but only smoothens the edges of polygons.
When using FSR upscaling, AMD recommends exposing the following values as preset options to users "Ultra Quality: 0.77", "Quality: 0.67", "Balanced: 0.59", "Performance: 0.5" instead of exposing the entire scale.
public void ViewportSetScaling3DScale(Rid viewport, float scale)
Parameters
ViewportSetScenario(Rid, Rid)
Sets a viewport's scenario. The scenario contains information about environment information, reflection atlas, etc.
public void ViewportSetScenario(Rid viewport, Rid scenario)
Parameters
ViewportSetScreenSpaceAA(Rid, ViewportScreenSpaceAA)
Sets the viewport's screen-space antialiasing mode.
public void ViewportSetScreenSpaceAA(Rid viewport, RenderingServer.ViewportScreenSpaceAA mode)
Parameters
viewport
Ridmode
RenderingServer.ViewportScreenSpaceAA
ViewportSetSdfOversizeAndScale(Rid, ViewportSdfOversize, ViewportSdfScale)
Sets the viewport's 2D signed distance field ProjectSettings.rendering/2d/sdf/oversize
and ProjectSettings.rendering/2d/sdf/scale
. This is used when sampling the signed distance field in CanvasItem shaders as well as GpuParticles2D collision. This is not used by SDFGI in 3D rendering.
public void ViewportSetSdfOversizeAndScale(Rid viewport, RenderingServer.ViewportSdfOversize oversize, RenderingServer.ViewportSdfScale scale)
Parameters
viewport
Ridoversize
RenderingServer.ViewportSdfOversizescale
RenderingServer.ViewportSdfScale
ViewportSetSize(Rid, int, int)
Sets the viewport's width and height in pixels.
public void ViewportSetSize(Rid viewport, int width, int height)
Parameters
ViewportSetSnap2DTransformsToPixel(Rid, bool)
If true
, canvas item transforms (i.e. origin position) are snapped to the nearest pixel when rendering. This can lead to a crisper appearance at the cost of less smooth movement, especially when Camera2D smoothing is enabled. Equivalent to ProjectSettings.rendering/2d/snap/snap_2d_transforms_to_pixel
.
public void ViewportSetSnap2DTransformsToPixel(Rid viewport, bool enabled)
Parameters
ViewportSetSnap2DVerticesToPixel(Rid, bool)
If true
, canvas item vertices (i.e. polygon points) are snapped to the nearest pixel when rendering. This can lead to a crisper appearance at the cost of less smooth movement, especially when Camera2D smoothing is enabled. Equivalent to ProjectSettings.rendering/2d/snap/snap_2d_vertices_to_pixel
.
public void ViewportSetSnap2DVerticesToPixel(Rid viewport, bool enabled)
Parameters
ViewportSetTextureMipmapBias(Rid, float)
Affects the final texture sharpness by reading from a lower or higher mipmap (also called "texture LOD bias"). Negative values make mipmapped textures sharper but grainier when viewed at a distance, while positive values make mipmapped textures blurrier (even when up close). To get sharper textures at a distance without introducing too much graininess, set this between -0.75
and 0.0
. Enabling temporal antialiasing (ProjectSettings.rendering/anti_aliasing/quality/use_taa
) can help reduce the graininess visible when using negative mipmap bias.
Note: When the 3D scaling mode is set to FSR 1.0, this value is used to adjust the automatic mipmap bias which is calculated internally based on the scale factor. The formula for this is -log2(1.0 / scale) + mipmap_bias
.
public void ViewportSetTextureMipmapBias(Rid viewport, float mipmapBias)
Parameters
ViewportSetTransparentBackground(Rid, bool)
If true
, the viewport renders its background as transparent.
public void ViewportSetTransparentBackground(Rid viewport, bool enabled)
Parameters
ViewportSetUpdateMode(Rid, ViewportUpdateMode)
Sets when the viewport should be updated. See RenderingServer.ViewportUpdateMode constants for options.
public void ViewportSetUpdateMode(Rid viewport, RenderingServer.ViewportUpdateMode updateMode)
Parameters
viewport
RidupdateMode
RenderingServer.ViewportUpdateMode
ViewportSetUseDebanding(Rid, bool)
If true
, enables debanding on the specified viewport. Equivalent to ProjectSettings.rendering/anti_aliasing/quality/use_debanding
.
public void ViewportSetUseDebanding(Rid viewport, bool enable)
Parameters
ViewportSetUseHdr2D(Rid, bool)
If true
, 2D rendering will use a high dynamic range (HDR) format framebuffer matching the bit depth of the 3D framebuffer. When using the Forward+ renderer this will be a RGBA16
framebuffer, while when using the Mobile renderer it will be a RGB10_A2
framebuffer. Additionally, 2D rendering will take place in linear color space and will be converted to sRGB space immediately before blitting to the screen (if the Viewport is attached to the screen). Practically speaking, this means that the end result of the Viewport will not be clamped into the 0-1
range and can be used in 3D rendering without color space adjustments. This allows 2D rendering to take advantage of effects requiring high dynamic range (e.g. 2D glow) as well as substantially improves the appearance of effects requiring highly detailed gradients. This setting has the same effect as UseHdr2D.
Note: This setting will have no effect when using the GL Compatibility renderer as the GL Compatibility renderer always renders in low dynamic range for performance reasons.
public void ViewportSetUseHdr2D(Rid viewport, bool enabled)
Parameters
ViewportSetUseOcclusionCulling(Rid, bool)
If true
, enables occlusion culling on the specified viewport. Equivalent to ProjectSettings.rendering/occlusion_culling/use_occlusion_culling
.
public void ViewportSetUseOcclusionCulling(Rid viewport, bool enable)
Parameters
ViewportSetUseTaa(Rid, bool)
If true
, use Temporal Anti-Aliasing. Equivalent to ProjectSettings.rendering/anti_aliasing/quality/use_taa
.
public void ViewportSetUseTaa(Rid viewport, bool enable)
Parameters
ViewportSetUseXR(Rid, bool)
If true
, the viewport uses augmented or virtual reality technologies. See XRInterface.
public void ViewportSetUseXR(Rid viewport, bool useXR)
Parameters
ViewportSetVrsMode(Rid, ViewportVrsMode)
Sets the Variable Rate Shading (VRS) mode for the viewport. If the GPU does not support VRS, this property is ignored. Equivalent to ProjectSettings.rendering/vrs/mode
.
public void ViewportSetVrsMode(Rid viewport, RenderingServer.ViewportVrsMode mode)
Parameters
viewport
Ridmode
RenderingServer.ViewportVrsMode
ViewportSetVrsTexture(Rid, Rid)
The texture to use when the VRS mode is set to Texture. Equivalent to ProjectSettings.rendering/vrs/texture
.
public void ViewportSetVrsTexture(Rid viewport, Rid texture)
Parameters
VisibilityNotifierCreate()
Creates a new 3D visibility notifier object and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all visibility_notifier_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
To place in a scene, attach this mesh to an instance using InstanceSetBase(Rid, Rid) using the returned RID.
Note: The equivalent node is VisibleOnScreenNotifier3D.
public Rid VisibilityNotifierCreate()
Returns
VisibilityNotifierSetAabb(Rid, Aabb)
public void VisibilityNotifierSetAabb(Rid notifier, Aabb aabb)
Parameters
VisibilityNotifierSetCallbacks(Rid, Callable, Callable)
public void VisibilityNotifierSetCallbacks(Rid notifier, Callable enterCallable, Callable exitCallable)
Parameters
VoxelGIAllocateData(Rid, Transform3D, Aabb, Vector3I, byte[], byte[], byte[], int[])
public void VoxelGIAllocateData(Rid voxelGI, Transform3D toCellXform, Aabb aabb, Vector3I octreeSize, byte[] octreeCells, byte[] dataCells, byte[] distanceField, int[] levelCounts)
Parameters
voxelGI
RidtoCellXform
Transform3Daabb
AabboctreeSize
Vector3IoctreeCells
byte[]dataCells
byte[]distanceField
byte[]levelCounts
int[]
VoxelGICreate()
Creates a new voxel-based global illumination object and adds it to the RenderingServer. It can be accessed with the RID that is returned. This RID will be used in all voxel_gi_*
RenderingServer functions.
Once finished with your RID, you will want to free the RID using the RenderingServer's FreeRid(Rid) method.
Note: The equivalent node is VoxelGI.
public Rid VoxelGICreate()
Returns
VoxelGIGetDataCells(Rid)
public byte[] VoxelGIGetDataCells(Rid voxelGI)
Parameters
voxelGI
Rid
Returns
- byte[]
VoxelGIGetDistanceField(Rid)
public byte[] VoxelGIGetDistanceField(Rid voxelGI)
Parameters
voxelGI
Rid
Returns
- byte[]
VoxelGIGetLevelCounts(Rid)
public int[] VoxelGIGetLevelCounts(Rid voxelGI)
Parameters
voxelGI
Rid
Returns
- int[]
VoxelGIGetOctreeCells(Rid)
public byte[] VoxelGIGetOctreeCells(Rid voxelGI)
Parameters
voxelGI
Rid
Returns
- byte[]
VoxelGIGetOctreeSize(Rid)
public Vector3I VoxelGIGetOctreeSize(Rid voxelGI)
Parameters
voxelGI
Rid
Returns
VoxelGIGetToCellXform(Rid)
public Transform3D VoxelGIGetToCellXform(Rid voxelGI)
Parameters
voxelGI
Rid
Returns
VoxelGISetBakedExposureNormalization(Rid, float)
Used to inform the renderer what exposure normalization value was used while baking the voxel gi. This value will be used and modulated at run time to ensure that the voxel gi maintains a consistent level of exposure even if the scene-wide exposure normalization is changed at run time. For more information see CameraAttributesSetExposure(Rid, float, float).
public void VoxelGISetBakedExposureNormalization(Rid voxelGI, float bakedExposure)
Parameters
VoxelGISetBias(Rid, float)
public void VoxelGISetBias(Rid voxelGI, float bias)
Parameters
VoxelGISetDynamicRange(Rid, float)
Sets the DynamicRange value to use on the specified voxelGI
's Rid.
public void VoxelGISetDynamicRange(Rid voxelGI, float range)
Parameters
VoxelGISetEnergy(Rid, float)
public void VoxelGISetEnergy(Rid voxelGI, float energy)
Parameters
VoxelGISetInterior(Rid, bool)
public void VoxelGISetInterior(Rid voxelGI, bool enable)
Parameters
VoxelGISetNormalBias(Rid, float)
Sets the NormalBias value to use on the specified voxelGI
's Rid.
public void VoxelGISetNormalBias(Rid voxelGI, float bias)
Parameters
VoxelGISetPropagation(Rid, float)
Sets the Propagation value to use on the specified voxelGI
's Rid.
public void VoxelGISetPropagation(Rid voxelGI, float amount)
Parameters
VoxelGISetQuality(VoxelGIQuality)
Sets the ProjectSettings.rendering/global_illumination/voxel_gi/quality
value to use when rendering. This parameter is global and cannot be set on a per-VoxelGI basis.
public void VoxelGISetQuality(RenderingServer.VoxelGIQuality quality)
Parameters
quality
RenderingServer.VoxelGIQuality
VoxelGISetUseTwoBounces(Rid, bool)
Sets the UseTwoBounces value to use on the specified voxelGI
's Rid.
public void VoxelGISetUseTwoBounces(Rid voxelGI, bool enable)
Parameters
Events
FramePostDraw
Emitted at the end of the frame, after the RenderingServer has finished updating all the Viewports.
public event Action FramePostDraw
Event Type
FramePreDraw
Emitted at the beginning of the frame, before the RenderingServer updates all the Viewports.
public event Action FramePreDraw