NEWS COMMUNITY STORE TUTORIALS GODOT SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE TUTORIALS GODOT TOGGLE FULLSCREEN VOLLBILD AN/AUS image/svg+xml image/svg+xml image/svg+xml SPATIAL SHADER REFERENCE
Reference sheet for the spatial shader in Godot
image/svg+xml image/svg+xml Reference sheet for the spatial shader in Godot image/svg+xml






GODOT SPATIAL SHADER REFERENCE In this reference sheet all constants with their data types and descriptions are listed. Combine multiple filter and sort different constants of the vertex, fragment and light shader stages. Domain filters allow to separate unneeded parts and investigate other parts without clutter.

Check also the stages overview for the transform spaces or find some useful code in the shader library


SORTATION
Combine Stages Only All Stages Sort Alphabetically

STAGE FILTERS
Vertex Stage Fragment Stage Light Stage

DOMAIN FILTERS
Core Illumination Node ORM Alpha Multiview Instancing Bones Custom



Constant Type Stage Description
VIEWPORT_SIZEin vec2V Size of viewport (in pixels).
VIEW_MATRIXin mat4V World space to view space transform.
INV_VIEW_MATRIXin mat4V View space to world space transform.
MAIN_CAM_INV_VIEW_MATRIXin mat4V View space to world space transform of camera used to draw the current viewport.
INV_PROJECTION_MATRIXin mat4V Clip space to view space transform.
NODE_POSITION_WORLDin vec3V Node world space position.
NODE_POSITION_VIEWin vec3V Node view space position.
CAMERA_POSITION_WORLDin vec3V Camera world space position.
CAMERA_DIRECTION_WORLDin vec3V Camera world space direction.
CAMERA_VISIBLE_LAYERSin uintV Cull layers of the camera rendering the current pass.
OUTPUT_IS_SRGBin boolV true when output is in sRGB color space (this is true in the Compatibility renderer,
false in Forward+ and Forward Mobile).
INSTANCE_IDin intV Instance ID for instancing.
INSTANCE_CUSTOMin vec4V Instance custom data (for particles, mostly).
VIEW_INDEXin intV The view that we are rendering. VIEW_MONO_LEFT (0) for Mono (not multiview) or left eye,
VIEW_RIGHT (1) for right eye.
VIEW_MONO_LEFTin intV Constant for Mono or left eye, always 0.
VIEW_RIGHTin intV Constant for right eye, always 1.
EYE_OFFSETin vec3V Position offset for the eye being rendered. Only applicable for multiview rendering.
VERTEXinout vec3V Vertex in local coordinates.
VERTEX_IDin intV The index of the current vertex in the vertex buffer.
NORMALinout vec3V Normal in local coordinates.
TANGENTinout vec3V Tangent in local coordinates.
BINORMALinout vec3V Binormal in local coordinates.
POSITIONout vec4V If written to, overrides final vertex position.
UVinout vec2V UV main channel.
UV2inout vec2V UV secondary channel.
COLORinout vec4V Color from vertices.
ROUGHNESSout floatV Roughness for vertex lighting.
POINT_SIZEinout floatV Point size for point rendering.
MODELVIEW_MATRIXinout mat4V Model space to view space transform (use if possible).
MODELVIEW_NORMAL_MATRIXinout mat3V
MODEL_MATRIXin mat4V Model space to world space transform.
MODEL_NORMAL_MATRIXin mat3V
PROJECTION_MATRIXinout mat4V View space to clip space transform.
BONE_INDICESin uvec4V
BONE_WEIGHTSin vec4V
CUSTOM0in vec4V Custom value from vertex primitive. When using extra UVs, xy is UV3 and zw is UV4.
CUSTOM1in vec4V Custom value from vertex primitive. When using extra UVs, xy is UV5 and zw is UV6.
CUSTOM2in vec4V Custom value from vertex primitive. When using extra UVs, xy is UV7 and zw is UV8.
CUSTOM3in vec4V Custom value from vertex primitive.
VIEWPORT_SIZEin vec2F Size of viewport (in pixels).
FRAGCOORDin vec4F Coordinate of pixel center in screen space. xy specifies position in window. Origin is lower
left. z specifies fragment depth. It is also used as the output value for the fragment depth
unless DEPTH is written to.
FRONT_FACINGin boolF true if current face is front facing.
VIEWin vec3F Normalized vector from fragment position to camera (in view space). This is the same for both
perspective and orthogonal cameras.
UVin vec2F UV that comes from vertex function.
UV2in vec2F UV2 that comes from vertex function.
COLORin vec4F COLOR that comes from vertex function.
POINT_COORDin vec2F Point Coordinate for drawing points with POINT_SIZE.
OUTPUT_IS_SRGBin boolF true when output is in sRGB color space (this is true in the Compatibility renderer,
false in Forward+ and Forward Mobile).
MODEL_MATRIXin mat4F Model space to world space transform.
MODEL_NORMAL_MATRIXin mat3F
VIEW_MATRIXin mat4F World space to view space transform.
INV_VIEW_MATRIXin mat4F View space to world space transform.
PROJECTION_MATRIXin mat4F View space to clip space transform.
INV_PROJECTION_MATRIXin mat4F Clip space to view space transform.
NODE_POSITION_WORLDin vec3F Node position, in world space.
NODE_POSITION_VIEWin vec3F Node position, in view space.
CAMERA_POSITION_WORLDin vec3F Camera position, in world space.
CAMERA_DIRECTION_WORLDin vec3F Camera direction, in world space.
CAMERA_VISIBLE_LAYERSin uintF Cull layers of the camera rendering the current pass.
VERTEXin vec3F Vertex that comes from vertex function (default, in view space).
LIGHT_VERTEXinout vec3F A writable version of VERTEX that can be used to alter light and shadows. Writing to this
will not change the position of the fragment.
VIEW_INDEXin intF The view that we are rendering. VIEW_MONO_LEFT (0) for Mono (not multiview) or left eye, VIEW_RIGHT (1) for right eye.
VIEW_MONO_LEFTin intF Constant for Mono or left eye, always 0.
VIEW_RIGHTin intF Constant for right eye, always 1.
EYE_OFFSETin vec3F Position offset for the eye being rendered. Only applicable for multiview rendering.
SCREEN_UVin vec2F Screen UV coordinate for current pixel.
DEPTHout floatF Custom depth value (0..1). If DEPTH is being written to in any shader branch, then you are
responsible for setting the DEPTH for all other branches. Otherwise, the graphics API
will leave them uninitialized.
NORMALinout vec3F Normal that comes from vertex function (default, in view space).
TANGENTinout vec3F Tangent that comes from vertex function.
BINORMALinout vec3F Binormal that comes from vertex function.
NORMAL_MAPout vec3F Set normal here if reading normal from a texture instead of NORMAL.
NORMAL_MAP_DEPTHout floatF Depth from variable above. Defaults to 1.0.
ALBEDOout vec3F Albedo (default white).
ALPHAout floatF Alpha (0..1); if read from or written to, the material will go to the transparent pipeline.
ALPHA_SCISSOR_THRESHOLDout floatF If written to, values below a certain amount of alpha are discarded.
ALPHA_HASH_SCALEout floatF
ALPHA_ANTIALIASING_EDGEout floatF
ALPHA_TEXTURE_COORDINATEout vec2F
METALLICout floatF Metallic (0..1).
SPECULARout floatF Specular. Defaults to 0.5, best not to modify unless you want to change IOR.
ROUGHNESSout floatF Roughness (0..1).
RIMout floatF Rim (0..1). If used, Godot calculates rim lighting.
RIM_TINTout floatF Rim Tint, goes from 0 (white) to 1 (albedo). If used, Godot calculates rim lighting.
CLEARCOATout floatF Small added specular blob. If used, Godot calculates Clearcoat.
CLEARCOAT_GLOSSout floatF Gloss of Clearcoat. If used, Godot calculates Clearcoat.
ANISOTROPYout floatF For distorting the specular blob according to tangent space.
ANISOTROPY_FLOWout vec2F Distortion direction, use with flowmaps.
SSS_STRENGTHout floatF Strength of Subsurface Scattering. If used, Subsurface Scattering will be applied to object.
SSS_TRANSMITTANCE_COLORout vec4F
SSS_TRANSMITTANCE_DEPTHout floatF
SSS_TRANSMITTANCE_BOOSTout floatF
BACKLIGHTinout vec3F
AOout floatF Strength of Ambient Occlusion. For use with pre-baked AO.
AO_LIGHT_AFFECTout floatF How much AO affects lights (0..1; default 0).
EMISSIONout vec3F Emission color (can go over 1,1,1 for HDR).
FOGout vec4F If written to, blends final pixel color with FOG.rgb based on FOG.a.
RADIANCEout vec4F If written to, blends environment map radiance with RADIANCE.rgb based on RADIANCE.a.
IRRADIANCEout vec4F If written to, blends environment map IRRADIANCE with IRRADIANCE.rgb based on IRRADIANCE.a.
VIEWPORT_SIZEin vec2L Size of viewport (in pixels).
FRAGCOORDin vec4L Coordinate of pixel center in screen space.
xy specifies position in window,
specifies fragment depth if DEPTH is not used.
Origin is lower-left.
MODEL_MATRIXin mat4L Model space to world space transform.
INV_VIEW_MATRIXin mat4L View space to world space transform.
VIEW_MATRIXin mat4L World space to view space transform.
PROJECTION_MATRIXin mat4L View space to clip space transform.
INV_PROJECTION_MATRIXin mat4L Clip space to view space transform.
NORMALin vec3L Normal vector, in view space.
UVin vec2L UV that comes from vertex function.
UV2in vec2L UV2 that comes from vertex function.
VIEWin vec3L View vector, in view space.
LIGHTin vec3L Light Vector, in view space.
LIGHT_COLORin vec3L Color of light multiplied by energy * PI.
The PI multiplication is present because
physically-based lighting models include a
division by PI.
SPECULAR_AMOUNTin floatL 2.0 * light_specular property for
OmniLight3D and SpotLight3D.
1.0 for DirectionalLight3D.
LIGHT_IS_DIRECTIONALin boolL true if this pass is a DirectionalLight3D.
ATTENUATIONin floatL Attenuation based on distance or shadow.
ALBEDOin vec3L Base albedo.
BACKLIGHTin vec3L
METALLICin floatL Metallic.
ROUGHNESSin floatL Roughness.
OUTPUT_IS_SRGBin boolL true when output is in sRGB color space
(this is true in the Compatibility renderer,
false in Forward+ and Forward Mobile).
DIFFUSE_LIGHTout vec3L Diffuse light result.
SPECULAR_LIGHTout vec3L Specular light result.
ALPHAout floatL Alpha (0..1); if written to, the material will go
to the transparent pipeline.





TO GODOT OVERVIEW







All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...