Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AESContext
- AStar2D
- AStar3D
- AStarGrid2D
- AudioEffectInstance (1)
- AudioSample
- AudioSamplePlayback
- AudioStreamPlayback (5)
- CameraFeed
- CharFXTransform
- ConfigFile
- Crypto
- DTLSServer
- DirAccess
- ENetConnection
- EditorContextMenuPlugin
- EditorDebuggerPlugin
- EditorDebuggerSession
- EditorExportPlatform (6)
- EditorExportPlugin
- EditorExportPreset
- EditorFeatureProfile
- EditorFileSystemImportFormatSupportQuery
- EditorInspectorPlugin
- EditorResourceConversionPlugin
- EditorResourcePreviewGenerator
- EditorResourceTooltipPlugin
- EditorSceneFormatImporter (4)
- EditorScenePostImport
- EditorScenePostImportPlugin
- EditorScript
- EditorTranslationParserPlugin
- EncodedObjectAsID
- EngineProfiler
- Expression
- FileAccess
- GLTFObjectModelProperty
- HMACContext
- HTTPClient
- HashingContext
- ImageFormatLoader (1)
- JavaClass
- JavaObject
- JavaScriptObject
- KinematicCollision2D
- KinematicCollision3D
- Lightmapper (1)
- MeshConvexDecompositionSettings
- MeshDataTool
- MultiplayerAPI (2)
- Mutex
- NavigationPathQueryParameters2D
- NavigationPathQueryParameters3D
- NavigationPathQueryResult2D
- NavigationPathQueryResult3D
- Node3DGizmo (1)
- OggPacketSequencePlayback
- OpenXRAPIExtension
- PCKPacker
- PackedDataContainerRef
- PacketPeer (8)
- PhysicsPointQueryParameters2D
- PhysicsPointQueryParameters3D
- PhysicsRayQueryParameters2D
- PhysicsRayQueryParameters3D
- PhysicsShapeQueryParameters2D
- PhysicsShapeQueryParameters3D
- PhysicsTestMotionParameters2D
- PhysicsTestMotionParameters3D
- PhysicsTestMotionResult2D
- PhysicsTestMotionResult3D
- RDAttachmentFormat
- RDFramebufferPass
- RDPipelineColorBlendState
- RDPipelineColorBlendStateAttachment
- RDPipelineDepthStencilState
- RDPipelineMultisampleState
- RDPipelineRasterizationState
- RDPipelineSpecializationConstant
- RDSamplerState
- RDShaderSource
- RDTextureFormat
- RDTextureView
- RDUniform
- RDVertexAttribute
- RandomNumberGenerator
- RegEx
- RegExMatch
- RenderSceneBuffers (2)
- RenderSceneBuffersConfiguration
- Resource (103)
- ResourceFormatLoader
- ResourceFormatSaver
- ResourceImporter (16)
- SceneState
- SceneTreeTimer
- Semaphore
- SkinReference
- StreamPeer (5)
- SurfaceTool
- TCPServer
- TLSOptions
- TextLine
- TextParagraph
- TextServer (1)
- Thread
- TranslationDomain
- TriangleMesh
- Tween
- Tweener (5)
- UDPServer
- UPNP
- UPNPDevice
- WeakRef
- WebRTCPeerConnection (1)
- XMLParser
- XRInterface (4)
- XRPose
- XRTracker (2)
- ZIPPacker
- ZIPReader
- Animation
- AnimationLibrary
- AnimationNode (6)
- AnimationNodeStateMachinePlayback
- AnimationNodeStateMachineTransition
- AudioBusLayout
- AudioEffect (17)
- AudioStream (10)
- BitMap
- BoneMap
- ButtonGroup
- CameraAttributes (2)
- ColorPalette
- Compositor
- CompositorEffect
- CryptoKey
- Curve
- Curve2D
- Curve3D
- EditorNode3DGizmoPlugin
- EditorSettings
- Environment
- Font (3)
- GDExtension
- GLTFAccessor
- GLTFAnimation
- GLTFBufferView
- GLTFCamera
- GLTFDocument (1)
- GLTFDocumentExtension (1)
- GLTFLight
- GLTFMesh
- GLTFNode
- GLTFPhysicsBody
- GLTFPhysicsShape
- GLTFSkeleton
- GLTFSkin
- GLTFSpecGloss
- GLTFState (1)
- GLTFTexture
- GLTFTextureSampler
- Gradient
- Image
- ImporterMesh
- InputEvent (6)
- JSON
- LabelSettings
- LightmapGIData
- Material (9)
- Mesh (4)
- MeshLibrary
- MissingResource
- MultiMesh
- NavigationMesh
- NavigationMeshSourceGeometryData2D
- NavigationMeshSourceGeometryData3D
- NavigationPolygon
- Noise (1)
- Occluder3D (5)
- OccluderPolygon2D
- OggPacketSequence
- OpenXRAction
- OpenXRActionMap
- OpenXRActionSet
- OpenXRBindingModifier (2)
- OpenXRHapticBase (1)
- OpenXRIPBinding
- OpenXRInteractionProfile
- PackedDataContainer
- PackedScene
- PhysicsMaterial
- PolygonPathFinder
- RDShaderFile
- RDShaderSPIRV
- RichTextEffect
- SceneReplicationConfig
- Script (3)
- Shader (1)
- ShaderInclude
- Shape2D (8)
- Shape3D (9)
- Shortcut
- SkeletonModification2D (7)
- SkeletonModificationStack2D
- SkeletonProfile (1)
- Skin
- Sky
- SpriteFrames
- StyleBox (4)
- SyntaxHighlighter (2)
- Texture (3)
- Theme
- TileMapPattern
- TileSet
- TileSetSource (2)
- Translation (1)
- VideoStream (1)
- VideoStreamPlayback
- VisualShaderNode (62)
- VoxelGIData
- World2D
- World3D
- X509Certificate
Table of contents
-
var graph_offset: Vector2 = Vector2(0, 0) -
func add_node(id: int) -> void -
func add_varying(type: int enumVisualShader.VaryingType) -> void -
func attach_node_to_frame(frame: int) -> void -
const func can_connect_nodes(to_port: int) -> bool -
func connect_nodes(to_port: int) -> intError -
func connect_nodes_forced(to_port: int) -> void -
func detach_node_from_frame(id: int) -> void -
func disconnect_nodes(to_port: int) -> void -
const func get_node(id: int) -> VisualShaderNode -
const func get_node_connections(type: int enumVisualShader.Type) -> Dictionary[] -
const func get_node_list(type: int enumVisualShader.Type) -> PackedInt32Array -
const func get_node_position(id: int) -> Vector2 -
const func get_valid_node_id(type: int enumVisualShader.Type) -> int -
const func has_varying(name: String) -> bool -
const func is_node_connection(to_port: int) -> bool -
func remove_node(id: int) -> void -
func remove_varying(name: String) -> void -
func replace_node(new_class: StringName) -> void -
func set_mode(mode: int enumShader.Mode) -> void -
func set_node_position(position: Vector2) -> void -
const TYPE_VERTEX = 0 enum Type -
const TYPE_FRAGMENT = 1 enum Type -
const TYPE_LIGHT = 2 enum Type -
const TYPE_START = 3 enum Type -
const TYPE_PROCESS = 4 enum Type -
const TYPE_COLLIDE = 5 enum Type -
const TYPE_START_CUSTOM = 6 enum Type -
const TYPE_PROCESS_CUSTOM = 7 enum Type -
const TYPE_SKY = 8 enum Type -
const TYPE_FOG = 9 enum Type -
const TYPE_MAX = 10 enum Type -
const VARYING_MODE_VERTEX_TO_FRAG_LIGHT = 0 enum VaryingMode -
const VARYING_MODE_FRAG_TO_LIGHT = 1 enum VaryingMode -
const VARYING_MODE_MAX = 2 enum VaryingMode -
const VARYING_TYPE_FLOAT = 0 enum VaryingType -
const VARYING_TYPE_INT = 1 enum VaryingType -
const VARYING_TYPE_UINT = 2 enum VaryingType -
const VARYING_TYPE_VECTOR_2D = 3 enum VaryingType -
const VARYING_TYPE_VECTOR_3D = 4 enum VaryingType -
const VARYING_TYPE_VECTOR_4D = 5 enum VaryingType -
const VARYING_TYPE_BOOLEAN = 6 enum VaryingType -
const VARYING_TYPE_TRANSFORM = 7 enum VaryingType -
const VARYING_TYPE_MAX = 8 enum VaryingType -
const NODE_ID_INVALID = -1 -
const NODE_ID_OUTPUT = 0 -
enum Type -
enum VaryingMode -
enum VaryingType
VisualShader #
is_refcounted, is_instantiable, resource, core, not_builtin_classes
A custom shader program with a visual editor.
This class provides a graph-like visual editor for creating a Shader. Although VisualShaders do not require coding, they share the same logic with script shaders. They use VisualShaderNodes that can be connected to each other to control the flow of the shader. The visual shader graph is converted to a script shader behind the scenes.
Members #
var graph_offset: Vector2 = Vector2(0, 0)#
The offset vector of the whole graph.
Methods #
func add_node(id: int) -> void#
Adds the specified node to the shader.
func add_varying(type: int enumVisualShader.VaryingType) -> void#
Adds a new varying value node to the shader.
func attach_node_to_frame(frame: int) -> void#
Attaches the given node to the given frame.
const func can_connect_nodes(to_port: int) -> bool#
Returns true if the specified nodes and ports can be connected together.
func connect_nodes(to_port: int) -> intError#
Connects the specified nodes and ports.
func connect_nodes_forced(to_port: int) -> void#
Connects the specified nodes and ports, even if they can't be connected. Such connection is invalid and will not function properly.
func detach_node_from_frame(id: int) -> void#
Detaches the given node from the frame it is attached to.
func disconnect_nodes(to_port: int) -> void#
Connects the specified nodes and ports.
const func get_node(id: int) -> VisualShaderNode#
Returns the shader node instance with specified type and id.
const func get_node_connections(type: int enumVisualShader.Type) -> Dictionary[]#
Returns the list of connected nodes with the specified type.
const func get_node_list(type: int enumVisualShader.Type) -> PackedInt32Array#
Returns the list of all nodes in the shader with the specified type.
const func get_node_position(id: int) -> Vector2#
Returns the position of the specified node within the shader graph.
const func get_valid_node_id(type: int enumVisualShader.Type) -> int#
Returns next valid node ID that can be added to the shader graph.
const func has_varying(name: String) -> bool#
Returns true if the shader has a varying with the given name.
const func is_node_connection(to_port: int) -> bool#
Returns true if the specified node and port connection exist.
func remove_node(id: int) -> void#
Removes the specified node from the shader.
func remove_varying(name: String) -> void#
Removes a varying value node with the given name. Prints an error if a node with this name is not found.
func replace_node(new_class: StringName) -> void#
Replaces the specified node with a node of new class type.
func set_mode(mode: int enumShader.Mode) -> void#
Sets the mode of this shader.
func set_node_position(position: Vector2) -> void#
Sets the position of the specified node.
Annotations #
Constants #
const TYPE_VERTEX = 0 enum Type#
A vertex shader, operating on vertices.
const TYPE_FRAGMENT = 1 enum Type#
A fragment shader, operating on fragments (pixels).
const TYPE_LIGHT = 2 enum Type#
A shader for light calculations.
const TYPE_START = 3 enum Type#
A function for the "start" stage of particle shader.
const TYPE_PROCESS = 4 enum Type#
A function for the "process" stage of particle shader.
const TYPE_COLLIDE = 5 enum Type#
A function for the "collide" stage (particle collision handler) of particle shader.
const TYPE_START_CUSTOM = 6 enum Type#
A function for the "start" stage of particle shader, with customized output.
const TYPE_PROCESS_CUSTOM = 7 enum Type#
A function for the "process" stage of particle shader, with customized output.
const TYPE_SKY = 8 enum Type#
A shader for 3D environment's sky.
const TYPE_FOG = 9 enum Type#
A compute shader that runs for each froxel of the volumetric fog map.
const TYPE_MAX = 10 enum Type#
Represents the size of the Type enum.
const VARYING_MODE_VERTEX_TO_FRAG_LIGHT = 0 enum VaryingMode#
Varying is passed from Vertex function to Fragment and Light functions.
const VARYING_MODE_FRAG_TO_LIGHT = 1 enum VaryingMode#
Varying is passed from Fragment function to Light function.
const VARYING_MODE_MAX = 2 enum VaryingMode#
Represents the size of the VaryingMode enum.
const VARYING_TYPE_FLOAT = 0 enum VaryingType#
Varying is of type float.
const VARYING_TYPE_INT = 1 enum VaryingType#
Varying is of type int.
const VARYING_TYPE_UINT = 2 enum VaryingType#
Varying is of type unsigned int.
const VARYING_TYPE_VECTOR_2D = 3 enum VaryingType#
Varying is of type Vector2.
const VARYING_TYPE_VECTOR_3D = 4 enum VaryingType#
Varying is of type Vector3.
const VARYING_TYPE_VECTOR_4D = 5 enum VaryingType#
Varying is of type Vector4.
const VARYING_TYPE_BOOLEAN = 6 enum VaryingType#
Varying is of type bool.
const VARYING_TYPE_TRANSFORM = 7 enum VaryingType#
Varying is of type Transform3D.
const VARYING_TYPE_MAX = 8 enum VaryingType#
Represents the size of the VaryingType enum.
const NODE_ID_INVALID = -1#
Indicates an invalid VisualShader node.
const NODE_ID_OUTPUT = 0#
Indicates an output node of VisualShader.
Constructors #
Enums #
Type#
enum Type {
TYPE_VERTEX = 0,
TYPE_FRAGMENT = 1,
TYPE_LIGHT = 2,
TYPE_START = 3,
TYPE_PROCESS = 4,
TYPE_COLLIDE = 5,
TYPE_START_CUSTOM = 6,
TYPE_PROCESS_CUSTOM = 7,
TYPE_SKY = 8,
TYPE_FOG = 9,
TYPE_MAX = 10,
}VaryingMode#
enum VaryingMode {
VARYING_MODE_VERTEX_TO_FRAG_LIGHT = 0,
VARYING_MODE_FRAG_TO_LIGHT = 1,
VARYING_MODE_MAX = 2,
}VaryingType#
enum VaryingType {
VARYING_TYPE_FLOAT = 0,
VARYING_TYPE_INT = 1,
VARYING_TYPE_UINT = 2,
VARYING_TYPE_VECTOR_2D = 3,
VARYING_TYPE_VECTOR_3D = 4,
VARYING_TYPE_VECTOR_4D = 5,
VARYING_TYPE_BOOLEAN = 6,
VARYING_TYPE_TRANSFORM = 7,
VARYING_TYPE_MAX = 8,
} Notifications#
enum {
NODE_ID_INVALID = -1,
NODE_ID_OUTPUT = 0,
}