reckfellENGINE

VisualShader

A custom shader program with a visual editor.

On this page
class VisualShaderReckfellSharpInherits Shader

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.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

VisualShaderConstructor
# VisualShader
C#
public VisualShader();

Properties1

GraphOffsetProperty · Deprecated
# GraphOffset
C#
public Vector2 GraphOffset { get; set; }

Deprecated.

Methods22

AddNodevoid
# AddNode
C#
public void AddNode(VisualShader.Type type, VisualShaderNode node, Vector2 position, int id);

Add a block resource to the selected graph stage. Use a free ID from GetValidNodeId(); ID 0 belongs to Output. Do not Dispose() a C# block while the graph uses it. In 1.0.0 this updates ports but does not write defaults from _GetInputPortDefaultValue(): assign them explicitly.

Parameters
NameTypeDefault
typeVisualShader.Type—
nodeVisualShaderNode—
positionVector2—
idint—
type

The graph stage, such as VisualShader.Type.Fragment. Node IDs and connections belong to this stage.

node

A VisualShaderNode resource, not a game Entity.

position

The block position in the graph editor, not image or world coordinates.

id

An unused ID in the selected stage.

AddVaryingvoid
# AddVarying
C#
public void AddVarying(string name, VisualShader.VaryingMode mode, VisualShader.VaryingType type);

Adds a new varying value node to the shader.

Parameters
NameTypeDefault
namestring—
modeVisualShader.VaryingMode—
typeVisualShader.VaryingType—
AttachNodeToFramevoid
# AttachNodeToFrame
C#
public void AttachNodeToFrame(VisualShader.Type type, int id, int frame);

Attaches the given node to the given frame.

Parameters
NameTypeDefault
typeVisualShader.Type—
idint—
frameint—
CanConnectNodesbool
# CanConnectNodes
C#
public bool CanConnectNodes(VisualShader.Type type, int fromNode, int fromPort, int toNode, int toPort);

Check block and port existence, type compatibility, duplicate connections, self-connections and cycles. Use before ConnectNodes(); this check neither changes the graph nor compiles the shader.

Parameters
NameTypeDefault
typeVisualShader.Type—
fromNodeint—
fromPortint—
toNodeint—
toPortint—
type

The graph stage, such as VisualShader.Type.Fragment. Node IDs and connections belong to this stage.

fromNode

The source block ID.

fromPort

The zero-based source output port index.

toNode

The destination block ID; 0 identifies Output.

toPort

The zero-based destination input port index.

Returns bool

true when connection preflight allows the link.

ConnectNodesError
# ConnectNodes
C#
public Error ConnectNodes(VisualShader.Type type, int fromNode, int fromPort, int toNode, int toPort);

Connect one block output to another block input in the same stage. Use CanConnectNodes() first, especially to prevent cycles: ConnectNodes() does not repeat every preflight check. Disconnect the old link before replacing an occupied input.

Parameters
NameTypeDefault
typeVisualShader.Type—
fromNodeint—
fromPortint—
toNodeint—
toPortint—
type

The graph stage, such as VisualShader.Type.Fragment. Node IDs and connections belong to this stage.

fromNode

The source block ID.

fromPort

The zero-based source output port index.

toNode

The destination block ID; 0 identifies Output.

toPort

The zero-based destination input port index.

Returns Error

Error.Ok when the link is created; otherwise an error code. This is not a GPU compilation result.

ConnectNodesForcedvoid
# ConnectNodesForced
C#
public void ConnectNodesForced(VisualShader.Type type, int fromNode, int fromPort, int toNode, int toPort);

Connects the specified nodes and ports, even if they can't be connected. Such connection is invalid and will not function properly.

Parameters
NameTypeDefault
typeVisualShader.Type—
fromNodeint—
fromPortint—
toNodeint—
toPortint—
DetachNodeFromFramevoid
# DetachNodeFromFrame
C#
public void DetachNodeFromFrame(VisualShader.Type type, int id);

Detaches the given node from the frame it is attached to.

Parameters
NameTypeDefault
typeVisualShader.Type—
idint—
DisconnectNodesvoid
# DisconnectNodes
C#
public void DisconnectNodes(VisualShader.Type type, int fromNode, int fromPort, int toNode, int toPort);

Remove the specified link if present. This does not remove blocks. Once disconnected, an input uses its default again when one is assigned.

Parameters
NameTypeDefault
typeVisualShader.Type—
fromNodeint—
fromPortint—
toNodeint—
toPortint—
type

The graph stage, such as VisualShader.Type.Fragment. Node IDs and connections belong to this stage.

fromNode

The source block ID.

fromPort

The zero-based source output port index.

toNode

The destination block ID; 0 identifies Output.

toPort

The zero-based destination input port index.

GetGraphOffsetVector2
# GetGraphOffset
C#
public Vector2 GetGraphOffset();
Returns Vector2
GetNodeVisualShaderNode
# GetNode
C#
public VisualShaderNode GetNode(VisualShader.Type type, int id);

Return the block resource by ID in the specified stage. A graph block is not an Entity; use VisualShaderNode methods and its retained C# type.

Parameters
NameTypeDefault
typeVisualShader.Type—
idint—
type

The graph stage, such as VisualShader.Type.Fragment. Node IDs and connections belong to this stage.

id

The block ID in this stage.

Returns VisualShaderNode

The block resource, or null when the ID is absent.

GetNodeConnectionsReckfell.Collections.Array<Reckfell.Collections.Dictionary>
# GetNodeConnections
C#
public Reckfell.Collections.Array<Reckfell.Collections.Dictionary> GetNodeConnections(VisualShader.Type type);

