GLSL Shaders
Page out of date |
Contents
- 1 Uniform Variables
- 2 Shaders
- 2.1 blurX_fp.glsl
- 2.2 blurX_vp.glsl
- 2.3 blurY_fp.glsl
- 2.4 blurY_vp.glsl
- 2.5 cameraEffects_fp.glsl
- 2.6 cameraEffects_vp.glsl
- 2.7 computeLight_fp.glsl
- 2.8 contrast_fp.glsl
- 2.9 contrast_vp.glsl
- 2.10 debugShadowMap_fp.glsl
- 2.11 debugShadowMap_vp.glsl
- 2.12 deformVertexes_vp.glsl
- 2.13 depthtile1_fp.glsl
- 2.14 depthtile1_vp.glsl
- 2.15 depthtile2_fp.glsl
- 2.16 depthtile2_vp.glsl
- 2.17 dispersion_C_fp.glsl
- 2.18 dispersion_C_vp.glsl
- 2.19 fogGlobal_fp.glsl
- 2.20 fogGlobal_vp.glsl
- 2.21 fogQuake3_fp.glsl
- 2.22 fogQuake3_vp.glsl
- 2.23 forwardLighting_fp.glsl
- 2.24 forwardLighting_vp.glsl
- 2.25 fxaa3_11_fp.glsl
- 2.26 fxaa_fp.glsl
- 2.27 fxaa_vp.glsl
- 2.28 generic_fp.glsl
- 2.29 generic_vp.glsl
- 2.30 heatHaze_fp.glsl
- 2.31 heatHaze_vp.glsl
- 2.32 lightMapping_fp.glsl
- 2.33 lightMapping_vp.glsl
- 2.34 lighttile_fp.glsl
- 2.35 lighttile_vp.glsl
- 2.36 liquid_fp.glsl
- 2.37 liquid_vp.glsl
- 2.38 motionblur_fp.glsl
- 2.39 motionblur_vp.glsl
- 2.40 portal_fp.glsl
- 2.41 portal_vp.glsl
- 2.42 reflection_CB_fp.glsl
- 2.43 reflection_CB_vp.glsl
- 2.44 refraction_C_fp.glsl
- 2.45 refraction_C_vp.glsl
- 2.46 reliefMapping_fp.glsl
- 2.47 screen_fp.glsl
- 2.48 screen_vp.glsl
- 2.49 shadowFill_fp.glsl
- 2.50 shadowFill_vp.glsl
- 2.51 skybox_fp.glsl
- 2.52 skybox_vp.glsl
- 2.53 ssao_fp.glsl
- 2.54 ssao_vp.glsl
- 2.55 vertexAnimation_vp.glsl
- 2.56 vertexSimple_vp.glsl
- 2.57 vertexSkinning_vp.glsl
- 2.58 vertexSprite_vp.glsl
- 2.59 volumetricFog_fp.glsl
- 2.60 volumetricFog_vp.glsl
Uniform Variables
As described in the technical documentation, all possible parameters (what OpenGL calls "uniform variables") that may be passed to a shader are enumerated in the shaderProgram_t
structure in src/engine/rendererGL/tr_local.h:1359
.
Type | Name | Used by | Set with |
---|---|---|---|
int32_t
|
u_ColorMap
|
||
int32_t
|
u_CurrentMap
|
||
int32_t
|
u_ContrastMap
|
||
int32_t
|
u_DiffuseMap
|
||
int32_t
|
u_NormalMap
|
||
int32_t
|
u_SpecularMap
|
||
int32_t
|
u_LightMap
|
||
int32_t
|
u_DeluxeMap
|
||
int32_t
|
u_DepthMap
|
||
int32_t
|
u_DepthMapBack
|
||
int32_t
|
u_DepthMapFront
|
||
int32_t
|
u_PortalMap
|
||
int32_t
|
u_AttenuationMapXY
|
||
int32_t
|
u_AttenuationMapZ
|
||
int32_t
|
u_ShadowMap
|
||
int32_t
|
u_ShadowMap0
|
||
int32_t
|
u_ShadowMap1
|
||
int32_t
|
u_ShadowMap2
|
||
int32_t
|
u_ShadowMap3
|
||
int32_t
|
u_ShadowMap4
|
||
int32_t
|
u_EnvironmentMap0
|
||
int32_t
|
u_EnvironmentMap1
|
||
int32_t
|
u_RandomMap
|
||
int32_t
|
u_GrainMap
|
||
int32_t
|
u_VignetteMap
|
||
int32_t
|
u_ColorTextureMatrix
|
||
matrix_t
|
t_ColorTextureMatrix
|
||
int32_t
|
u_DiffuseTextureMatrix
|
||
matrix_t
|
t_DiffuseTextureMatrix
|
||
int32_t
|
u_NormalTextureMatrix
|
||
matrix_t
|
t_NormalTextureMatrix
|
||
int32_t
|
u_SpecularTextureMatrix
|
||
matrix_t
|
t_SpecularTextureMatrix
|
||
int32_t
|
u_AlphaTest
|
||
alphaTest_t
|
t_AlphaTest
|
||
int32_t
|
u_ViewOrigin
|
||
vec3_t
|
t_ViewOrigin
|
||
GLint
|
u_DeformParms
|
||
int32_t
|
u_Color
|
||
vec4_t
|
t_Color
|
||
int32_t
|
u_ColorModulate
|
||
vec4_t
|
t_ColorModulate
|
||
int32_t
|
u_AmbientColor
|
||
vec3_t
|
t_AmbientColor
|
||
int32_t
|
u_LightDir
|
||
vec3_t
|
t_LightDir
|
||
int32_t
|
u_LightOrigin
|
||
vec3_t
|
t_LightOrigin
|
||
int32_t
|
u_LightColor
|
||
vec3_t
|
t_LightColor
|
||
int32_t
|
u_LightRadius
|
||
float
|
t_LightRadius
|
||
int32_t
|
u_LightParallel
|
||
qboolean
|
t_LightParallel
|
||
int32_t
|
u_LightScale
|
||
float
|
t_LightScale
|
||
int32_t
|
u_LightWrapAround
|
||
float
|
t_LightWrapAround
|
||
int32_t
|
u_LightAttenuationMatrix
|
||
matrix_t
|
t_LightAttenuationMatrix
|
||
int32_t
|
u_LightFrustum
|
||
int32_t
|
u_ShadowMatrix
|
||
matrix_t
|
t_ShadowMatrix
|
||
int32_t
|
u_ShadowCompare
|
||
qboolean
|
t_ShadowCompare
|
||
int32_t
|
u_ShadowTexelSize
|
||
float
|
t_ShadowTexelSize
|
||
int32_t
|
u_ShadowBlur
|
||
float
|
t_ShadowBlur
|
||
GLint
|
u_ShadowParallelSplitDistances
|
||
vec4_t
|
t_ShadowParallelSplitDistances
|
||
int32_t
|
u_RefractionIndex
|
||
float
|
t_RefractionIndex
|
||
int32_t
|
u_FresnelPower
|
||
int32_t
|
u_FresnelScale
|
||
int32_t
|
u_FresnelBias
|
||
GLint
|
u_NormalScale
|
||
int32_t
|
u_EtaRatio
|
||
int32_t
|
u_FogDensity
|
||
int32_t
|
u_FogColor
|
||
GLint
|
u_FogDistanceVector
|
||
vec4_t
|
t_FogDistanceVector
|
||
GLint
|
u_FogDepthVector
|
||
vec4_t
|
t_FogDepthVector
|
||
GLint
|
u_FogEyeT
|
||
float
|
t_FogEyeT
|
||
int32_t
|
u_SSAOJitter
|
||
int32_t
|
u_SSAORadius
|
||
GLint
|
u_ParallaxMapping
|
||
qboolean
|
t_ParallaxMapping
|
||
int32_t
|
u_DepthScale
|
||
float
|
t_DepthScale
|
||
GLint
|
u_PortalClipping
|
||
qboolean
|
t_PortalClipping
|
||
GLint
|
u_PortalPlane
|
||
vec4_t
|
t_PortalPlane
|
||
int32_t
|
u_PortalRange
|
||
float
|
t_PortalRange
|
||
GLint
|
u_EnvironmentInterpolation
|
||
float
|
t_EnvironmentInterpolation
|
||
GLint
|
u_HDRKey
|
||
float
|
t_HDRKey
|
||
GLint
|
u_HDRAverageLuminance
|
||
float
|
t_HDRAverageLuminance
|
||
GLint
|
u_HDRMaxLuminance
|
||
float
|
t_HDRMaxLuminance
|
||
int32_t
|
u_DeformMagnitude
|
||
float
|
t_DeformMagnitude
|
||
int32_t
|
u_ModelMatrix
|
||
matrix_t
|
t_ModelMatrix
|
||
int32_t
|
u_ViewMatrix
|
||
matrix_t
|
t_ViewMatrix
|
||
int32_t
|
u_ModelViewMatrix
|
||
matrix_t
|
t_ModelViewMatrix
|
||
int32_t
|
u_ModelViewMatrixTranspose
|
||
matrix_t
|
t_ModelViewMatrixTranspose
|
||
int32_t
|
u_ProjectionMatrix
|
||
matrix_t
|
t_ProjectionMatrix
|
||
int32_t
|
u_ProjectionMatrixTranspose
|
||
matrix_t
|
t_ProjectionMatrixTranspose
|
||
int32_t
|
u_ModelViewProjectionMatrix
|
||
matrix_t
|
t_ModelViewProjectionMatrix
|
||
int32_t
|
u_UnprojectMatrix
|
||
matrix_t
|
t_UnprojectMatrix
|
||
int32_t
|
u_VertexSkinning
|
||
qboolean
|
t_VertexSkinning
|
||
GLint
|
u_VertexInterpolation
|
||
float
|
t_VertexInterpolation
|
||
int32_t
|
u_BoneMatrix
|
vertexSkinning_vp.glsl:
|
u_BoneMatrix::SetUniform_BoneMatrix()
|
int32_t
|
u_Time
|
||
float
|
t_Time
|
Shaders
blurX_fp.glsl
blurX_vp.glsl
blurY_fp.glsl
blurY_vp.glsl
cameraEffects_fp.glsl
cameraEffects_vp.glsl
computeLight_fp.glsl
Provide reusable functions for computing light effects (like specularity).
contrast_fp.glsl
contrast_vp.glsl
debugShadowMap_fp.glsl
debugShadowMap_vp.glsl
deformVertexes_vp.glsl
depthtile1_fp.glsl
Part of the tiled renderer.
depthtile1_vp.glsl
Part of the tiled renderer.
depthtile2_fp.glsl
Part of the tiled renderer.
depthtile2_vp.glsl
Part of the tiled renderer.
dispersion_C_fp.glsl
dispersion_C_vp.glsl
fogGlobal_fp.glsl
fogGlobal_vp.glsl
fogQuake3_fp.glsl
fogQuake3_vp.glsl
forwardLighting_fp.glsl
forwardLighting_vp.glsl
fxaa3_11_fp.glsl
Provides FxaaPixelShader
function we use in fxaa_fp.glsl
fxaa_fp.glsl
FXAA code.
fxaa_vp.glsl
FXAA code.
generic_fp.glsl
generic_vp.glsl
heatHaze_fp.glsl
heatHaze_vp.glsl
lightMapping_fp.glsl
lightMapping_vp.glsl
lighttile_fp.glsl
Part of the tiled renderer.
lighttile_vp.glsl
Part of the tiled renderer.
liquid_fp.glsl
liquid_vp.glsl
motionblur_fp.glsl
motionblur_vp.glsl
portal_fp.glsl
portal_vp.glsl
reflection_CB_fp.glsl
reflection_CB_vp.glsl
refraction_C_fp.glsl
refraction_C_vp.glsl
reliefMapping_fp.glsl
Provide reusable functions to process normal and height maps.
screen_fp.glsl
screen_vp.glsl
shadowFill_fp.glsl
shadowFill_vp.glsl
skybox_fp.glsl
skybox_vp.glsl
ssao_fp.glsl
ssao_vp.glsl
vertexAnimation_vp.glsl
Contains vertex shaders to perform skinning for skeletal meshes (MD5 models).
Uniform Variables
-
int
u_VertexSkinning -
mat4
u_BoneMatrix[MAX_GLSL_BONES]
Attributes
-
vec4
attr_BoneIndexes — -
vec4
attr_BoneWeights —
VertexSkinning_P_N
Translates a vertex and corresponding vertex normal as per the bone matrices (as many as the MAX_GLSL_BONES
preprocessor constant allows) contained in the uniform variable u_BoneMatrix
, which is set with the u_BoneMatrix::SetUniform_BoneMatrix()
method.
Returns void
.
Arguments
-
const vec4
inPosition — The position of the skinned mesh vertex in 3d space that will be transformed by theu_BoneMatrix
matrices. -
const vec3
inNormal— The normal vector (for lighting calculations) corresponding to theinPosition
vertex that will be transformed by theu_BoneMatrix
matrices. -
inout vec4
position — The transformed vertex. -
inout vec3
normal — The transformed normal.
VertexSkinning_P_TBN
Returns void
.
Arguments
-
const vec4
inPosition -
const vec3
inTangent -
const vec3
inBinormal -
const vec3
inNormal -
inout vec4
position -
inout vec3
tangent -
inout vec3
binormal -
inout vec3
normal