VisualServer¶
Inherits: Object
Server for anything visible.
Description¶
Server for anything visible. The visual server is the API backend for everything visible. The whole scene system mounts on it to display.
The visual server is completely opaque, the internals are entirely implementation specific and cannot be accessed.
The visual server can be used to bypass the scene system entirely.
Resources are created using the *_create
functions.
All objects are drawn to a viewport. You can use the Viewport attached to the SceneTree or you can create one yourself with viewport_create. When using a custom scenario or canvas, the scenario or canvas needs to be attached to the viewport using viewport_set_scenario or viewport_attach_canvas.
In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the visual server from a running game, the scenario can be accessed from the scene tree from any Spatial node with Spatial.get_world. Otherwise, a scenario can be created with scenario_create.
Similarly in 2D, a canvas is needed to draw all canvas items.
In 3D, all visible objects are comprised of a resource and an instance. A resource can be a mesh, a particle system, a light, or any other 3D object. In order to be visible resources must be attached to an instance using instance_set_base. The instance must also be attached to the scenario using instance_set_scenario in order to be visible.
In 2D, all visible objects are some form of canvas item. In order to be visible, a canvas item needs to be the child of a canvas attached to a viewport, or it needs to be the child of another canvas item that is eventually attached to the canvas.
Tutorials¶
Methods¶
Signals¶
Emitted at the end of the frame, after the VisualServer has finished updating all the Viewports.
Emitted at the beginning of the frame, before the VisualServer updates all the Viewports.
Enumerations¶
- CUBEMAP_LEFT = 0 — Marks the left side of a cubemap.
- CUBEMAP_RIGHT = 1 — Marks the right side of a cubemap.
- CUBEMAP_BOTTOM = 2 — Marks the bottom side of a cubemap.
- CUBEMAP_TOP = 3 — Marks the top side of a cubemap.
- CUBEMAP_FRONT = 4 — Marks the front side of a cubemap.
- CUBEMAP_BACK = 5 — Marks the back side of a cubemap.
- TEXTURE_TYPE_2D = 0 — Normal texture with 2 dimensions, width and height.
- TEXTURE_TYPE_CUBEMAP = 2 — Texture made up of six faces, can be looked up with a
vec3
in shader. - TEXTURE_TYPE_2D_ARRAY = 3 — An array of 2-dimensional textures.
- TEXTURE_TYPE_3D = 4 — A 3-dimensional texture with width, height, and depth.
- TEXTURE_FLAG_MIPMAPS = 1 — Generates mipmaps, which are smaller versions of the same texture to use when zoomed out, keeping the aspect ratio.
- TEXTURE_FLAG_REPEAT = 2 — Repeats the texture (instead of clamp to edge).
- TEXTURE_FLAG_FILTER = 4 — Uses a magnifying filter, to enable smooth zooming in of the texture.
- TEXTURE_FLAG_ANISOTROPIC_FILTER = 8 — Uses anisotropic mipmap filtering. Generates smaller versions of the same texture with different aspect ratios.
This results in better-looking textures when viewed from oblique angles.
- TEXTURE_FLAG_CONVERT_TO_LINEAR = 16 — Converts the texture to the sRGB color space.
- TEXTURE_FLAG_MIRRORED_REPEAT = 32 — Repeats the texture with alternate sections mirrored.
- TEXTURE_FLAG_USED_FOR_STREAMING = 2048 — Texture is a video surface.
- TEXTURE_FLAGS_DEFAULT = 7 — Default flags. TEXTURE_FLAG_MIPMAPS, TEXTURE_FLAG_REPEAT and TEXTURE_FLAG_FILTER are enabled.
- SHADER_SPATIAL = 0 — Shader is a 3D shader.
- SHADER_CANVAS_ITEM = 1 — Shader is a 2D shader.
- SHADER_PARTICLES = 2 — Shader is a particle shader.
- SHADER_MAX = 3 — Represents the size of the ShaderMode enum.
- ARRAY_VERTEX = 0 — Array is a vertex array.
- ARRAY_NORMAL = 1 — Array is a normal array.
- ARRAY_TANGENT = 2 — Array is a tangent array.
- ARRAY_COLOR = 3 — Array is a color array.
- ARRAY_TEX_UV = 4 — Array is an UV coordinates array.
- ARRAY_TEX_UV2 = 5 — Array is an UV coordinates array for the second UV coordinates.
- ARRAY_BONES = 6 — Array contains bone information.
- ARRAY_WEIGHTS = 7 — Array is weight information.
- ARRAY_INDEX = 8 — Array is index array.
- ARRAY_MAX = 9 — Represents the size of the ArrayType enum.
- ARRAY_FORMAT_VERTEX = 1 — Flag used to mark a vertex array.
- ARRAY_FORMAT_NORMAL = 2 — Flag used to mark a normal array.
- ARRAY_FORMAT_TANGENT = 4 — Flag used to mark a tangent array.
- ARRAY_FORMAT_COLOR = 8 — Flag used to mark a color array.
- ARRAY_FORMAT_TEX_UV = 16 — Flag used to mark an UV coordinates array.
- ARRAY_FORMAT_TEX_UV2 = 32 — Flag used to mark an UV coordinates array for the second UV coordinates.
- ARRAY_FORMAT_BONES = 64 — Flag used to mark a bone information array.
- ARRAY_FORMAT_WEIGHTS = 128 — Flag used to mark a weights array.
- ARRAY_FORMAT_INDEX = 256 — Flag used to mark an index array.
- ARRAY_COMPRESS_VERTEX = 512 — Flag used to mark a compressed (half float) vertex array.
- ARRAY_COMPRESS_NORMAL = 1024 — Flag used to mark a compressed (half float) normal array.
- ARRAY_COMPRESS_TANGENT = 2048 — Flag used to mark a compressed (half float) tangent array.
- ARRAY_COMPRESS_COLOR = 4096 — Flag used to mark a compressed (half float) color array.
- ARRAY_COMPRESS_TEX_UV = 8192 — Flag used to mark a compressed (half float) UV coordinates array.
- ARRAY_COMPRESS_TEX_UV2 = 16384 — Flag used to mark a compressed (half float) UV coordinates array for the second UV coordinates.
- ARRAY_COMPRESS_BONES = 32768 — Flag used to mark a compressed bone array.
- ARRAY_COMPRESS_WEIGHTS = 65536 — Flag used to mark a compressed (half float) weight array.
- ARRAY_COMPRESS_INDEX = 131072 — Flag used to mark a compressed index array.
- ARRAY_FLAG_USE_2D_VERTICES = 262144 — Flag used to mark that the array contains 2D vertices.
- ARRAY_FLAG_USE_16_BIT_BONES = 524288 — Flag used to mark that the array uses 16-bit bones instead of 8-bit.
- ARRAY_COMPRESS_DEFAULT = 97280 — Used to set flags ARRAY_COMPRESS_VERTEX, ARRAY_COMPRESS_NORMAL, ARRAY_COMPRESS_TANGENT, ARRAY_COMPRESS_COLOR, ARRAY_COMPRESS_TEX_UV, ARRAY_COMPRESS_TEX_UV2 and ARRAY_COMPRESS_WEIGHTS quickly.
- PRIMITIVE_POINTS = 0 — Primitive to draw consists of points.
- PRIMITIVE_LINES = 1 — Primitive to draw consists of lines.
- PRIMITIVE_LINE_STRIP = 2 — Primitive to draw consists of a line strip from start to end.
- PRIMITIVE_LINE_LOOP = 3 — Primitive to draw consists of a line loop (a line strip with a line between the last and the first vertex).
- PRIMITIVE_TRIANGLES = 4 — Primitive to draw consists of triangles.
- PRIMITIVE_TRIANGLE_STRIP = 5 — Primitive to draw consists of a triangle strip (the last 3 vertices are always combined to make a triangle).
- PRIMITIVE_TRIANGLE_FAN = 6 — Primitive to draw consists of a triangle strip (the last 2 vertices are always combined with the first to make a triangle).
- PRIMITIVE_MAX = 7 — Represents the size of the PrimitiveType enum.
- BLEND_SHAPE_MODE_NORMALIZED = 0 — Blend shapes are normalized.
- BLEND_SHAPE_MODE_RELATIVE = 1 — Blend shapes are relative to base weight.
- LIGHT_DIRECTIONAL = 0 — Is a directional (sun) light.
- LIGHT_OMNI = 1 — Is an omni light.
- LIGHT_SPOT = 2 — Is a spot light.
- LIGHT_PARAM_ENERGY = 0 — The light’s energy.
- LIGHT_PARAM_SPECULAR = 2 — The light’s influence on specularity.
- LIGHT_PARAM_RANGE = 3 — The light’s range.
- LIGHT_PARAM_ATTENUATION = 4 — The light’s attenuation.
- LIGHT_PARAM_SPOT_ANGLE = 5 — The spotlight’s angle.
- LIGHT_PARAM_SPOT_ATTENUATION = 6 — The spotlight’s attenuation.
- LIGHT_PARAM_CONTACT_SHADOW_SIZE = 7 — Scales the shadow color.
- LIGHT_PARAM_SHADOW_MAX_DISTANCE = 8 — Max distance that shadows will be rendered.
- LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET = 9 — Proportion of shadow atlas occupied by the first split.
- LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET = 10 — Proportion of shadow atlas occupied by the second split.
- LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET = 11 — Proportion of shadow atlas occupied by the third split. The fourth split occupies the rest.
- LIGHT_PARAM_SHADOW_NORMAL_BIAS = 12 — Normal bias used to offset shadow lookup by object normal. Can be used to fix self-shadowing artifacts.
- LIGHT_PARAM_SHADOW_BIAS = 13 — Bias the shadow lookup to fix self-shadowing artifacts.
- LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE = 14 — Increases bias on further splits to fix self-shadowing that only occurs far away from the camera.
- LIGHT_PARAM_MAX = 15 — Represents the size of the LightParam enum.
- LIGHT_OMNI_SHADOW_DUAL_PARABOLOID = 0 — Use a dual paraboloid shadow map for omni lights.
- LIGHT_OMNI_SHADOW_CUBE = 1 — Use a cubemap shadow map for omni lights. Slower but better quality than dual paraboloid.
- LIGHT_OMNI_SHADOW_DETAIL_VERTICAL = 0 — Use more detail vertically when computing shadow map.
- LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL = 1 — Use more detail horizontally when computing shadow map.
enum LightDirectionalShadowMode:
- LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL = 0 — Use orthogonal shadow projection for directional light.
- LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS = 1 — Use 2 splits for shadow projection when using directional light.
- LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS = 2 — Use 4 splits for shadow projection when using directional light.
enum LightDirectionalShadowDepthRangeMode:
- LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE = 0 — Keeps shadows stable as camera moves but has lower effective resolution.
- LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED = 1 — Optimize use of shadow maps, increasing the effective resolution. But may result in shadows moving or flickering slightly.
- VIEWPORT_UPDATE_DISABLED = 0 — Do not update the viewport.
- VIEWPORT_UPDATE_ONCE = 1 — Update the viewport once then set to disabled.
- VIEWPORT_UPDATE_WHEN_VISIBLE = 2 — Update the viewport whenever it is visible.
- VIEWPORT_UPDATE_ALWAYS = 3 — Always update the viewport.
- VIEWPORT_CLEAR_ALWAYS = 0 — The viewport is always cleared before drawing.
- VIEWPORT_CLEAR_NEVER = 1 — The viewport is never cleared before drawing.
- VIEWPORT_CLEAR_ONLY_NEXT_FRAME = 2 — The viewport is cleared once, then the clear mode is set to VIEWPORT_CLEAR_NEVER.
- VIEWPORT_MSAA_DISABLED = 0 — Multisample antialiasing is disabled.
- VIEWPORT_MSAA_2X = 1 — Multisample antialiasing is set to 2×.
- VIEWPORT_MSAA_4X = 2 — Multisample antialiasing is set to 4×.
- VIEWPORT_MSAA_8X = 3 — Multisample antialiasing is set to 8×.
- VIEWPORT_MSAA_16X = 4 — Multisample antialiasing is set to 16×.
- VIEWPORT_MSAA_EXT_2X = 5 — Multisample antialiasing is set to 2× on external texture. Special mode for GLES2 Android VR (Oculus Quest and Go).
- VIEWPORT_MSAA_EXT_4X = 6 — Multisample antialiasing is set to 4× on external texture. Special mode for GLES2 Android VR (Oculus Quest and Go).
- VIEWPORT_USAGE_2D = 0 — The Viewport does not render 3D but samples.
- VIEWPORT_USAGE_2D_NO_SAMPLING = 1 — The Viewport does not render 3D and does not sample.
- VIEWPORT_USAGE_3D = 2 — The Viewport renders 3D with effects.
- VIEWPORT_USAGE_3D_NO_EFFECTS = 3 — The Viewport renders 3D but without effects.
- VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME = 0 — Number of objects drawn in a single frame.
- VIEWPORT_RENDER_INFO_VERTICES_IN_FRAME = 1 — Number of vertices drawn in a single frame.
- VIEWPORT_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME = 2 — Number of material changes during this frame.
- VIEWPORT_RENDER_INFO_SHADER_CHANGES_IN_FRAME = 3 — Number of shader changes during this frame.
- VIEWPORT_RENDER_INFO_SURFACE_CHANGES_IN_FRAME = 4 — Number of surface changes during this frame.
- VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME = 5 — Number of draw calls during this frame.
- VIEWPORT_RENDER_INFO_2D_ITEMS_IN_FRAME = 6 — Number of 2d items drawn this frame.
- VIEWPORT_RENDER_INFO_2D_DRAW_CALLS_IN_FRAME = 7 — Number of 2d draw calls during this frame.
- VIEWPORT_RENDER_INFO_MAX = 8 — Represents the size of the ViewportRenderInfo enum.
- VIEWPORT_DEBUG_DRAW_DISABLED = 0 — Debug draw is disabled. Default setting.
- VIEWPORT_DEBUG_DRAW_UNSHADED = 1 — Debug draw sets objects to unshaded.
- VIEWPORT_DEBUG_DRAW_OVERDRAW = 2 — Overwrites clear color to
(0,0,0,0)
. - VIEWPORT_DEBUG_DRAW_WIREFRAME = 3 — Debug draw draws objects in wireframe.
- SCENARIO_DEBUG_DISABLED = 0 — Do not use a debug mode.
- SCENARIO_DEBUG_WIREFRAME = 1 — Draw all objects as wireframe models.
- SCENARIO_DEBUG_OVERDRAW = 2 — Draw all objects in a way that displays how much overdraw is occurring. Overdraw occurs when a section of pixels is drawn and shaded and then another object covers it up. To optimize a scene, you should reduce overdraw.
- SCENARIO_DEBUG_SHADELESS = 3 — Draw all objects without shading. Equivalent to setting all objects shaders to
unshaded
.
- INSTANCE_NONE = 0 — The instance does not have a type.
- INSTANCE_MESH = 1 — The instance is a mesh.
- INSTANCE_MULTIMESH = 2 — The instance is a multimesh.
- INSTANCE_IMMEDIATE = 3 — The instance is an immediate geometry.
- INSTANCE_PARTICLES = 4 — The instance is a particle emitter.
- INSTANCE_LIGHT = 5 — The instance is a light.
- INSTANCE_REFLECTION_PROBE = 6 — The instance is a reflection probe.
- INSTANCE_GI_PROBE = 7 — The instance is a GI probe.
- INSTANCE_LIGHTMAP_CAPTURE = 8 — The instance is a lightmap capture.
- INSTANCE_MAX = 9 — Represents the size of the InstanceType enum.
- INSTANCE_GEOMETRY_MASK = 30 — A combination of the flags of geometry instances (mesh, multimesh, immediate and particles).
- INSTANCE_FLAG_USE_BAKED_LIGHT = 0 — Allows the instance to be used in baked lighting.
- INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE = 1 — When set, manually requests to draw geometry on next frame.
- INSTANCE_FLAG_MAX = 2 — Represents the size of the InstanceFlags enum.
- SHADOW_CASTING_SETTING_OFF = 0 — Disable shadows from this instance.
- SHADOW_CASTING_SETTING_ON = 1 — Cast shadows from this instance.
- SHADOW_CASTING_SETTING_DOUBLE_SIDED = 2 — Disable backface culling when rendering the shadow of the object. This is slightly slower but may result in more correct shadows.
- SHADOW_CASTING_SETTING_SHADOWS_ONLY = 3 — Only render the shadows from the object. The object itself will not be drawn.
- NINE_PATCH_STRETCH = 0 — The nine patch gets stretched where needed.
- NINE_PATCH_TILE = 1 — The nine patch gets filled with tiles where needed.
- NINE_PATCH_TILE_FIT = 2 — The nine patch gets filled with tiles where needed and stretches them a bit if needed.
- CANVAS_LIGHT_MODE_ADD = 0 — Adds light color additive to the canvas.
- CANVAS_LIGHT_MODE_SUB = 1 — Adds light color subtractive to the canvas.
- CANVAS_LIGHT_MODE_MIX = 2 — The light adds color depending on transparency.
- CANVAS_LIGHT_MODE_MASK = 3 — The light adds color depending on mask.
- CANVAS_LIGHT_FILTER_NONE = 0 — Do not apply a filter to canvas light shadows.
- CANVAS_LIGHT_FILTER_PCF3 = 1 — Use PCF3 filtering to filter canvas light shadows.
- CANVAS_LIGHT_FILTER_PCF5 = 2 — Use PCF5 filtering to filter canvas light shadows.
- CANVAS_LIGHT_FILTER_PCF7 = 3 — Use PCF7 filtering to filter canvas light shadows.
- CANVAS_LIGHT_FILTER_PCF9 = 4 — Use PCF9 filtering to filter canvas light shadows.
- CANVAS_LIGHT_FILTER_PCF13 = 5 — Use PCF13 filtering to filter canvas light shadows.
enum CanvasOccluderPolygonCullMode:
- CANVAS_OCCLUDER_POLYGON_CULL_DISABLED = 0 — Culling of the canvas occluder is disabled.
- CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE = 1 — Culling of the canvas occluder is clockwise.
- CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE = 2 — Culling of the canvas occluder is counterclockwise.
- INFO_OBJECTS_IN_FRAME = 0 — The amount of objects in the frame.
- INFO_VERTICES_IN_FRAME = 1 — The amount of vertices in the frame.
- INFO_MATERIAL_CHANGES_IN_FRAME = 2 — The amount of modified materials in the frame.
- INFO_SHADER_CHANGES_IN_FRAME = 3 — The amount of shader rebinds in the frame.
- INFO_SURFACE_CHANGES_IN_FRAME = 4 — The amount of surface changes in the frame.
- INFO_DRAW_CALLS_IN_FRAME = 5 — The amount of draw calls in frame.
- INFO_2D_ITEMS_IN_FRAME = 6 — The amount of 2d items in the frame.
- INFO_2D_DRAW_CALLS_IN_FRAME = 7 — The amount of 2d draw calls in frame.
- INFO_USAGE_VIDEO_MEM_TOTAL = 8 — Unimplemented in the GLES2 and GLES3 rendering backends, always returns 0.
- INFO_VIDEO_MEM_USED = 9 — The amount of video memory used, i.e. texture and vertex memory combined.
- INFO_TEXTURE_MEM_USED = 10 — The amount of texture memory used.
- INFO_VERTEX_MEM_USED = 11 — The amount of vertex memory used.
- FEATURE_SHADERS = 0 — Hardware supports shaders. This enum is currently unused in Godot 3.x.
- FEATURE_MULTITHREADED = 1 — Hardware supports multithreading. This enum is currently unused in Godot 3.x.
enum MultimeshTransformFormat:
- MULTIMESH_TRANSFORM_2D = 0 — Use Transform2D to store MultiMesh transform.
- MULTIMESH_TRANSFORM_3D = 1 — Use Transform to store MultiMesh transform.
- MULTIMESH_COLOR_NONE = 0 — MultiMesh does not use per-instance color.
- MULTIMESH_COLOR_8BIT = 1 — MultiMesh color uses 8 bits per component. This packs the color into a single float.
- MULTIMESH_COLOR_FLOAT = 2 — MultiMesh color uses a float per channel.
enum MultimeshCustomDataFormat:
- MULTIMESH_CUSTOM_DATA_NONE = 0 — MultiMesh does not use custom data.
- MULTIMESH_CUSTOM_DATA_8BIT = 1 — MultiMesh custom data uses 8 bits per component. This packs the 4-component custom data into a single float.
- MULTIMESH_CUSTOM_DATA_FLOAT = 2 — MultiMesh custom data uses a float per component.
enum ReflectionProbeUpdateMode:
- REFLECTION_PROBE_UPDATE_ONCE = 0 — Reflection probe will update reflections once and then stop.
- REFLECTION_PROBE_UPDATE_ALWAYS = 1 — Reflection probe will update each frame. This mode is necessary to capture moving objects.
- PARTICLES_DRAW_ORDER_INDEX = 0 — Draw particles in the order that they appear in the particles array.
- PARTICLES_DRAW_ORDER_LIFETIME = 1 — Sort particles based on their lifetime.
- PARTICLES_DRAW_ORDER_VIEW_DEPTH = 2 — Sort particles based on their distance to the camera.
- ENV_BG_CLEAR_COLOR = 0 — Use the clear color as background.
- ENV_BG_COLOR = 1 — Use a specified color as the background.
- ENV_BG_SKY = 2 — Use a sky resource for the background.
- ENV_BG_COLOR_SKY = 3 — Use a custom color for background, but use a sky for shading and reflections.
- ENV_BG_CANVAS = 4 — Use a specified canvas layer as the background. This can be useful for instantiating a 2D scene in a 3D world.
- ENV_BG_KEEP = 5 — Do not clear the background, use whatever was rendered last frame as the background.
- ENV_BG_MAX = 7 — Represents the size of the EnvironmentBG enum.
enum EnvironmentDOFBlurQuality:
- ENV_DOF_BLUR_QUALITY_LOW = 0 — Use lowest blur quality. Fastest, but may look bad.
- ENV_DOF_BLUR_QUALITY_MEDIUM = 1 — Use medium blur quality.
- ENV_DOF_BLUR_QUALITY_HIGH = 2 — Used highest blur quality. Looks the best, but is the slowest.
enum EnvironmentGlowBlendMode:
- GLOW_BLEND_MODE_ADDITIVE = 0 — Add the effect of the glow on top of the scene.
- GLOW_BLEND_MODE_SCREEN = 1 — Blends the glow effect with the screen. Does not get as bright as additive.
- GLOW_BLEND_MODE_SOFTLIGHT = 2 — Produces a subtle color disturbance around objects.
- GLOW_BLEND_MODE_REPLACE = 3 — Shows the glow effect by itself without the underlying scene.
- ENV_TONE_MAPPER_LINEAR = 0 — Output color as they came in.
- ENV_TONE_MAPPER_REINHARD = 1 — Use the Reinhard tonemapper.
- ENV_TONE_MAPPER_FILMIC = 2 — Use the filmic tonemapper.
- ENV_TONE_MAPPER_ACES = 3 — Use the ACES tonemapper.
- ENV_SSAO_QUALITY_LOW = 0 — Lowest quality of screen space ambient occlusion.
- ENV_SSAO_QUALITY_MEDIUM = 1 — Medium quality screen space ambient occlusion.
- ENV_SSAO_QUALITY_HIGH = 2 — Highest quality screen space ambient occlusion.
- ENV_SSAO_BLUR_DISABLED = 0 — Disables the blur set for SSAO. Will make SSAO look noisier.
- ENV_SSAO_BLUR_1x1 = 1 — Perform a 1x1 blur on the SSAO output.
- ENV_SSAO_BLUR_2x2 = 2 — Performs a 2x2 blur on the SSAO output.
- ENV_SSAO_BLUR_3x3 = 3 — Performs a 3x3 blur on the SSAO output. Use this for smoothest SSAO.
Constants¶
- NO_INDEX_ARRAY = -1 — Marks an error that shows that the index array is empty.
- ARRAY_WEIGHTS_SIZE = 4 — Number of weights/bones per vertex.
- CANVAS_ITEM_Z_MIN = -4096 — The minimum Z-layer for canvas items.
- CANVAS_ITEM_Z_MAX = 4096 — The maximum Z-layer for canvas items.
- MAX_GLOW_LEVELS = 7 — Max number of glow levels that can be used with glow post-process effect.
- MAX_CURSORS = 8 — Unused enum in Godot 3.x.
- MATERIAL_RENDER_PRIORITY_MIN = -128 — The minimum renderpriority of all materials.
- MATERIAL_RENDER_PRIORITY_MAX = 127 — The maximum renderpriority of all materials.
Method Descriptions¶
Sets images to be rendered in the window margin.
Sets margin size, where black bars (or images, if black_bars_set_images was used) are rendered.
- RID camera_create ( )
Creates a camera and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all camera_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.
Sets the cull mask associated with this camera. The cull mask describes which 3D layers are rendered by this camera. Equivalent to Camera.cull_mask.
Sets the environment used by this camera. Equivalent to Camera.environment.
Sets camera to use frustum projection. This mode allows adjusting the offset
argument to create “tilted frustum” effects.
Sets camera to use orthogonal projection, also known as orthographic projection. Objects remain the same size on the screen no matter how far away they are.
Sets camera to use perspective projection. Objects on the screen becomes smaller when they are far away.
Sets Transform of camera.
If true
, preserves the horizontal aspect ratio which is equivalent to Camera.KEEP_WIDTH. If false
, preserves the vertical aspect ratio which is equivalent to Camera.KEEP_HEIGHT.
- RID canvas_create ( )
Creates a canvas and returns the assigned RID. It can be accessed with the RID that is returned. This RID will be used in all canvas_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.
Adds a circle command to the CanvasItem’s draw commands.
If ignore is true
, the VisualServer does not perform clipping.
- void canvas_item_add_line ( RID item, Vector2 from, Vector2 to, Color color, float width=1.0, bool antialiased=false )
Adds a line command to the CanvasItem’s draw commands.
- void canvas_item_add_mesh ( RID item, RID mesh, Transform2D transform=Transform2D( 1, 0, 0, 1, 0, 0 ), Color modulate=Color( 1, 1, 1, 1 ), RID texture, RID normal_map )
Adds a mesh command to the CanvasItem’s draw commands.
Adds a MultiMesh to the CanvasItem’s draw commands. Only affects its aabb at the moment.
- void canvas_item_add_nine_patch ( RID item, Rect2 rect, Rect2 source, RID texture, Vector2 topleft, Vector2 bottomright, NinePatchAxisMode x_axis_mode=0, NinePatchAxisMode y_axis_mode=0, bool draw_center=true, Color modulate=Color( 1, 1, 1, 1 ), RID normal_map )
Adds a nine patch image to the CanvasItem’s draw commands.
See NinePatchRect for more explanation.
Adds a particle system to the CanvasItem’s draw commands.
- void canvas_item_add_polygon ( RID item, PoolVector2Array points, PoolColorArray colors, PoolVector2Array uvs=PoolVector2Array( ), RID texture, RID normal_map, bool antialiased=false )
Adds a polygon to the CanvasItem’s draw commands.
- void canvas_item_add_polyline ( RID item, PoolVector2Array points, PoolColorArray colors, float width=1.0, bool antialiased=false )
Adds a polyline, which is a line from multiple points with a width, to the CanvasItem’s draw commands.
- void canvas_item_add_primitive ( RID item, PoolVector2Array points, PoolColorArray colors, PoolVector2Array uvs, RID texture, float width=1.0, RID normal_map )
Adds a primitive to the CanvasItem’s draw commands.
Adds a rectangle to the CanvasItem’s draw commands.
- void canvas_item_add_set_transform ( RID item, Transform2D transform )
Adds a Transform2D command to the CanvasItem’s draw commands.
This sets the extra_matrix uniform when executed. This affects the later commands of the canvas item.
- void canvas_item_add_texture_rect ( RID item, Rect2 rect, RID texture, bool tile=false, Color modulate=Color( 1, 1, 1, 1 ), bool transpose=false, RID normal_map )
Adds a textured rect to the CanvasItem’s draw commands.
- void canvas_item_add_texture_rect_region ( RID item, Rect2 rect, RID texture, Rect2 src_rect, Color modulate=Color( 1, 1, 1, 1 ), bool transpose=false, RID normal_map, bool clip_uv=true )
Adds a texture rect with region setting to the CanvasItem’s draw commands.
- void canvas_item_add_triangle_array ( RID item, PoolIntArray indices, PoolVector2Array points, PoolColorArray colors, PoolVector2Array uvs=PoolVector2Array( ), PoolIntArray bones=PoolIntArray( ), PoolRealArray weights=PoolRealArray( ), RID texture, int count=-1, RID normal_map, bool antialiased=false, bool antialiasing_use_indices=false )
Adds a triangle array to the CanvasItem’s draw commands.
- void canvas_item_clear ( RID item )
Clears the CanvasItem and removes all commands in it.
- RID canvas_item_create ( )
Creates a new CanvasItem and returns its RID. It can be accessed with the RID that is returned. This RID will be used in all canvas_item_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.
Sets clipping for the CanvasItem.
Sets the CanvasItem to copy a rect to the backbuffer.
Defines a custom drawing rectangle for the CanvasItem.
Enables the use of distance fields for GUI elements that are rendering distance field based fonts.
Sets CanvasItem to be drawn behind its parent.
Sets the index for the CanvasItem.
The light mask. See LightOccluder2D for more information on light masks.
Sets a new material to the CanvasItem.
Sets the color that modulates the CanvasItem and its children.
Sets the parent for the CanvasItem. The parent can be another canvas item, or it can be the root canvas that is attached to the viewport.
Sets the color that modulates the CanvasItem without children.
Sets if CanvasItem’s children should be sorted by y-position.
- void canvas_item_set_transform ( RID item, Transform2D transform )
Sets the CanvasItem’s Transform2D.
Sets if the CanvasItem uses its parent’s material.
Sets if the canvas item (including its children) is visible.
If this is enabled, the Z index of the parent will be added to the children’s Z index.
Sets the CanvasItem’s Z index, i.e. its draw order (lower indexes are drawn first).
Attaches the canvas light to the canvas. Removes it from its previous canvas.
- RID canvas_light_create ( )
Creates a canvas light and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_light_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.
Attaches a light occluder to the canvas. Removes it from its previous canvas.
- RID canvas_light_occluder_create ( )
Creates a light occluder and adds it to the VisualServer. It can be accessed with the RID that is returned. This RID will be used in all canvas_light_ocluder_*
VisualServer functions.
Once finished with your RID, you will want to free the RID using the VisualServer’s free_rid static method.
Enables or disables light occluder.
The light mask. See LightOccluder2D for more information on light masks.
Sets a light occluder’s polygon.
- void canvas_light_occluder_set_transform ( RID occluder, Transform2D transform )
Sets a light occluder’s Transform2D.
Sets the color for a light.
Enables or disables a canvas light.
Sets a canvas light’s energy.
Sets a canvas light’s height.
The light mask. See LightOccluder2D for more information on light masks.
The binary mask used to determine which layers this canvas light’s shadows affects. See LightOccluder2D for more information on light masks.
The layer range that gets rendered with this light.
- void canvas_light_set_mode ( RID light, CanvasLightMode mode )
The mode of the light, see CanvasLightMode constants.
Sets the texture’s scale factor of the light. Equivalent to Light2D.texture_scale.
- void <