GLSL Shaders

From Unvanquished
Jump to: navigation, search
Elderly Man chasing a granger.svg

Page out of date
Some of this content is out of date.

Contents

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:
  • VertexSkinning_P_N
  • VertexSkinning_P_TBN
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 the u_BoneMatrix matrices.
  • const vec3 inNormal— The normal vector (for lighting calculations) corresponding to the inPosition vertex that will be transformed by the u_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

vertexSimple_vp.glsl

vertexSkinning_vp.glsl

vertexSprite_vp.glsl

volumetricFog_fp.glsl

volumetricFog_vp.glsl