S&box Wiki

Shader Reference

Shader Reference

Variables

Variables will show up in Material Editor. They're defined like this.

float3 g_vColorTint < UiType( Color ); Default3( 1.0, 1.0, 1.0 ); UiGroup( "Color,10/20" ); >;

UiType

Describes how the variable should be represented in the editor.

Name Description
VectorText Text boxes and sliders (this is the default)
Slider A slider type. Usually combined with a Range setting.
Color A Color picker, works on float3 or float4.
Texture A texture picker
CheckBox On or off, generally used on bool

Default

The Default lets you specify the default value for the variable. If you're filling a float2, it should be Default2, if you're filling a float4 it should be Default4 etc.

UiGroup

The UiGroup is used to sort the variable into a group, subgroup and define its order. So for example, given this..

float4 BorderColorL < UiType( Color ); Default4( 0.0, 0.0, 0.0, 1.0 ); UiGroup( "Border,10/Colors,10/1" ); >; float4 BorderColorT < UiType( Color ); Default4( 0.0, 0.0, 0.0, 1.0 ); UiGroup( "Border,10/Colors,10/2" ); >; float4 BorderColorR < UiType( Color ); Default4( 0.0, 0.0, 0.0, 1.0 ); UiGroup( "Border,10/Colors,10/3" ); >; float4 BorderColorB < UiType( Color ); Default4( 0.0, 0.0, 0.0, 1.0 ); UiGroup( "Border,10/Colors,10/4" ); >;

You end up with this

image.png

The format is:

Heading,Order / Group,Order / VariableOrder

Special Pages


Wikis

?

Render Time: 57ms

DB GetPage 46
Generate Html 2
SaveChanges (1) 6
Render Body 0
Render Sidebar 1