Returns the list of connected nodes with the specified type.

Parameters
NameTypeDefault
typeVisualShader.Type—
Returns Reckfell.Collections.Array<Reckfell.Collections.Dictionary>
GetNodeListint[]
# GetNodeList
C#
public int[] GetNodeList(VisualShader.Type type);

Return block IDs for one stage, including Output. This is an ID snapshot, not the resources themselves; use GetNode() to retrieve a block.

Parameters
NameTypeDefault
typeVisualShader.Type—
type

The graph stage, such as VisualShader.Type.Fragment. Node IDs and connections belong to this stage.

Returns int[]

An array of stage block IDs.

GetNodePositionVector2
# GetNodePosition
C#
public Vector2 GetNodePosition(VisualShader.Type type, int id);

Returns the position of the specified node within the shader graph.

Parameters
NameTypeDefault
typeVisualShader.Type—
idint—
Returns Vector2
GetValidNodeIdint
# GetValidNodeId
C#
public int GetValidNodeId(VisualShader.Type type);

Return an available ID for a new block in the selected stage. Query immediately before AddNode(); the result does not reserve an ID and is not a stable gameplay object ID.

Parameters
NameTypeDefault
typeVisualShader.Type—
type

The graph stage, such as VisualShader.Type.Fragment. Node IDs and connections belong to this stage.

Returns int

An available block ID.

HasVaryingbool
# HasVarying
C#
public bool HasVarying(string name);

Returns true if the shader has a varying with the given name.

Parameters
NameTypeDefault
namestring—
Returns bool
IsNodeConnectionbool
# IsNodeConnection
C#
public bool IsNodeConnection(VisualShader.Type type, int fromNode, int fromPort, int toNode, int toPort);

Returns true if the specified node and port connection exists.

Parameters
NameTypeDefault
typeVisualShader.Type—
fromNodeint—
fromPortint—
toNodeint—
toPortint—
Returns bool
RemoveNodevoid
# RemoveNode
C#
public void RemoveNode(VisualShader.Type type, int id);

Remove a block and its incident connections from the selected stage. Output cannot be removed. Retained but disconnected calculation blocks are not emitted merely because they remain in the graph.

Parameters
NameTypeDefault
typeVisualShader.Type—
idint—
type

The graph stage, such as VisualShader.Type.Fragment. Node IDs and connections belong to this stage.

id

The block ID to remove; not the Output ID.

RemoveVaryingvoid
# RemoveVarying
C#
public void RemoveVarying(string name);

Removes a varying value node with the given name. Prints an error if a node with this name is not found.

Parameters
NameTypeDefault
namestring—
ReplaceNodevoid
# ReplaceNode
C#
public void ReplaceNode(VisualShader.Type type, int id, StringName newClass);

Replaces the specified node with a node of new class type.

Parameters
NameTypeDefault
typeVisualShader.Type—
idint—
newClassStringName—
SetGraphOffsetvoid
# SetGraphOffset
C#
public void SetGraphOffset(Vector2 offset);
Parameters
NameTypeDefault
offsetVector2—
SetModevoid
# SetMode
C#
public void SetMode(Shader.Mode mode);

Sets the mode of this shader.

Parameters
NameTypeDefault
modeShader.Mode—
SetNodePositionvoid
# SetNodePosition
C#
public void SetNodePosition(VisualShader.Type type, int id, Vector2 position);

Sets the position of the specified node.

Parameters
NameTypeDefault
typeVisualShader.Type—
idint—
positionVector2—

Fields and constants2

NodeIdInvalidField
# NodeIdInvalid
C#
public const long NodeIdInvalid = -1;

Indicates an invalid VisualShader node.

NodeIdOutputField
# NodeIdOutput
C#
public const long NodeIdOutput = 0;

Indicates an output node of VisualShader.

VisualShader.Type

ValueDescription
Collide = 5

A function for the "collide" stage (particle collision handler) of particle shader.

Fog = 9

A compute shader that runs for each froxel of the volumetric fog map.

Fragment = 1

A fragment shader, operating on fragments (pixels).

Light = 2

A shader for light calculations.

Max = 11

Represents the size of the VisualShader.Type enum.

Process = 4

A function for the "process" stage of particle shader.

ProcessCustom = 7

A function for the "process" stage of particle shader, with customized output.

Sky = 8

A shader for 3D environment's sky.

Start = 3

A function for the "start" stage of particle shader.

StartCustom = 6

A function for the "start" stage of particle shader, with customized output.

TextureBlit = 10

A shader used to process blit calls to a DrawableTexture.

Vertex = 0

A vertex shader, operating on vertices.

VisualShader.VaryingMode

ValueDescription
FragToLight = 1

Varying is passed from Fragment function to Light function.

Max = 2

Represents the size of the VisualShader.VaryingMode enum.

VertexToFragLight = 0

Varying is passed from Vertex function to Fragment and Light functions.

VisualShader.VaryingType

ValueDescription
Boolean = 6

Varying is of type [bool].

Float = 0

Varying is of type [float].

Int = 1

Varying is of type [int].

Max = 8

Represents the size of the VisualShader.VaryingType enum.

Transform = 7

Varying is of type Transform3D.

Uint = 2

Varying is of type unsigned [int].

Vector2D = 3

Varying is of type Vector2.

Vector3D = 4

Varying is of type Vector3.

Vector4D = 5

Varying is of type Vector4.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.