Source Shader Editor - Vocabulary

From Valve Developer Community
Jump to navigation Jump to search

Bridge

Links two nodes together. You can draw multiple bridges from an output jack, while an input jack can only have a single bridge.

Canvas

The workspace that contains all flow graphs for every hierachy.

Datatypes

The following datatypes are supported:

  • float
  • float2
  • float3
  • float4
  • float3x3
  • float4x3
  • float4x4

Many nodes will take a variable datatype as input, in these cases it's often possible to use two different datatypes, at least if one of them is a float. For example adding a float and float3 together will add the value of the float to each component of the float3:

float( 1 ) + float3( 0, 0, 2 ) == float3( 1, 1, 3 )

Hierachy

There are three different hierachies on the canvas: vertex shader, pixel shader and undefined. You may not connect nodes between the vertex and pixel shader hierachy and some nodes will be entirely exclusive to either. Having multiple hierachies in a container node will cause the node to show an error.

Jack

They represent the inputs and outputs of every node. Some jacks will have locked datatypes while other ones can take variable input. You can toggle datatype rendering in the Editor config panel which can be found in the File submenu.

Node

A node usually represents a certain arithmetical operation. They often have multiple input and output jacks, all input jacks must be defined properly before the node will work. Some nodes will internally call source specific functions. Container nodes are capable of surrounding other nodes, those nodes will become their children.

Token channels

This system allows you to enter a string with basic arithmetical operations, channel and constant literals to define values for up to 4 components of the target node and offers an HSV color picker. You can identify text entries which support this kind of input by their pale yellow background.

Recognized symbols (case insensitive):

Operators: - + / *
Channel literals: x, y, z, w or r, g, b, a
Brackets supported: ( )
Math constants: pi, e
Normalize prefix: n
Overlapping function suffix: $
Note.pngNote:Channel literals are not enabled by every node.

If you want to solely use channel literals, no spaces are required to distinguish each channel. Using any kind of constant will require you to seperate channels with at least a space, you can still type in more spaces in between any operations, but make sure to not seperate a minus sign from a value or literal that is supposed to negate it.

The normalize operator can be used at the beginning of the string, it will normalize all channels at the very end of all operations. Channel literals will be ignored.

If you want to manipulate all channels with an equal operation, append your operations after a $ character at the end of the string. This will internally surround every channel with extra brackets and append the global operation at the end.


Examples

Input string Output Components
rgba rgba 4
0 g b 1 0 g b 1 4
360 / pi -1 x $*2 229.183105 -2 x 3
n1 -1 0.707107 -0.707107 2