diff options
| author | Michael Sartain <[email protected]> | 2014-10-02 08:25:55 -0700 |
|---|---|---|
| committer | Michael Sartain <[email protected]> | 2014-10-02 08:25:55 -0700 |
| commit | 55ed12f8d1eb6887d348be03aee5573d44177ffb (patch) | |
| tree | 3686f7ca78c780cd9a3d367b79a9d9250c1be7c0 /mp/src/materialsystem | |
| parent | * Added support for Visual C++ 2013 Express to VPC (diff) | |
| download | source-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.tar.xz source-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.zip | |
Updated the SDK with the latest code from the TF and HL2 branches.
Diffstat (limited to 'mp/src/materialsystem')
143 files changed, 3040 insertions, 2966 deletions
diff --git a/mp/src/materialsystem/stdshaders/BaseVSShader.cpp b/mp/src/materialsystem/stdshaders/BaseVSShader.cpp index 31c2e9b2..40e3934b 100644 --- a/mp/src/materialsystem/stdshaders/BaseVSShader.cpp +++ b/mp/src/materialsystem/stdshaders/BaseVSShader.cpp @@ -852,14 +852,14 @@ void CBaseVSShader::SetHWMorphVertexShaderState( int nDimConst, int nSubrectCons s_pShaderAPI->GetStandardTextureDimensions( &nMorphWidth, &nMorphHeight, TEXTURE_MORPH_ACCUMULATOR ); int nDim = s_pShaderAPI->GetIntRenderingParameter( INT_RENDERPARM_MORPH_ACCUMULATOR_4TUPLE_COUNT ); - float pMorphAccumSize[4] = { nMorphWidth, nMorphHeight, nDim, 0.0f }; + float pMorphAccumSize[4] = { (float)nMorphWidth, (float)nMorphHeight, (float)nDim, 0.0f }; s_pShaderAPI->SetVertexShaderConstant( nDimConst, pMorphAccumSize ); int nXOffset = s_pShaderAPI->GetIntRenderingParameter( INT_RENDERPARM_MORPH_ACCUMULATOR_X_OFFSET ); int nYOffset = s_pShaderAPI->GetIntRenderingParameter( INT_RENDERPARM_MORPH_ACCUMULATOR_Y_OFFSET ); int nWidth = s_pShaderAPI->GetIntRenderingParameter( INT_RENDERPARM_MORPH_ACCUMULATOR_SUBRECT_WIDTH ); int nHeight = s_pShaderAPI->GetIntRenderingParameter( INT_RENDERPARM_MORPH_ACCUMULATOR_SUBRECT_HEIGHT ); - float pMorphAccumSubrect[4] = { nXOffset, nYOffset, nWidth, nHeight }; + float pMorphAccumSubrect[4] = { (float)nXOffset, (float)nYOffset, (float)nWidth, (float)nHeight }; s_pShaderAPI->SetVertexShaderConstant( nSubrectConst, pMorphAccumSubrect ); s_pShaderAPI->BindStandardVertexTexture( morphSampler, TEXTURE_MORPH_ACCUMULATOR ); diff --git a/mp/src/materialsystem/stdshaders/BlurFilter_ps11.psh b/mp/src/materialsystem/stdshaders/BlurFilter_ps11.psh index 6bc9bc57..ee58a650 100644 --- a/mp/src/materialsystem/stdshaders/BlurFilter_ps11.psh +++ b/mp/src/materialsystem/stdshaders/BlurFilter_ps11.psh @@ -1,18 +1,18 @@ -ps.1.1
-
-// 1221 filter constants
-def c0, 0.1667f, 0.1667f, 0.1667f, 0.3333f
-
-tex t0
-tex t1
-tex t2
-tex t3
-
-mul r0.rgb, t0, c0
-mad r0.rgb, t1, c0.a, r0
-mad r0.rgb, t2, c0.a, r0
-mad r0.rgb, t3, c0, r0
-
-mul r0.rgb, r0, c1 +
-mov r0.a, t0.a
-
+ps.1.1 + +// 1221 filter constants +def c0, 0.1667f, 0.1667f, 0.1667f, 0.3333f + +tex t0 +tex t1 +tex t2 +tex t3 + +mul r0.rgb, t0, c0 +mad r0.rgb, t1, c0.a, r0 +mad r0.rgb, t2, c0.a, r0 +mad r0.rgb, t3, c0, r0 + +mul r0.rgb, r0, c1 + +mov r0.a, t0.a + diff --git a/mp/src/materialsystem/stdshaders/Cable.psh b/mp/src/materialsystem/stdshaders/Cable.psh index a73b1130..6ba92636 100644 --- a/mp/src/materialsystem/stdshaders/Cable.psh +++ b/mp/src/materialsystem/stdshaders/Cable.psh @@ -1,27 +1,27 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; See the vertex shader for info
-;
-; This shader takes:
-; t0 = normal map
-; t1 = base texture
-; v0 = directional light color
-; t2 = directional light direction (biased into 0-1)
-; c0 = percent of dirlight to add as ambient
-;
-; Output:
-; (t0 dot t1) * v0
-;------------------------------------------------------------------------------
-
-tex t0 ; Get the 3-vector from the normal map
-tex t1 ; Interpret tcoord t1 as color data.
-texcoord t2
-
-dp3 r1, t0_bx2, t2_bx2 ; r1 = normalMap dot dirLightDir
-add r0, r1, c0 ; + 0.5
-
-mul r1, v0, r0 ; scale the dot product by the dirlight's actual color
-mul r0.rgb, r1, t1 + ; scale by the texture color
-
-mul r0.a, t1.a, v0.a
+ps.1.1 + +;------------------------------------------------------------------------------ +; See the vertex shader for info +; +; This shader takes: +; t0 = normal map +; t1 = base texture +; v0 = directional light color +; t2 = directional light direction (biased into 0-1) +; c0 = percent of dirlight to add as ambient +; +; Output: +; (t0 dot t1) * v0 +;------------------------------------------------------------------------------ + +tex t0 ; Get the 3-vector from the normal map +tex t1 ; Interpret tcoord t1 as color data. +texcoord t2 + +dp3 r1, t0_bx2, t2_bx2 ; r1 = normalMap dot dirLightDir +add r0, r1, c0 ; + 0.5 + +mul r1, v0, r0 ; scale the dot product by the dirlight's actual color +mul r0.rgb, r1, t1 + ; scale by the texture color + +mul r0.a, t1.a, v0.a diff --git a/mp/src/materialsystem/stdshaders/Eyes.psh b/mp/src/materialsystem/stdshaders/Eyes.psh index 6e5e5646..6909dcf6 100644 --- a/mp/src/materialsystem/stdshaders/Eyes.psh +++ b/mp/src/materialsystem/stdshaders/Eyes.psh @@ -1,16 +1,16 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw the eyes
-; t0 - texture
-; t1 - iris
-; t2 - glint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-
-lrp r0, t1.a, t1, t0 ; Blend in the iris with the background
-mad r0.rgb, r0, v0, t2 + ; Modulate by the illumination, add in the glint
-mov r0.a, t0.a
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw the eyes +; t0 - texture +; t1 - iris +; t2 - glint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 + +lrp r0, t1.a, t1, t0 ; Blend in the iris with the background +mad r0.rgb, r0, v0, t2 + ; Modulate by the illumination, add in the glint +mov r0.a, t0.a diff --git a/mp/src/materialsystem/stdshaders/Eyes_Overbright2.psh b/mp/src/materialsystem/stdshaders/Eyes_Overbright2.psh index 11119233..f7fae257 100644 --- a/mp/src/materialsystem/stdshaders/Eyes_Overbright2.psh +++ b/mp/src/materialsystem/stdshaders/Eyes_Overbright2.psh @@ -1,18 +1,18 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw the eyes
-; t0 - texture
-; t1 - iris
-; t2 - glint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-
-lrp r0, t1.a, t1, t0 ; Blend in the iris with the background
-mul_x2 r0, v0, r0 ; Modulate by the illumination with overbright
-
-add r0.rgb, r0, t2 + ; Add in the glint
-mov r0.a, t0.a
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw the eyes +; t0 - texture +; t1 - iris +; t2 - glint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 + +lrp r0, t1.a, t1, t0 ; Blend in the iris with the background +mul_x2 r0, v0, r0 ; Modulate by the illumination with overbright + +add r0.rgb, r0, t2 + ; Add in the glint +mov r0.a, t0.a diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric.psh index a6794e7e..6ec78dda 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric.psh @@ -1,15 +1,15 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-mul r0, t0, v0 ; base times vertex color (with alpha)
-mul r0.rgb, t1, r0 ; fold in lightmap (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +mul r0, t0, v0 ; base times vertex color (with alpha) +mul r0.rgb, t1, r0 ; fold in lightmap (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddBaseAlphaMaskedEnvMap.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddBaseAlphaMaskedEnvMap.psh index 7b042e7a..b31054c5 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddBaseAlphaMaskedEnvMap.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddBaseAlphaMaskedEnvMap.psh @@ -1,17 +1,17 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t2 ; cube map
-tex t3 ; envmap mask
-
-mul r0.rgb, t2, 1-t3.a
-mul r0.rgb, c2, r0 ; apply the envmaptint
-+ mul r0.a, c2.a, v0.a
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t2 ; cube map +tex t3 ; envmap mask + +mul r0.rgb, t2, 1-t3.a +mul r0.rgb, c2, r0 ; apply the envmaptint ++ mul r0.a, c2.a, v0.a diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddEnvMapMaskNoTexture.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddEnvMapMaskNoTexture.psh index ccc2c7b1..ad09a6d8 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddEnvMapMaskNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddEnvMapMaskNoTexture.psh @@ -1,17 +1,17 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t2 ; cube map
-tex t3 ; envmap mask
-
-mul r0.rgb, t2, t3
-mul r0.rgb, c2, r0
-+ mul r0.a, c2.a, v0.a
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t2 ; cube map +tex t3 ; envmap mask + +mul r0.rgb, t2, t3 +mul r0.rgb, c2, r0 ++ mul r0.a, c2.a, v0.a diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddEnvMapNoTexture.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddEnvMapNoTexture.psh index fd4fd7a5..16b47fef 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddEnvMapNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_AddEnvMapNoTexture.psh @@ -1,15 +1,15 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t2 ; cube map
-
-mul r0.rgb, t2, c2
-+ mul r0.a, v0.a, c2.a
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t2 ; cube map + +mul r0.rgb, t2, c2 ++ mul r0.a, v0.a, c2.a diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BaseAlphaMaskedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BaseAlphaMaskedEnvMapV2.psh index 236db8e3..c8279e74 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BaseAlphaMaskedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BaseAlphaMaskedEnvMapV2.psh @@ -1,22 +1,22 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-tex t3
-
-mul r0, t0, v0 ; base times vertex color (with alpha)
-mul r0.rgb, t1, r0 ; fold in lighting (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mul r1, t2, 1-t3.a ; envmap * envmapmask (alpha)
-mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 +tex t3 + +mul r0, t0, v0 ; base times vertex color (with alpha) +mul r0.rgb, t1, r0 ; fold in lighting (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mul r1, t2, 1-t3.a ; envmap * envmapmask (alpha) +mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only) diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BaseTexture.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BaseTexture.psh index 75aab35b..0401218d 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BaseTexture.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BaseTexture.psh @@ -1,14 +1,14 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-; Get the color from the texture
-tex t0
-mul r0, t0, c0
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +; Get the color from the texture +tex t0 +mul r0, t0, c0 + diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedEnvmap.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedEnvmap.psh index ba349187..6f061278 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedEnvmap.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedEnvmap.psh @@ -1,66 +1,66 @@ -; STATIC: "NORMALMAPALPHAENVMAPMASK" "0..1"
-ps.1.1
-
-;------------------------------------------------------------------------------
-; Environment mapping on a bumped surface
-; t0 - Normalmap
-; t3 - Cube environment map (*must* be a cube map!)
-;
-; c0 - color to multiply the results by
-; c1 - envmap contrast
-; c2 - envmap saturation
-; c3 - grey weights
-; c4 - fresnel amount
-; Input texture coords required here are a little wonky.
-; tc0.uv <- U,V into the normal map
-; tc1.uvw, tc2.uvw, tc3.uvw <- 3x3 matrix transform
-; from tangent space->env map space
-; tc1.q, tc2.q, tc3.q <- eye vector in env map space
-;------------------------------------------------------------------------------
-
-; Get the 3-vector from the normal map
-tex t0
-
-; Perform matrix multiply to get a local normal bump. Then
-; reflect the eye vector through the normal and sample from
-; a cubic environment map.
-texm3x3pad t1, t0_bx2
-texm3x3pad t2, t0_bx2
-texm3x3vspec t3, t0_bx2
-
-; FIXME FIXME - Need to do specialized versions of this with and without:
-; - constant color
-; - fresnel amount of exactly 0 or 1 or in between
-; - envmap contrast of 0, 1, or in between
-; - envmap saturation of 0, 1, or in between
-
-; r0 = constant color * result of bump into envmap
-mul r0.rgb, t3, c0
-
-; dot eye-vector with per-pixel normal from t0
-dp3_sat r1, v0_bx2, t0_bx2
-
-; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel
-mul r1.rgb, r0, r0 ; color squared
-+mul r0.a, 1-r1.a, 1-r1.a ; squared
-
-lrp r0.rgb, c1, r1, r0 ; blend between color and color * color
-+mul r0.a, r0.a, r0.a ; quartic
-
-dp3 r1.rgb, r0, c3 ; color greyscaled
-+mul r0.a, r0.a, 1-r1.a ; quintic
-
-; FIXME - these should be able to pair (I think), but don't on nvidia for some reason.
-; (I think) cannot pair due to use of >2 constants in single stage
-lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale
-mad r0.a, r0.a, c6.a, c4.a ; Take Fresnel R(0) into consideration
-
-mul r0.rgb, r0, r0.a ; multiply output color by result of fresnel calc
-
-#if NORMALMAPALPHAENVMAPMASK
-+mul r0.a, c0.a, t0.a ; Fade amount * alpha from the texture
-#else
-+mov r0.a, c0.a ; Just use the fade amount
-#endif
-
-
+; STATIC: "NORMALMAPALPHAENVMAPMASK" "0..1" +ps.1.1 + +;------------------------------------------------------------------------------ +; Environment mapping on a bumped surface +; t0 - Normalmap +; t3 - Cube environment map (*must* be a cube map!) +; +; c0 - color to multiply the results by +; c1 - envmap contrast +; c2 - envmap saturation +; c3 - grey weights +; c4 - fresnel amount +; Input texture coords required here are a little wonky. +; tc0.uv <- U,V into the normal map +; tc1.uvw, tc2.uvw, tc3.uvw <- 3x3 matrix transform +; from tangent space->env map space +; tc1.q, tc2.q, tc3.q <- eye vector in env map space +;------------------------------------------------------------------------------ + +; Get the 3-vector from the normal map +tex t0 + +; Perform matrix multiply to get a local normal bump. Then +; reflect the eye vector through the normal and sample from +; a cubic environment map. +texm3x3pad t1, t0_bx2 +texm3x3pad t2, t0_bx2 +texm3x3vspec t3, t0_bx2 + +; FIXME FIXME - Need to do specialized versions of this with and without: +; - constant color +; - fresnel amount of exactly 0 or 1 or in between +; - envmap contrast of 0, 1, or in between +; - envmap saturation of 0, 1, or in between + +; r0 = constant color * result of bump into envmap +mul r0.rgb, t3, c0 + +; dot eye-vector with per-pixel normal from t0 +dp3_sat r1, v0_bx2, t0_bx2 + +; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel +mul r1.rgb, r0, r0 ; color squared ++mul r0.a, 1-r1.a, 1-r1.a ; squared + +lrp r0.rgb, c1, r1, r0 ; blend between color and color * color ++mul r0.a, r0.a, r0.a ; quartic + +dp3 r1.rgb, r0, c3 ; color greyscaled ++mul r0.a, r0.a, 1-r1.a ; quintic + +; FIXME - these should be able to pair (I think), but don't on nvidia for some reason. +; (I think) cannot pair due to use of >2 constants in single stage +lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale +mad r0.a, r0.a, c6.a, c4.a ; Take Fresnel R(0) into consideration + +mul r0.rgb, r0, r0.a ; multiply output color by result of fresnel calc + +#if NORMALMAPALPHAENVMAPMASK ++mul r0.a, c0.a, t0.a ; Fade amount * alpha from the texture +#else ++mov r0.a, c0.a ; Just use the fade amount +#endif + + diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedEnvmap_ps14.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedEnvmap_ps14.psh index 2a4efc7d..dbd03fa3 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedEnvmap_ps14.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedEnvmap_ps14.psh @@ -1,72 +1,72 @@ -; STATIC: "NORMALMAPALPHAENVMAPMASK" "0..1"
-ps.1.4
-;------------------------------------------------------------------------------
-; Phase 1
-;------------------------------------------------------------------------------
-; Get the 3-vector from the normal map
-texld r0, t0
-; Get environment matrix
-texcrd r1.rgb, t1
-texcrd r2.rgb, t2
-texcrd r3.rgb, t3
-; Normalize eye-ray vector through normalizer cube map
-texld r4, t4 ; <---- CUBE MAP here!!!
-;mov r0.rgba, r4
-
-; Transform normal
-dp3 r5.r, r1, r0_bx2
-dp3 r5.g, r2, r0_bx2
-dp3 r5.b, r3, r0_bx2
-; Reflection calculatiom
-dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye)
-mul r3.rgb, r5, r3 ; 2N(N.Eye)
-dp3 r2.rgb, r5, r5 ; N.N
-mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N)
-
-#if NORMALMAPALPHAENVMAPMASK
-; Alpha gets lost after phase marker, so store it here
-mov r5, r0.a
-#endif
-
-;------------------------------------------------------------------------------
-; Phase 2
-;------------------------------------------------------------------------------
-; What's left over from the last phase:
-; r0 - normal
-; r1 - free
-; r2 - vector to sample in envmap
-; r3 - free
-; r4 - normal
-; r5 - normal map alpha (rgba)
-
-phase
-
-; Sample environment map
-texld r3, r2
-
-; dot eye-vector with per-pixel normal from r0
-dp3_sat r1, v0_bx2, r0_bx2
-
-; Result goes in output color (multiply by constant color c0)
-mul r0.rgb, r3, c0
-
-; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel
-mul r1.rgb, r0, r0
-+mul r0.a, 1-r1.a, 1-r1.a ; squared
-
-lrp r0.rgb, c1, r1, r0 ; blend between color and color * color
-+mul r0.a, r0.a, r0.a ; quartic
-
-dp3 r1.rgb, r0, c3
-+mul r0.a, r0.a, 1-r1.a ; quintic
-
-lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale
-mad r0.a, r0.a, c6.a, c4.a ; Take Fresnel R(0) into consideration
-
-mul r0.rgb, r0, r0.a ; multiply output color by result of fresnel calc
-
-#if NORMALMAPALPHAENVMAPMASK
-+mul r0.a, c0.a, r5.r ; Fade amount * alpha from the texture
-#else
-+mov r0.a, c0.a ; Just use the fade amount
-#endif
+; STATIC: "NORMALMAPALPHAENVMAPMASK" "0..1" +ps.1.4 +;------------------------------------------------------------------------------ +; Phase 1 +;------------------------------------------------------------------------------ +; Get the 3-vector from the normal map +texld r0, t0 +; Get environment matrix +texcrd r1.rgb, t1 +texcrd r2.rgb, t2 +texcrd r3.rgb, t3 +; Normalize eye-ray vector through normalizer cube map +texld r4, t4 ; <---- CUBE MAP here!!! +;mov r0.rgba, r4 + +; Transform normal +dp3 r5.r, r1, r0_bx2 +dp3 r5.g, r2, r0_bx2 +dp3 r5.b, r3, r0_bx2 +; Reflection calculatiom +dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye) +mul r3.rgb, r5, r3 ; 2N(N.Eye) +dp3 r2.rgb, r5, r5 ; N.N +mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N) + +#if NORMALMAPALPHAENVMAPMASK +; Alpha gets lost after phase marker, so store it here +mov r5, r0.a +#endif + +;------------------------------------------------------------------------------ +; Phase 2 +;------------------------------------------------------------------------------ +; What's left over from the last phase: +; r0 - normal +; r1 - free +; r2 - vector to sample in envmap +; r3 - free +; r4 - normal +; r5 - normal map alpha (rgba) + +phase + +; Sample environment map +texld r3, r2 + +; dot eye-vector with per-pixel normal from r0 +dp3_sat r1, v0_bx2, r0_bx2 + +; Result goes in output color (multiply by constant color c0) +mul r0.rgb, r3, c0 + +; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel +mul r1.rgb, r0, r0 ++mul r0.a, 1-r1.a, 1-r1.a ; squared + +lrp r0.rgb, c1, r1, r0 ; blend between color and color * color ++mul r0.a, r0.a, r0.a ; quartic + +dp3 r1.rgb, r0, c3 ++mul r0.a, r0.a, 1-r1.a ; quintic + +lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale +mad r0.a, r0.a, c6.a, c4.a ; Take Fresnel R(0) into consideration + +mul r0.rgb, r0, r0.a ; multiply output color by result of fresnel calc + +#if NORMALMAPALPHAENVMAPMASK ++mul r0.a, c0.a, r5.r ; Fade amount * alpha from the texture +#else ++mov r0.a, c0.a ; Just use the fade amount +#endif diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap.psh index 9e55248e..82b83a49 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap.psh @@ -1,79 +1,79 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Computes the diffuse component of lighting using lightmap + bumpmap
-; t0 - Normalmap
-; t1 - Lightmap1
-; t2 - Lightmap2
-; t3 - Lightmap3
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - Normalmap and lightmap texture coordinates
-; c0, c1, c2 - Axes of the lightmap coordinate system in tangent space
-;------------------------------------------------------------------------------
-
-; Get the 3-vector from the normal map
-tex t0
-
-; Sample the lightmaps
-tex t1
-tex t2
-tex t3
-
-; output = lightmapColor[0] * ( ( N dot basis[0] )^2 ) +
-; lightmapColor[1] * ( ( N dot basis[1] )^2 ) +
-; lightmapColor[2] * ( ( N dot basis[2] )^2 ) +
-
-; r0 = ( N dot basis[0] )
-; don't "_sat" here so that everything adds up to one even if the normal is outside of the basis!!!!!
-dp3 r0, t0_bx2, c0
-
-; r1 = ( N dot basis[1] )
-dp3 r1, t0_bx2, c1
-
-;----
-; r0 = ( N dot basis[0] )
-; r1 = ( N dot basis[1] )
-;----
-
-; r0.rgb = ( N dot basis[0] )^2
-mul r0.rgb, r0, r0
-
-; r1.a = ( N dot basis[1] )^2
-+mul r1.a, r1, r1
-
-;----
-; r0.rgb = ( N dot basis[0] )^2
-; r1.a = ( N dot basis[1] )^2
-;----
-
-mul t1, r0, t1
-
-;----
-; r1.a = ( N dot basis[1] )^2
-; t1 = lightmapColor[0] * ( N dot basis[0] )^2
-;----
-
-dp3 r0, t0_bx2, c2
-
-;----
-; r1.a = ( N dot basis[1] )^2
-; t1 = lightmapColor[0] * ( N dot basis[0] )^2
-; r0 = ( N dot basis[2] )
-;----
-
-mad t1.rgb, r1.a, t2, t1
-+mul r0.a, r0, r0
-
-;----
-; t1.rgb = lightmapColor[0] * ( N dot basis[0] )^2 + lightmapColor[1] * ( N dot basis[1] )^2
-; r0.a = ( N dot basis[2] )^2
-;----
-
-mad r0.rgba, r0.a, t3, t1
-
-;----
-; r0.rgb = lightmapColor[0] * ( N dot basis[0] )^2 +
-; lightmapColor[1] * ( N dot basis[1] )^2 +
-; lightmapColor[2] * ( N dot basis[2] )^2
-;----
+ps.1.1 + +;------------------------------------------------------------------------------ +; Computes the diffuse component of lighting using lightmap + bumpmap +; t0 - Normalmap +; t1 - Lightmap1 +; t2 - Lightmap2 +; t3 - Lightmap3 +; +; The texture coordinates need to be defined as follows: +; tc0 - Normalmap and lightmap texture coordinates +; c0, c1, c2 - Axes of the lightmap coordinate system in tangent space +;------------------------------------------------------------------------------ + +; Get the 3-vector from the normal map +tex t0 + +; Sample the lightmaps +tex t1 +tex t2 +tex t3 + +; output = lightmapColor[0] * ( ( N dot basis[0] )^2 ) + +; lightmapColor[1] * ( ( N dot basis[1] )^2 ) + +; lightmapColor[2] * ( ( N dot basis[2] )^2 ) + + +; r0 = ( N dot basis[0] ) +; don't "_sat" here so that everything adds up to one even if the normal is outside of the basis!!!!! +dp3 r0, t0_bx2, c0 + +; r1 = ( N dot basis[1] ) +dp3 r1, t0_bx2, c1 + +;---- +; r0 = ( N dot basis[0] ) +; r1 = ( N dot basis[1] ) +;---- + +; r0.rgb = ( N dot basis[0] )^2 +mul r0.rgb, r0, r0 + +; r1.a = ( N dot basis[1] )^2 ++mul r1.a, r1, r1 + +;---- +; r0.rgb = ( N dot basis[0] )^2 +; r1.a = ( N dot basis[1] )^2 +;---- + +mul t1, r0, t1 + +;---- +; r1.a = ( N dot basis[1] )^2 +; t1 = lightmapColor[0] * ( N dot basis[0] )^2 +;---- + +dp3 r0, t0_bx2, c2 + +;---- +; r1.a = ( N dot basis[1] )^2 +; t1 = lightmapColor[0] * ( N dot basis[0] )^2 +; r0 = ( N dot basis[2] ) +;---- + +mad t1.rgb, r1.a, t2, t1 ++mul r0.a, r0, r0 + +;---- +; t1.rgb = lightmapColor[0] * ( N dot basis[0] )^2 + lightmapColor[1] * ( N dot basis[1] )^2 +; r0.a = ( N dot basis[2] )^2 +;---- + +mad r0.rgba, r0.a, t3, t1 + +;---- +; r0.rgb = lightmapColor[0] * ( N dot basis[0] )^2 + +; lightmapColor[1] * ( N dot basis[1] )^2 + +; lightmapColor[2] * ( N dot basis[2] )^2 +;---- diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap_base_ps14.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap_base_ps14.psh index 39a25964..4756b5bd 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap_base_ps14.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap_base_ps14.psh @@ -1,39 +1,39 @@ -;------------------------------------------------------------------------------
-; Computes the diffuse component of lighting using lightmap + bumpmap
-; t0 - Normalmap
-; t1 - Lightmap1
-; t2 - Lightmap2
-; t3 - Lightmap3
-; t4 - Base
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - Normalmap and lightmap texture coordinates
-; c0, c1, c2 - Axes of the lightmap coordinate system in tangent space
-;------------------------------------------------------------------------------
-ps.1.4
-
-; Get the 3-vector from the normal map
-texld r0, t0
-
-; Sample the lightmaps
-texld r1, t1
-texld r2, t2
-texld r3, t3
-
-; Sample the base texture
-texld r4, t4
-
-; output = (lightmapColor[0] * ( ( N dot basis[0] )^2 ) +
-; lightmapColor[1] * ( ( N dot basis[1] )^2 ) +
-; lightmapColor[2] * ( ( N dot basis[2] )^2 ) ) * base
-
-dp3 r5.r, r0_bx2, c0
-dp3 r5.g, r0_bx2, c1
-dp3 r5.b, r0_bx2, c2
-mul r5.rgb, r5, r5
-mul r1, r1, r5.r
-mad r1, r2, r5.g, r1
-mad r1, r3, r5.g, r1
-
-; assume overbright_2 !!!
-mul_x2 r0, r1, r4
+;------------------------------------------------------------------------------ +; Computes the diffuse component of lighting using lightmap + bumpmap +; t0 - Normalmap +; t1 - Lightmap1 +; t2 - Lightmap2 +; t3 - Lightmap3 +; t4 - Base +; +; The texture coordinates need to be defined as follows: +; tc0 - Normalmap and lightmap texture coordinates +; c0, c1, c2 - Axes of the lightmap coordinate system in tangent space +;------------------------------------------------------------------------------ +ps.1.4 + +; Get the 3-vector from the normal map +texld r0, t0 + +; Sample the lightmaps +texld r1, t1 +texld r2, t2 +texld r3, t3 + +; Sample the base texture +texld r4, t4 + +; output = (lightmapColor[0] * ( ( N dot basis[0] )^2 ) + +; lightmapColor[1] * ( ( N dot basis[1] )^2 ) + +; lightmapColor[2] * ( ( N dot basis[2] )^2 ) ) * base + +dp3 r5.r, r0_bx2, c0 +dp3 r5.g, r0_bx2, c1 +dp3 r5.b, r0_bx2, c2 +mul r5.rgb, r5, r5 +mul r1, r1, r5.r +mad r1, r2, r5.g, r1 +mad r1, r3, r5.g, r1 + +; assume overbright_2 !!! +mul_x2 r0, r1, r4 diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap_blend_ps14.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap_blend_ps14.psh index f17f14cf..2b43ee33 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap_blend_ps14.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedLightmap_blend_ps14.psh @@ -1,47 +1,47 @@ -;------------------------------------------------------------------------------
-; Computes the diffuse component of lighting using lightmap + bumpmap
-; t0 - Normalmap
-; t1 - Lightmap1
-; t2 - Lightmap2
-; t3 - Lightmap3
-; t4 - Base1
-; t5 - Base2
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - Normalmap and lightmap texture coordinates
-; c0, c1, c2 - Axes of the lightmap coordinate system in tangent space
-;------------------------------------------------------------------------------
-ps.1.4
-
-; output = (lightmapColor[0] * ( ( N dot basis[0] )^2 ) +
-; lightmapColor[1] * ( ( N dot basis[1] )^2 ) +
-; lightmapColor[2] * ( ( N dot basis[2] )^2 ) ) * lerp(base1, base2, lightmapColor[0].a)
-
-; Get the 3-vector from the normal map
-texld r0, t0
-
-dp3 r5.r, r0_bx2, c0
-dp3 r5.g, r0_bx2, c1
-dp3 r5.b, r0_bx2, c2
-mul r5.rgb, r5, r5
-
-phase
-
-; Sample the lightmaps
-texld r1, t1
-texld r2, t2
-texld r3, t3
-
-; Sample the base textures
-texld r4, t4
-texld r5, t5
-
-mul r1, r1, r5.r
-mad r1, r2, r5.g, r1
-mad r1, r3, r5.g, r1
-
-; blend base textures
-lrp r4, r4, r5, r1.a
-
-; assume overbright_2 !!!
-mul_x2 r0, r1, r4
+;------------------------------------------------------------------------------ +; Computes the diffuse component of lighting using lightmap + bumpmap +; t0 - Normalmap +; t1 - Lightmap1 +; t2 - Lightmap2 +; t3 - Lightmap3 +; t4 - Base1 +; t5 - Base2 +; +; The texture coordinates need to be defined as follows: +; tc0 - Normalmap and lightmap texture coordinates +; c0, c1, c2 - Axes of the lightmap coordinate system in tangent space +;------------------------------------------------------------------------------ +ps.1.4 + +; output = (lightmapColor[0] * ( ( N dot basis[0] )^2 ) + +; lightmapColor[1] * ( ( N dot basis[1] )^2 ) + +; lightmapColor[2] * ( ( N dot basis[2] )^2 ) ) * lerp(base1, base2, lightmapColor[0].a) + +; Get the 3-vector from the normal map +texld r0, t0 + +dp3 r5.r, r0_bx2, c0 +dp3 r5.g, r0_bx2, c1 +dp3 r5.b, r0_bx2, c2 +mul r5.rgb, r5, r5 + +phase + +; Sample the lightmaps +texld r1, t1 +texld r2, t2 +texld r3, t3 + +; Sample the base textures +texld r4, t4 +texld r5, t5 + +mul r1, r1, r5.r +mad r1, r2, r5.g, r1 +mad r1, r3, r5.g, r1 + +; blend base textures +lrp r4, r4, r5, r1.a + +; assume overbright_2 !!! +mul_x2 r0, r1, r4 diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_Decal.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_Decal.psh index 86e627e5..01984202 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_Decal.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_Decal.psh @@ -1,47 +1,47 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Computes the diffuse component of lighting using lightmap + bumpmap
-; t0 - decal texture
-; t1 - Lightmap1
-; t2 - Lightmap2
-; t3 - Lightmap3
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - Normalmap and lightmap texture coordinates
-; c0, c1, c2 - ( ( N dot basis[0] )^2 ), ( ( N dot basis[1] )^2 ), ( ( N dot basis[2] )^2 )
-;------------------------------------------------------------------------------
-
-; Get the decal color
-tex t0
-
-; Sample the lightmaps
-tex t1
-tex t2
-tex t3
-
-; output = lightmapColor[0] * ( ( N dot basis[0] )^2 ) +
-; lightmapColor[1] * ( ( N dot basis[1] )^2 ) +
-; lightmapColor[2] * ( ( N dot basis[2] )^2 ) +
-
-; r0 = lightmapColor[0] * ( ( N dot basis[0] )^2 )
-mul r0, t1, c0
-
-; r0 = lightmapColor[0] * ( ( N dot basis[0] )^2 ) + lightmapColor[1] * ( ( N dot basis[1] )^2 )
-mad r0, t2, c1, r0
-
-; r0 = lightmapColor[0] * ( ( N dot basis[0] )^2 ) +
-; lightmapColor[1] * ( ( N dot basis[1] )^2 ) +
-; lightmapColor[2] * ( ( N dot basis[2] )^2 )
-mad r0, t3, c2, r0
-
-; Modulate by decal texture
-mul r0.rgb, r0, t0
-+ mov r0.a, t0.a
-
-; Modulate by constant color
-mul r0, r0, c3
-
-; Modulate by per-vertex factor
-mul r0, r0, v0
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Computes the diffuse component of lighting using lightmap + bumpmap +; t0 - decal texture +; t1 - Lightmap1 +; t2 - Lightmap2 +; t3 - Lightmap3 +; +; The texture coordinates need to be defined as follows: +; tc0 - Normalmap and lightmap texture coordinates +; c0, c1, c2 - ( ( N dot basis[0] )^2 ), ( ( N dot basis[1] )^2 ), ( ( N dot basis[2] )^2 ) +;------------------------------------------------------------------------------ + +; Get the decal color +tex t0 + +; Sample the lightmaps +tex t1 +tex t2 +tex t3 + +; output = lightmapColor[0] * ( ( N dot basis[0] )^2 ) + +; lightmapColor[1] * ( ( N dot basis[1] )^2 ) + +; lightmapColor[2] * ( ( N dot basis[2] )^2 ) + + +; r0 = lightmapColor[0] * ( ( N dot basis[0] )^2 ) +mul r0, t1, c0 + +; r0 = lightmapColor[0] * ( ( N dot basis[0] )^2 ) + lightmapColor[1] * ( ( N dot basis[1] )^2 ) +mad r0, t2, c1, r0 + +; r0 = lightmapColor[0] * ( ( N dot basis[0] )^2 ) + +; lightmapColor[1] * ( ( N dot basis[1] )^2 ) + +; lightmapColor[2] * ( ( N dot basis[2] )^2 ) +mad r0, t3, c2, r0 + +; Modulate by decal texture +mul r0.rgb, r0, t0 ++ mov r0.a, t0.a + +; Modulate by constant color +mul r0, r0, c3 + +; Modulate by per-vertex factor +mul r0, r0, v0 + diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_Detail.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_Detail.psh index 89b6c322..4e3625f1 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_Detail.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_Detail.psh @@ -1,18 +1,18 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-mul r0, t0, v0 ; base times vertex color (with alpha)
-mul r0.rgb, t1, r0 ; fold in lightmap (color only)
-mul_x2 r1.rgb, r0, t2 ; detail texture
-lrp r0.rgb, c2, r1, r0
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 +mul r0, t0, v0 ; base times vertex color (with alpha) +mul r0.rgb, t1, r0 ; fold in lightmap (color only) +mul_x2 r1.rgb, r0, t2 ; detail texture +lrp r0.rgb, c2, r1, r0 +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_DetailNoTexture.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_DetailNoTexture.psh index a9129757..a1d6c4e1 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_DetailNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_DetailNoTexture.psh @@ -1,16 +1,16 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t1
-tex t2
-mul r0.rgb, t1, v0 + ; base times vertex color (with alpha)
-mov r0.a, v0.a
-mul_x2 r0.rgb, r0, t2 ; detail texture
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t1 +tex t2 +mul r0.rgb, t1, v0 + ; base times vertex color (with alpha) +mov r0.a, v0.a +mul_x2 r0.rgb, r0, t2 ; detail texture +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_DetailSelfIlluminated.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_DetailSelfIlluminated.psh index a9e05150..575585b7 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_DetailSelfIlluminated.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_DetailSelfIlluminated.psh @@ -1,23 +1,23 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-mul r0.rgb, t0, v0 + ; base times vertex color (no alpha)
-mov r0.a, v0.a ; Grab alpha from vertex color
-
-mul r0.rgb, t1, r0 ; fold in lighting (color only)
-mul_x2 r1.rgb, r0, t2 ; detail texture
-lrp r0.rgb, c2, r1, r0
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1, c1, t0 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lightmap
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 +mul r0.rgb, t0, v0 + ; base times vertex color (no alpha) +mov r0.a, v0.a ; Grab alpha from vertex color + +mul r0.rgb, t1, r0 ; fold in lighting (color only) +mul_x2 r1.rgb, r0, t2 ; detail texture +lrp r0.rgb, c2, r1, r0 +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1, c1, t0 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lightmap diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_EnvMapNoTexture.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_EnvMapNoTexture.psh index 919da94c..706ba7c2 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_EnvMapNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_EnvMapNoTexture.psh @@ -1,21 +1,21 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t1
-tex t2
-
-mov r0.rgb, v0 + ; vertex color
-mul r0.a, v0.a, t2.a ; vertex alpha * envmap alpha
-
-mad r0.rgb, t2, c2, r0 ; + envmap * envmaptint (color only)
-mul r0.rgb, t1, r0 ; fold in lightmap (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t1 +tex t2 + +mov r0.rgb, v0 + ; vertex color +mul r0.a, v0.a, t2.a ; vertex alpha * envmap alpha + +mad r0.rgb, t2, c2, r0 ; + envmap * envmaptint (color only) +mul r0.rgb, t1, r0 ; fold in lightmap (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_EnvMapV2.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_EnvMapV2.psh index f0205e86..05812ff1 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_EnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_EnvMapV2.psh @@ -1,20 +1,20 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-
-mul r0, t0, v0 ; base times vertex color (with alpha)
-mul r0.rgb, t1, r0 ; fold in lightmap (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mad r0.rgb, t2, c2, r0 ; + envmap * envmaptint (color only)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 + +mul r0, t0, v0 ; base times vertex color (with alpha) +mul r0.rgb, t1, r0 ; fold in lightmap (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mad r0.rgb, t2, c2, r0 ; + envmap * envmaptint (color only) diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_LightingOnly_Overbright2.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_LightingOnly_Overbright2.psh index 30bd9f76..c4f2ba23 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_LightingOnly_Overbright2.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_LightingOnly_Overbright2.psh @@ -1,6 +1,6 @@ -ps.1.1
-
-tex t1
-
-mov r0.rgba, t1
-
+ps.1.1 + +tex t1 + +mov r0.rgba, t1 + diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_MaskedEnvMapNoTexture.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_MaskedEnvMapNoTexture.psh index ee59d663..a1e63741 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_MaskedEnvMapNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_MaskedEnvMapNoTexture.psh @@ -1,24 +1,24 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t1
-tex t2
-tex t3
-
-mov r0.rgb, v0 ; vertex color
-mul r1, t2, t3 ; envmap * envmapmask
-
-mad r0.rgb, r1, c2, r0 + ; + envmap * envmapmask * envmaptint (color only)
-mul r0.a, v0.a, r1.a ; alpha = vertex alpha * envmap alpha * envmapmask alpha
-
-mul r0.rgb, t1, r0 ; fold in lightmap (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t1 +tex t2 +tex t3 + +mov r0.rgb, v0 ; vertex color +mul r1, t2, t3 ; envmap * envmapmask + +mad r0.rgb, r1, c2, r0 + ; + envmap * envmapmask * envmaptint (color only) +mul r0.a, v0.a, r1.a ; alpha = vertex alpha * envmap alpha * envmapmask alpha + +mul r0.rgb, t1, r0 ; fold in lightmap (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_MaskedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_MaskedEnvMapV2.psh index 398ed46a..83553ac8 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_MaskedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_MaskedEnvMapV2.psh @@ -1,22 +1,22 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-tex t3
-
-mul r0, t0, v0 ; base times vertex color (with alpha)
-mul r0.rgb, t1, r0 ; fold in lighting (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mul r1, t2, t3 ; envmap * envmapmask
-mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 +tex t3 + +mul r0, t0, v0 ; base times vertex color (with alpha) +mul r0.rgb, t1, r0 ; fold in lighting (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mul r1, t2, t3 ; envmap * envmapmask +mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only) diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLighting.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLighting.psh index 7944e730..9f09397c 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLighting.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLighting.psh @@ -1,20 +1,20 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-def c2, 1.0f, 1.0f, 1.0f, 1.0f
-
-tex t0
-tex t1
-
-; Blend between grey and lightmap color based on total alpha
-
-mul_x2 r1.rgb, c0, t1 ; Apply overbright to lightmap
-+ mul_sat r1.a, t0, v0 ; base times vertex alpha
-lrp r0, r1.a, r1, c2 ; interpolate between white + color
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +def c2, 1.0f, 1.0f, 1.0f, 1.0f + +tex t0 +tex t1 + +; Blend between grey and lightmap color based on total alpha + +mul_x2 r1.rgb, c0, t1 ; Apply overbright to lightmap ++ mul_sat r1.a, t0, v0 ; base times vertex alpha +lrp r0, r1.a, r1, c2 ; interpolate between white + color diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLightingNoTexture.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLightingNoTexture.psh index e0fb27b7..0e52ed86 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLightingNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLightingNoTexture.psh @@ -1,20 +1,20 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-def c2, 1.0f, 1.0f, 1.0f, 1.0f
-
-tex t0
-tex t1
-
-; Blend between grey and lightmap color based on total alpha
-
-mul_x2 r1.rgb, c0, t1 ; Apply overbright to lightmap
-+ mov_sat r1.a, v0 ; vertex alpha
-lrp r0, r1.a, r1, c2 ; interpolate between white + color
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +def c2, 1.0f, 1.0f, 1.0f, 1.0f + +tex t0 +tex t1 + +; Blend between grey and lightmap color based on total alpha + +mul_x2 r1.rgb, c0, t1 ; Apply overbright to lightmap ++ mov_sat r1.a, v0 ; vertex alpha +lrp r0, r1.a, r1, c2 ; interpolate between white + color diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLightingSelfIllum.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLightingSelfIllum.psh index 1282ecac..6c939a47 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLightingSelfIllum.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_MultiplyByLightingSelfIllum.psh @@ -1,23 +1,23 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-def c2, 1.0f, 1.0f, 1.0f, 1.0f
-
-tex t0
-tex t1
-
-; Blend between white and lightmap color based on total alpha
-mul_x2 r1.rgb, c0, t1 ; Apply overbright to lightmap
-+ mov_sat r1.a, v0 ; opacity == vertex opacity (no alpha in texture)
-
-lrp r0.rgb, t0.a, c1, r1 ; Blend between self-illum + lightmap
-+ mov r0.a, c2.a
-
-lrp r0.rgb, r1.a, r0, c2 ; interpolate between white + color
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +def c2, 1.0f, 1.0f, 1.0f, 1.0f + +tex t0 +tex t1 + +; Blend between white and lightmap color based on total alpha +mul_x2 r1.rgb, c0, t1 ; Apply overbright to lightmap ++ mov_sat r1.a, v0 ; opacity == vertex opacity (no alpha in texture) + +lrp r0.rgb, t0.a, c1, r1 ; Blend between self-illum + lightmap ++ mov r0.a, c2.a + +lrp r0.rgb, r1.a, r0, c2 ; interpolate between white + color diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_NoTexture.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_NoTexture.psh index f02de34b..01b20711 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_NoTexture.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_NoTexture.psh @@ -1,14 +1,14 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t1
-mul r0.rgb, t1, v0 + ; base times vertex color (with alpha)
-mov r0.a, v0.a
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t1 +mul r0.rgb, t1, v0 + ; base times vertex color (with alpha) +mov r0.a, v0.a +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_SSBumpmappedLightmap.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_SSBumpmappedLightmap.psh index bdcb7783..29be70ca 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_SSBumpmappedLightmap.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_SSBumpmappedLightmap.psh @@ -1,34 +1,34 @@ -ps.1.1
-def c0, 1,0,0,0
-def c1, 0,1,0,0
-def c2, 0,0,1,0
-
-;------------------------------------------------------------------------------
-; Computes the diffuse component of lighting using lightmap + bumpmap
-; t0 - Normalmap
-; t1 - Lightmap1
-; t2 - Lightmap2
-; t3 - Lightmap3
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - Normalmap and lightmap texture coordinates
-;------------------------------------------------------------------------------
-
-; Get the 3-vector from the normal map
-tex t0
-
-; Sample the lightmaps
-tex t1
-tex t2
-tex t3
-
-; output = lightmapColor[0] * n.r + lightmapColor[1] * n.g + lightmapColor[2] * n.b
-
-
-mov r0, t0
-dp3 r1, t0, c0
-mul r0.rgb, r1, t1
-dp3 r1, t0, c1
-mad r0.rgb, r1, t2, r0
-dp3 r1, t0, c2
-mad r0.rgb, r1, t3, r0
+ps.1.1 +def c0, 1,0,0,0 +def c1, 0,1,0,0 +def c2, 0,0,1,0 + +;------------------------------------------------------------------------------ +; Computes the diffuse component of lighting using lightmap + bumpmap +; t0 - Normalmap +; t1 - Lightmap1 +; t2 - Lightmap2 +; t3 - Lightmap3 +; +; The texture coordinates need to be defined as follows: +; tc0 - Normalmap and lightmap texture coordinates +;------------------------------------------------------------------------------ + +; Get the 3-vector from the normal map +tex t0 + +; Sample the lightmaps +tex t1 +tex t2 +tex t3 + +; output = lightmapColor[0] * n.r + lightmapColor[1] * n.g + lightmapColor[2] * n.b + + +mov r0, t0 +dp3 r1, t0, c0 +mul r0.rgb, r1, t1 +dp3 r1, t0, c1 +mad r0.rgb, r1, t2, r0 +dp3 r1, t0, c2 +mad r0.rgb, r1, t3, r0 diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminated.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminated.psh index cf800a2e..1ac3326d 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminated.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminated.psh @@ -1,21 +1,21 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-
-mul r0.rgb, t0, v0 + ; base times vertex color (no alpha)
-mov r0.a, v0.a ; Grab alpha from vertex color
-
-mul r0.rgb, t1, r0 ; fold in lighting (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1, c1, t0 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lightmap
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 +tex t1 + +mul r0.rgb, t0, v0 + ; base times vertex color (no alpha) +mov r0.a, v0.a ; Grab alpha from vertex color + +mul r0.rgb, t1, r0 ; fold in lighting (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1, c1, t0 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lightmap diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminatedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminatedEnvMapV2.psh index 9fd0a1c5..0121e928 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminatedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminatedEnvMapV2.psh @@ -1,27 +1,27 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-
-mul r0.rgb, t0, v0 + ; base times vertex color (no alpha)
-mov r0.a, v0.a ; Grab alpha from vertex color
-
-mul r1, t0.a, t0 ; Self illum
-mad r1, c1, r1, t1 ; Self illum * tint + lightmap
-
-mul r0.rgb, r1, r0 ; fold in lighting (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mad r0.rgb, t2, c2, r0 ; + envmap * envmaptint (color only)
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 + +mul r0.rgb, t0, v0 + ; base times vertex color (no alpha) +mov r0.a, v0.a ; Grab alpha from vertex color + +mul r1, t0.a, t0 ; Self illum +mad r1, c1, r1, t1 ; Self illum * tint + lightmap + +mul r0.rgb, r1, r0 ; fold in lighting (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mad r0.rgb, t2, c2, r0 ; + envmap * envmaptint (color only) + diff --git a/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminatedMaskedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminatedMaskedEnvMapV2.psh index 1e62a416..4d32a715 100644 --- a/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminatedMaskedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/LightmappedGeneric_SelfIlluminatedMaskedEnvMapV2.psh @@ -1,28 +1,28 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-tex t3
-
-mul r0.rgb, t0, v0 + ; base times vertex color (with alpha)
-mov r0.a, v0.a ; Grab alpha from vertex color
-
-mul r1, c1, t0.a ; Self illum alpha * tint
-mad r1, t0, r1, t1 ; Self illum * tint + lightmap
-mul r0.rgb, r1, r0 ; fold in lighting (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1, t2, t3 ; envmap * envmapmask
-mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only)
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 +tex t3 + +mul r0.rgb, t0, v0 + ; base times vertex color (with alpha) +mov r0.a, v0.a ; Grab alpha from vertex color + +mul r1, c1, t0.a ; Self illum alpha * tint +mad r1, t0, r1, t1 ; Self illum * tint + lightmap +mul r0.rgb, r1, r0 ; fold in lighting (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1, t2, t3 ; envmap * envmapmask +mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only) + diff --git a/mp/src/materialsystem/stdshaders/Refract_ps11.psh b/mp/src/materialsystem/stdshaders/Refract_ps11.psh index f3fe34d2..a4e59bf6 100644 --- a/mp/src/materialsystem/stdshaders/Refract_ps11.psh +++ b/mp/src/materialsystem/stdshaders/Refract_ps11.psh @@ -1,36 +1,36 @@ -; STATIC: "REFRACTTINTTEXTURE" "0..1"
-; STATIC: "NORMALMAPALPHA" "0..1"
-
-ps.1.1
-
-; t0:
-; texture: dudv map
-; texcoords: dudvmap texcoords
-; t1:
-; texture: refraction render target
-; texcoords:
-
-tex t0 ; sample dudv map
-texbem t1, t0 ; refraction
-
-#if REFRACTTINTTEXTURE
-tex t2
-#endif
-
-#if NORMALMAPALPHA
-tex t3
-#endif
-
-; refracttint
-#if REFRACTTINTTEXTURE
-mul_x2 r0, t1, t2
-#else
-mov r0, t1
-#endif
-
-#if NORMALMAPALPHA
-mul r0.rgb, r0, c0 +
-mov r0.a, t3.a
-#else
-mul r0.rgb, r0, c0
-#endif
+; STATIC: "REFRACTTINTTEXTURE" "0..1" +; STATIC: "NORMALMAPALPHA" "0..1" + +ps.1.1 + +; t0: +; texture: dudv map +; texcoords: dudvmap texcoords +; t1: +; texture: refraction render target +; texcoords: + +tex t0 ; sample dudv map +texbem t1, t0 ; refraction + +#if REFRACTTINTTEXTURE +tex t2 +#endif + +#if NORMALMAPALPHA +tex t3 +#endif + +; refracttint +#if REFRACTTINTTEXTURE +mul_x2 r0, t1, t2 +#else +mov r0, t1 +#endif + +#if NORMALMAPALPHA +mul r0.rgb, r0, c0 + +mov r0.a, t3.a +#else +mul r0.rgb, r0, c0 +#endif diff --git a/mp/src/materialsystem/stdshaders/ShadowModel.psh b/mp/src/materialsystem/stdshaders/ShadowModel.psh index a7514020..31b6d780 100644 --- a/mp/src/materialsystem/stdshaders/ShadowModel.psh +++ b/mp/src/materialsystem/stdshaders/ShadowModel.psh @@ -1,22 +1,22 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-def c0,1.0f, 1.0f, 1.0f, 1.0f
-
-tex t0 ; shadow color
-texkill t1 ; Clip
-texkill t2
-texkill t3 ; backface cull
-
-; Darkening equation, compute a color = (shadow color * shadow alpha + 1- shadow alpha)
-;sub r1, t0, v0.a ; r1 = shadow alpha
-lrp r0.rgb, t0.a, v0, c0 + ; r0.rgb = (shadow color * shadow alpha + 1 - shadow alpha)
-mov r0.a, c0.a ; r0.a = 1
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +def c0,1.0f, 1.0f, 1.0f, 1.0f + +tex t0 ; shadow color +texkill t1 ; Clip +texkill t2 +texkill t3 ; backface cull + +; Darkening equation, compute a color = (shadow color * shadow alpha + 1- shadow alpha) +;sub r1, t0, v0.a ; r1 = shadow alpha +lrp r0.rgb, t0.a, v0, c0 + ; r0.rgb = (shadow color * shadow alpha + 1 - shadow alpha) +mov r0.a, c0.a ; r0.a = 1 + diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric.psh index 53fab24d..409ee0d6 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric.psh @@ -1,13 +1,13 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 ; base color + mul r0, t0, v0
\ No newline at end of file diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_BaseAlphaMaskedEnvMap.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_BaseAlphaMaskedEnvMap.psh index 1ed9314e..32ec9c6e 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_BaseAlphaMaskedEnvMap.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_BaseAlphaMaskedEnvMap.psh @@ -1,19 +1,19 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask
-
-mul r0.rgb, t1, 1-t2.a ; can't use mad cause can't use 3 texture registers
-mul r0.rgb, c2, r0 ; apply the envmaptint
-mad r0.rgb, t0, v0, r0
-+ mul r0.a, t0, v0
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask + +mul r0.rgb, t1, 1-t2.a ; can't use mad cause can't use 3 texture registers +mul r0.rgb, c2, r0 ; apply the envmaptint +mad r0.rgb, t0, v0, r0 ++ mul r0.a, t0, v0 diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_Detail.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_Detail.psh index 5fcb3f31..421d2d36 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_Detail.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_Detail.psh @@ -1,15 +1,15 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t3 ; detail texture
-
-mul r0, t0, v0
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t3 ; detail texture + +mul r0, t0, v0 mul_x2 r0.rgb, r0, t3
\ No newline at end of file diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailBaseAlphaMaskedEnvMap.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailBaseAlphaMaskedEnvMap.psh index 69693331..7d234bb3 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailBaseAlphaMaskedEnvMap.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailBaseAlphaMaskedEnvMap.psh @@ -1,29 +1,29 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask
-tex t3 ; detail texture
-
-; version 1: applies the mod2x *after* environment map
-;mul r0.rgb, t1, 1-t2.a ; can't use mad cause can't use 3 texture registers
-;mul r0.rgb, c2, r0 ; apply the envmaptint
-;mad r0.rgb, t0, v0, r0
-;+ mul r0.a, t0, v0
-;mul_x2 r0.rgb, r0, t3 ; mod2x detail texture
-
-; version 2: applies the mod2x *before* environment map
-mul r0, t0, v0 ; Base times modulation color
-mul_x2 r0.rgb, r0, t3 ; mod2x detail texture
-mul r1, t1, 1-t2.a ; Have to invert the alpha for basealpha (feh!)
-mul r1, c2, r1 ; apply the envmaptint
-add r0.rgb, r0, r1 ; add in the envmap
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask +tex t3 ; detail texture + +; version 1: applies the mod2x *after* environment map +;mul r0.rgb, t1, 1-t2.a ; can't use mad cause can't use 3 texture registers +;mul r0.rgb, c2, r0 ; apply the envmaptint +;mad r0.rgb, t0, v0, r0 +;+ mul r0.a, t0, v0 +;mul_x2 r0.rgb, r0, t3 ; mod2x detail texture + +; version 2: applies the mod2x *before* environment map +mul r0, t0, v0 ; Base times modulation color +mul_x2 r0.rgb, r0, t3 ; mod2x detail texture +mul r1, t1, 1-t2.a ; Have to invert the alpha for basealpha (feh!) +mul r1, c2, r1 ; apply the envmaptint +add r0.rgb, r0, r1 ; add in the envmap diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMap.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMap.psh index dab6efbb..6e8fde98 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMap.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMap.psh @@ -1,25 +1,25 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t3 ; detail texture
-
-; version 1: applies the mod2x *after* environment map
-;mul r1, c2, t1
-;mad r0.rgb, t0, v0, r1
-;+ mul r0.a, t0, v0
-;mul_x2 r0.rgb, r0, t3 ; mod2x detail texture
-
-; version 2: applies the mod2x *before* environment map
-mul r0, t0, v0 ; Base times modulation color
-mul_x2 r0.rgb, r0, t3 ; mod2x detail texture
-mad r0.rgb, c2, t1, r0 ; add in tinted envmap
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map +tex t3 ; detail texture + +; version 1: applies the mod2x *after* environment map +;mul r1, c2, t1 +;mad r0.rgb, t0, v0, r1 +;+ mul r0.a, t0, v0 +;mul_x2 r0.rgb, r0, t3 ; mod2x detail texture + +; version 2: applies the mod2x *before* environment map +mul r0, t0, v0 ; Base times modulation color +mul_x2 r0.rgb, r0, t3 ; mod2x detail texture +mad r0.rgb, c2, t1, r0 ; add in tinted envmap diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapMask.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapMask.psh index 29411c9b..93786add 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapMask.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapMask.psh @@ -1,29 +1,29 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask
-tex t3 ; detail texture
-
-; version 1: applies the mod2x *after* environment map
-;mul r0.rgb, t1, t2 ; can't use mad cause can't use 3 texture registers
-;mul r0.rgb, c2, r0 ; apply the envmaptint
-;mad r0.rgb, t0, v0, r0
-;+ mul r0.a, t0, v0
-;mul_x2 r0.rgb, r0, t3 ; mod2x detail texture
-
-; version 2: applies the mod2x *before* environment map
-mul r0, t0, v0 ; Base times modulation color
-mul_x2 r0.rgb, r0, t3 ; mod2x detail texture
-mul r1, t1, t2 ; Envmap * envmapmask
-mul r1, c2, r1 ; apply the envmaptint
-add r0.rgb, r0, r1 ; add in the envmap
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask +tex t3 ; detail texture + +; version 1: applies the mod2x *after* environment map +;mul r0.rgb, t1, t2 ; can't use mad cause can't use 3 texture registers +;mul r0.rgb, c2, r0 ; apply the envmaptint +;mad r0.rgb, t0, v0, r0 +;+ mul r0.a, t0, v0 +;mul_x2 r0.rgb, r0, t3 ; mod2x detail texture + +; version 2: applies the mod2x *before* environment map +mul r0, t0, v0 ; Base times modulation color +mul_x2 r0.rgb, r0, t3 ; mod2x detail texture +mul r1, t1, t2 ; Envmap * envmapmask +mul r1, c2, r1 ; apply the envmaptint +add r0.rgb, r0, r1 ; add in the envmap diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapMaskNoTexture.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapMaskNoTexture.psh index e8c6f3cb..be678909 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapMaskNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapMaskNoTexture.psh @@ -1,21 +1,21 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t1 ; cube map
-tex t2 ; envmap mask
-tex t3 ; detail texture
-
-; version 1: applies the mod2x *after* environment map
-; version 2 doesn't make sense here!
-mul r0, t1, t2
-mul r0.rgb, c2, r0
-mul r0, r0, v0
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t1 ; cube map +tex t2 ; envmap mask +tex t3 ; detail texture + +; version 1: applies the mod2x *after* environment map +; version 2 doesn't make sense here! +mul r0, t1, t2 +mul r0.rgb, c2, r0 +mul r0, r0, v0 mul_x2 r0.rgb, r0, t3 ; mod2x detail texture
\ No newline at end of file diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapNoTexture.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapNoTexture.psh index 829849b9..d3796bf9 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailEnvMapNoTexture.psh @@ -1,19 +1,19 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t1 ; cube map
-tex t3 ; detail texture
-
-; version 1: applies the mod2x *after* environment map
-; version 2 doesn't make sense here!
-mul r0, v0, t1
-mul r0.rgb, r0, c2
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t1 ; cube map +tex t3 ; detail texture + +; version 1: applies the mod2x *after* environment map +; version 2 doesn't make sense here! +mul r0, v0, t1 +mul r0.rgb, r0, c2 mul_x2 r0.rgb, r0, t3 ; mod2x detail texture
\ No newline at end of file diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailNoTexture.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailNoTexture.psh index c79dc2ce..193de81e 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_DetailNoTexture.psh @@ -1,10 +1,10 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Just use the vertex color
-;------------------------------------------------------------------------------
-
-tex t3
-
-mul_x2 r0.rgb, v0, t3
+ps.1.1 + +;------------------------------------------------------------------------------ +; Just use the vertex color +;------------------------------------------------------------------------------ + +tex t3 + +mul_x2 r0.rgb, v0, t3 + mov r0.a, v0.a
\ No newline at end of file diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMap.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMap.psh index 9116997f..6c08ace4 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMap.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMap.psh @@ -1,17 +1,17 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-
-mul r1, c2, t1
-mad r0.rgb, t0, v0, r1
-+ mul r0.a, t0, v0
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map + +mul r1, c2, t1 +mad r0.rgb, t0, v0, r1 ++ mul r0.a, t0, v0 diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapMask.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapMask.psh index f8de572c..d00dca76 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapMask.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapMask.psh @@ -1,19 +1,19 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask
-
-mul r0.rgb, t1, t2 ; can't use mad cause can't use 3 texture registers
-mul r0.rgb, c2, r0 ; apply the envmaptint
-mad r0.rgb, t0, v0, r0
-+ mul r0.a, t0, v0
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask + +mul r0.rgb, t1, t2 ; can't use mad cause can't use 3 texture registers +mul r0.rgb, c2, r0 ; apply the envmaptint +mad r0.rgb, t0, v0, r0 ++ mul r0.a, t0, v0 diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapMaskNoTexture.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapMaskNoTexture.psh index a9bd7e46..87daff55 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapMaskNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapMaskNoTexture.psh @@ -1,17 +1,17 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t1 ; cube map
-tex t2 ; envmap mask
-
-mul r0, t1, t2
-mul r0.rgb, c2, r0
-mul r0, r0, v0
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t1 ; cube map +tex t2 ; envmap mask + +mul r0, t1, t2 +mul r0.rgb, c2, r0 +mul r0, r0, v0 diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapNoTexture.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapNoTexture.psh index 966255fd..4225a9e1 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_EnvMapNoTexture.psh @@ -1,15 +1,15 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c2 - envmaptint
-;------------------------------------------------------------------------------
-
-tex t1 ; cube map
-
-mul r0, v0, t1
-mul r0.rgb, r0, c2
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c2 - envmaptint +;------------------------------------------------------------------------------ + +tex t1 ; cube map + +mul r0, v0, t1 +mul r0.rgb, r0, c2 diff --git a/mp/src/materialsystem/stdshaders/UnlitGeneric_NoTexture.psh b/mp/src/materialsystem/stdshaders/UnlitGeneric_NoTexture.psh index feb29ba6..7e2274d9 100644 --- a/mp/src/materialsystem/stdshaders/UnlitGeneric_NoTexture.psh +++ b/mp/src/materialsystem/stdshaders/UnlitGeneric_NoTexture.psh @@ -1,7 +1,7 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Just use the vertex color
-;------------------------------------------------------------------------------
-
-mov r0, v0
+ps.1.1 + +;------------------------------------------------------------------------------ +; Just use the vertex color +;------------------------------------------------------------------------------ + +mov r0, v0 diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric.psh index 9824a915..5aea47c4 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric.psh @@ -1,13 +1,13 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0
-
-mul r0, t0, c3
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 + +mul r0, t0, c3 +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_BaseAlphaMaskedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_BaseAlphaMaskedEnvMapV2.psh index 1844c402..95b80efc 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_BaseAlphaMaskedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_BaseAlphaMaskedEnvMapV2.psh @@ -1,17 +1,17 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask
-
-mul r0, t0, c3 ; Base times modulation
-mul r1, t1, 1-t2.a ; Envmap * mask (in alpha channel)
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mad r0.rgb, r1, c2, r0 ; + envmap * mask * tint
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
-
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask + +mul r0, t0, c3 ; Base times modulation +mul r1, t1, 1-t2.a ; Envmap * mask (in alpha channel) +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mad r0.rgb, r1, c2, r0 ; + envmap * mask * tint + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif + diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_BlendTint.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_BlendTint.psh index f719821b..e74a5272 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_BlendTint.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_BlendTint.psh @@ -1,17 +1,17 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0
-
-mul r0, c3, t0
-lrp r0.rgb, c1, c3, r0
-lrp r0.rgb, t0.a, r0, t0
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#else
-+mov r0.a, c3
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 + +mul r0, c3, t0 +lrp r0.rgb, c1, c3, r0 +lrp r0.rgb, t0.a, r0, t0 +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#else ++mov r0.a, c3 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail.psh index f42d54ac..cdb39b77 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail.psh @@ -1,16 +1,16 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0
-tex t3
-
-mul r0, t0, c3
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mul_x2 r1.rgb, r0, t3 ; detail texture
-lrp r0.rgb, c1, r1, r0
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 +tex t3 + +mul r0, t0, c3 +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mul_x2 r1.rgb, r0, t3 ; detail texture +lrp r0.rgb, c1, r1, r0 + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailBaseAlphaMaskedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailBaseAlphaMaskedEnvMapV2.psh index 09bf59ca..3a329f20 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailBaseAlphaMaskedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailBaseAlphaMaskedEnvMapV2.psh @@ -1,18 +1,18 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask
-tex t3 ; detail texture
-
-mul r0, t0, c3 ; Base times modulation
-mul r1, t1, 1-t2.a ; Envmap * mask (in alpha channel)
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mul_x2 r0.rgb, r0, t3 ; detail texture
-mad r0.rgb, r1, c2, r0 ; + envmap * mask * tint
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask +tex t3 ; detail texture + +mul r0, t0, c3 ; Base times modulation +mul r1, t1, 1-t2.a ; Envmap * mask (in alpha channel) +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mul_x2 r0.rgb, r0, t3 ; detail texture +mad r0.rgb, r1, c2, r0 ; + envmap * mask * tint + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailEnvMapV2.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailEnvMapV2.psh index 12b2295c..ce9ade83 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailEnvMapV2.psh @@ -1,16 +1,16 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t3 ; detail texture
-
-mul r0, t0, c3 ; base times modulation
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mul_x2 r0.rgb, r0, t3 ; detail texture
-mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +tex t0 ; base color +tex t1 ; cube map +tex t3 ; detail texture + +mul r0, t0, c3 ; base times modulation +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mul_x2 r0.rgb, r0, t3 ; detail texture +mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailMaskedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailMaskedEnvMapV2.psh index ec35a8ba..00945231 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailMaskedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailMaskedEnvMapV2.psh @@ -1,18 +1,18 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask
-tex t3 ; detail texture
-
-mul r0, t0, c3 ; Base times modulation
-mul r1, t1, t2 ; Envmap * mask
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mul_x2 r0.rgb, r0, t3 ; detail texture
-mad r0.rgb, r1, c2, r0 ; + envmap * mask * tint
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask +tex t3 ; detail texture + +mul r0, t0, c3 ; Base times modulation +mul r1, t1, t2 ; Envmap * mask +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mul_x2 r0.rgb, r0, t3 ; detail texture +mad r0.rgb, r1, c2, r0 ; + envmap * mask * tint + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailNoTexture.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailNoTexture.psh index d75a2790..f22d557f 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailNoTexture.psh @@ -1,12 +1,12 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-tex t3
-
-mul r0, v0, c3
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mul_x2 r0.rgb, r0, t3 ; detail texture
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +tex t3 + +mul r0, v0, c3 +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mul_x2 r0.rgb, r0, t3 ; detail texture + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminated.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminated.psh index 4b80e91b..898393ec 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminated.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminated.psh @@ -1,22 +1,22 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0
-tex t3
-
-; interpolate between illuminated + non-selfilluminated
-mul r0.rgb, t0, c3 + ; base times modulation
-mov r0.a, c3.a
-
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul_x2 r0.rgb, r0, t3 ; detail texture
-
-mul r1, t0, c1 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting
-
-#if WRITEONETODESTALPHA
-mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 +tex t3 + +; interpolate between illuminated + non-selfilluminated +mul r0.rgb, t0, c3 + ; base times modulation +mov r0.a, c3.a + +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul_x2 r0.rgb, r0, t3 ; detail texture + +mul r1, t0, c1 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting + +#if WRITEONETODESTALPHA +mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminatedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminatedEnvMapV2.psh index e625791a..42befc1f 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminatedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminatedEnvMapV2.psh @@ -1,24 +1,24 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0
-tex t1
-tex t3
-
-mul r0.rgb, t0, c3 + ; base times modulation
-mov r0.a, c3.a ; use modulation alpha (don't use texture alpha)
-
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul_x2 r0.rgb, r0, t3 ; detail texture
-
-mul r1, t0, c1 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting
-
-mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 +tex t1 +tex t3 + +mul r0.rgb, t0, c3 + ; base times modulation +mov r0.a, c3.a ; use modulation alpha (don't use texture alpha) + +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul_x2 r0.rgb, r0, t3 ; detail texture + +mul r1, t0, c1 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting + +mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminatedMaskedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminatedMaskedEnvMapV2.psh index 119633a9..666acb6d 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminatedMaskedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_DetailSelfIlluminatedMaskedEnvMapV2.psh @@ -1,26 +1,26 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0 ; base
-tex t1 ; env map
-tex t2 ; mask
-tex t3 ; detail
-
-mul r0.rgb, t0, c3 + ; base times modulation
-mul r0.a, c3.a, t2.a ; alpha = mod alpha * mask alpha
-
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul_x2 r0.rgb, r0, t3 ; detail texture
-
-mul r1, t0, c1 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting
-
-mul r1, t2, t1 ; envmapmask * envmap
-mad r0.rgb, r1, c2, r0 ; + envmapmask * envmap * envmaptint (color only)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 ; base +tex t1 ; env map +tex t2 ; mask +tex t3 ; detail + +mul r0.rgb, t0, c3 + ; base times modulation +mul r0.a, c3.a, t2.a ; alpha = mod alpha * mask alpha + +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul_x2 r0.rgb, r0, t3 ; detail texture + +mul r1, t0, c1 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting + +mul r1, t2, t1 ; envmapmask * envmap +mad r0.rgb, r1, c2, r0 ; + envmapmask * envmap * envmaptint (color only) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_LerpBase.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_LerpBase.psh index 7a9ce740..8fcae481 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_LerpBase.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_LerpBase.psh @@ -1,15 +1,15 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0
-tex t3
-
-lrp r0, c1, t3, t0 ; Lerp between textures
-mul r0, r0, c3
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 +tex t3 + +lrp r0, c1, t3, t0 ; Lerp between textures +mul r0, r0, c3 +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_additive.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_additive.psh index 64501f74..586a5c07 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_additive.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_additive.psh @@ -1,15 +1,15 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0
-tex t3
-
-mul r1, c1, t3
-mad r0, t0, c3, r1
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 +tex t3 + +mul r1, c1, t3 +mad r0, t0, c3, r1 +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_additive_selfillum.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_additive_selfillum.psh index 07f9d387..e40041fb 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_additive_selfillum.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_Detail_additive_selfillum.psh @@ -1,15 +1,15 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0
-tex t3
-
-mul r0, c3, t0
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mad r0.rgb, c1, t3, r0
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 +tex t3 + +mul r0, c3, t0 +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mad r0.rgb, c1, t3, r0 + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvMapNoTexture.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvMapNoTexture.psh index 4ce3caca..8e864ab4 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvMapNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvMapNoTexture.psh @@ -1,14 +1,14 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-tex t1 ; cube map
-
-mul r0.rgb, t1, c2 + ; envmap * envmaptint (color only) +
-mov r0.a, c3.a ; Use alpha from modulation... (?)
-
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +tex t1 ; cube map + +mul r0.rgb, t1, c2 + ; envmap * envmaptint (color only) + +mov r0.a, c3.a ; Use alpha from modulation... (?) + +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvMapV2.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvMapV2.psh index 80ef4330..cfc6e67c 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvMapV2.psh @@ -1,14 +1,14 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-tex t0 ; base color
-tex t1 ; cube map
-
-mul r0, t0, c3 ; base times modulation
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +tex t0 ; base color +tex t1 ; cube map + +mul r0, t0, c3 ; base times modulation +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2.psh index e6b0c6e4..7cbd38fc 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2.psh @@ -1,36 +1,36 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Environment mapping on a bumped surface
-; t0 - Normalmap
-; t3 - Cube environment map (*must* be a cube map!)
-;
-; c0 - color to multiply the results by
-; Input texture coords required here are a little wonky.
-; tc0.uv <- U,V into the normal map
-; tc1.uvw, tc2.uvw, tc3.uvw <- 3x3 matrix transform
-; from tangent space->env map space
-; tc1.q, tc2.q, tc3.q <- eye vector in env map space
-;------------------------------------------------------------------------------
-; This version doesn't multiply by lighting.
-
-; Get the 3-vector from the normal map
-tex t0
-
-; Perform matrix multiply to get a local normal bump. Then
-; reflect the eye vector through the normal and sample from
-; a cubic environment map.
-texm3x3pad t1, t0_bx2
-texm3x3pad t2, t0_bx2
-texm3x3vspec t3, t0_bx2
-
-; result goes in output color
-mul r0.rgb, t3, c0 ; constant color
-+mov r0.a, c0.a
-
-mul r1.rgb, r0, r0
-lrp r0.rgb, c1, r1, r0 ; blend between color and color * color
-dp3 r1.rgb, r0, c3
-lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale
-
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Environment mapping on a bumped surface +; t0 - Normalmap +; t3 - Cube environment map (*must* be a cube map!) +; +; c0 - color to multiply the results by +; Input texture coords required here are a little wonky. +; tc0.uv <- U,V into the normal map +; tc1.uvw, tc2.uvw, tc3.uvw <- 3x3 matrix transform +; from tangent space->env map space +; tc1.q, tc2.q, tc3.q <- eye vector in env map space +;------------------------------------------------------------------------------ +; This version doesn't multiply by lighting. + +; Get the 3-vector from the normal map +tex t0 + +; Perform matrix multiply to get a local normal bump. Then +; reflect the eye vector through the normal and sample from +; a cubic environment map. +texm3x3pad t1, t0_bx2 +texm3x3pad t2, t0_bx2 +texm3x3vspec t3, t0_bx2 + +; result goes in output color +mul r0.rgb, t3, c0 ; constant color ++mov r0.a, c0.a + +mul r1.rgb, r0, r0 +lrp r0.rgb, c1, r1, r0 ; blend between color and color * color +dp3 r1.rgb, r0, c3 +lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale + + diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_MultByAlpha.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_MultByAlpha.psh index 9fa7db3e..9b72f0e4 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_MultByAlpha.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_MultByAlpha.psh @@ -1,42 +1,42 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Environment mapping on a bumped surface
-; t0 - Normalmap
-; t3 - Cube environment map (*must* be a cube map!)
-;
-; c0 - color to multiply the results by
-; Input texture coords required here are a little wonky.
-; tc0.uv <- U,V into the normal map
-; tc1.uvw, tc2.uvw, tc3.uvw <- 3x3 matrix transform
-; from tangent space->env map space
-; tc1.q, tc2.q, tc3.q <- eye vector in env map space
-;------------------------------------------------------------------------------
-; This version doesn't multiply by lighting.
-
-; Get the 3-vector from the normal map
-tex t0
-
-; Perform matrix multiply to get a local normal bump. Then
-; reflect the eye vector through the normal and sample from
-; a cubic environment map.
-texm3x3pad t1, t0_bx2
-texm3x3pad t2, t0_bx2
-texm3x3vspec t3, t0_bx2
-
-; result goes in output color
-mul r0.rgb, t3, c0 ; constant color
-+mov r0.a, c0.a
-
-mul r1.rgb, r0, r0
-lrp r0.rgb, c1, r1, r0 ; blend between color and color * color
-dp3 r1.rgb, r0, c3
-lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale
-
-; Multiply the output color by the alpha channel of the normal map.
-mul r0.rgb, t0.a, r0
-
-
-
-
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Environment mapping on a bumped surface +; t0 - Normalmap +; t3 - Cube environment map (*must* be a cube map!) +; +; c0 - color to multiply the results by +; Input texture coords required here are a little wonky. +; tc0.uv <- U,V into the normal map +; tc1.uvw, tc2.uvw, tc3.uvw <- 3x3 matrix transform +; from tangent space->env map space +; tc1.q, tc2.q, tc3.q <- eye vector in env map space +;------------------------------------------------------------------------------ +; This version doesn't multiply by lighting. + +; Get the 3-vector from the normal map +tex t0 + +; Perform matrix multiply to get a local normal bump. Then +; reflect the eye vector through the normal and sample from +; a cubic environment map. +texm3x3pad t1, t0_bx2 +texm3x3pad t2, t0_bx2 +texm3x3vspec t3, t0_bx2 + +; result goes in output color +mul r0.rgb, t3, c0 ; constant color ++mov r0.a, c0.a + +mul r1.rgb, r0, r0 +lrp r0.rgb, c1, r1, r0 ; blend between color and color * color +dp3 r1.rgb, r0, c3 +lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale + +; Multiply the output color by the alpha channel of the normal map. +mul r0.rgb, t0.a, r0 + + + + + diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_MultByAlpha_ps14.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_MultByAlpha_ps14.psh index eac900c9..912143f8 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_MultByAlpha_ps14.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_MultByAlpha_ps14.psh @@ -1,42 +1,42 @@ -ps.1.4
-;------------------------------------------------------------------------------
-; Phase 1
-;------------------------------------------------------------------------------
-; Get the 3-vector from the normal map
-texld r0, t0
-; Get environment matrix
-texcrd r1.rgb, t1
-texcrd r2.rgb, t2
-texcrd r3.rgb, t3
-; Normalize eye-ray vector through normalizer cube map
-texld r4, t4 ; <---- CUBE MAP here!!!
-;mov r0.rgba, r4
-
-; Transform normal
-dp3 r5.r, r1, r0_bx2
-dp3 r5.g, r2, r0_bx2
-dp3 r5.b, r3, r0_bx2
-; Reflection calculatiom
-dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye)
-mul r3.rgb, r5, r3 ; 2N(N.Eye)
-dp3 r2.rgb, r5, r5 ; N.N
-mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N)
-; Alpha gets lost after phase marker, so store it here
-mov r5, r0.a
-;------------------------------------------------------------------------------
-; Phase 2
-;------------------------------------------------------------------------------
-phase
-; Sample environment map
-texld r3, r2
-; Result goes in output color (multiply by constant color c0)
-mul r0.rgb, r3, c0
-+mov r0.a, c0.a
-
-mul r1.rgb, r0, r0
-lrp r0.rgb, c1, r1, r0 ; blend between color and color * color
-dp3 r1.rgb, r0, c3
-lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale
-
-; mult by alpha
-mul r0.rgb, r0, r5
+ps.1.4 +;------------------------------------------------------------------------------ +; Phase 1 +;------------------------------------------------------------------------------ +; Get the 3-vector from the normal map +texld r0, t0 +; Get environment matrix +texcrd r1.rgb, t1 +texcrd r2.rgb, t2 +texcrd r3.rgb, t3 +; Normalize eye-ray vector through normalizer cube map +texld r4, t4 ; <---- CUBE MAP here!!! +;mov r0.rgba, r4 + +; Transform normal +dp3 r5.r, r1, r0_bx2 +dp3 r5.g, r2, r0_bx2 +dp3 r5.b, r3, r0_bx2 +; Reflection calculatiom +dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye) +mul r3.rgb, r5, r3 ; 2N(N.Eye) +dp3 r2.rgb, r5, r5 ; N.N +mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N) +; Alpha gets lost after phase marker, so store it here +mov r5, r0.a +;------------------------------------------------------------------------------ +; Phase 2 +;------------------------------------------------------------------------------ +phase +; Sample environment map +texld r3, r2 +; Result goes in output color (multiply by constant color c0) +mul r0.rgb, r3, c0 ++mov r0.a, c0.a + +mul r1.rgb, r0, r0 +lrp r0.rgb, c1, r1, r0 ; blend between color and color * color +dp3 r1.rgb, r0, c3 +lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale + +; mult by alpha +mul r0.rgb, r0, r5 diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_ps14.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_ps14.psh index 7c88013f..7dec5f7d 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_ps14.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_EnvmappedBumpmapV2_ps14.psh @@ -1,39 +1,39 @@ -ps.1.4
-;------------------------------------------------------------------------------
-; Phase 1
-;------------------------------------------------------------------------------
-; Get the 3-vector from the normal map
-texld r0, t0
-; Get environment matrix
-texcrd r1.rgb, t1
-texcrd r2.rgb, t2
-texcrd r3.rgb, t3
-; Normalize eye-ray vector through normalizer cube map
-texld r4, t4 ; <---- CUBE MAP here!!!
-
-; Transform normal
-dp3 r5.r, r1, r0_bx2
-dp3 r5.g, r2, r0_bx2
-dp3 r5.b, r3, r0_bx2
-; Reflection calculatiom
-dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye)
-mul r3.rgb, r5, r3 ; 2N(N.Eye)
-dp3 r2.rgb, r5, r5 ; N.N
-mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N)
-; Alpha gets lost after phase marker, so store it here
-mov r5, r0.a
-;------------------------------------------------------------------------------
-; Phase 2
-;------------------------------------------------------------------------------
-phase
-; Sample environment map
-texld r3, r2
-; Result goes in output color (multiply by constant color c0)
-mul r0.rgb, r3, c0
-+mov r0.a, c0.a
-
-mul r1.rgb, r0, r0
-lrp r0.rgb, c1, r1, r0 ; blend between color and color * color
-dp3 r1.rgb, r0, c3
-lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale
-
+ps.1.4 +;------------------------------------------------------------------------------ +; Phase 1 +;------------------------------------------------------------------------------ +; Get the 3-vector from the normal map +texld r0, t0 +; Get environment matrix +texcrd r1.rgb, t1 +texcrd r2.rgb, t2 +texcrd r3.rgb, t3 +; Normalize eye-ray vector through normalizer cube map +texld r4, t4 ; <---- CUBE MAP here!!! + +; Transform normal +dp3 r5.r, r1, r0_bx2 +dp3 r5.g, r2, r0_bx2 +dp3 r5.b, r3, r0_bx2 +; Reflection calculatiom +dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye) +mul r3.rgb, r5, r3 ; 2N(N.Eye) +dp3 r2.rgb, r5, r5 ; N.N +mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N) +; Alpha gets lost after phase marker, so store it here +mov r5, r0.a +;------------------------------------------------------------------------------ +; Phase 2 +;------------------------------------------------------------------------------ +phase +; Sample environment map +texld r3, r2 +; Result goes in output color (multiply by constant color c0) +mul r0.rgb, r3, c0 ++mov r0.a, c0.a + +mul r1.rgb, r0, r0 +lrp r0.rgb, c1, r1, r0 ; blend between color and color * color +dp3 r1.rgb, r0, c3 +lrp r0.rgb, c2, r0, r1 ; blend between color and greyscale + diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_MaskedEnvMapNoTexture.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_MaskedEnvMapNoTexture.psh index 4c65d906..a6209ab3 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_MaskedEnvMapNoTexture.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_MaskedEnvMapNoTexture.psh @@ -1,15 +1,15 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-tex t1 ; cube map
-tex t2 ; envmap mask
-
-mul r1, t1, t2 ; Envmap * mask
-mul r0.rgb, r1, c2 ; envmap * mask * tint
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 + ; * 2 * (overbrightFactor/2)
-mul r0.a, c3.a, t2.a ; alpha = modulation * mask alpha
-
-#if WRITEONETODESTALPHA
-mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +tex t1 ; cube map +tex t2 ; envmap mask + +mul r1, t1, t2 ; Envmap * mask +mul r0.rgb, r1, c2 ; envmap * mask * tint +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 + ; * 2 * (overbrightFactor/2) +mul r0.a, c3.a, t2.a ; alpha = modulation * mask alpha + +#if WRITEONETODESTALPHA +mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_MaskedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_MaskedEnvMapV2.psh index ffa3f1e0..53519d93 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_MaskedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_MaskedEnvMapV2.psh @@ -1,16 +1,16 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask
-
-mul r0, t0, c3 ; Base times modulation
-mul r1, t1, t2 ; Envmap * mask
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-mad r0.rgb, r1, c2, r0 ; + envmap * mask * tint
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask + +mul r0, t0, c3 ; Base times modulation +mul r1, t1, t2 ; Envmap * mask +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) +mad r0.rgb, r1, c2, r0 ; + envmap * mask * tint + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_NoTexture.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_NoTexture.psh index b98b9396..0bc2e455 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_NoTexture.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_NoTexture.psh @@ -1,9 +1,9 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-mul r0, v0, c3
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +mul r0, v0, c3 +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIllumOnly.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIllumOnly.psh index 86710123..198ad9e4 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIllumOnly.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIllumOnly.psh @@ -1,5 +1,5 @@ -ps.1.1
-
-tex t0
-
-mul r0.rgba, c0, t0
+ps.1.1 + +tex t0 + +mul r0.rgba, c0, t0 diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminated.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminated.psh index c837e9af..3d14e4b3 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminated.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminated.psh @@ -1,19 +1,19 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0
-
-; interpolate between illuminated + non-selfilluminated
-mul r0.rgb, t0, c3 + ; base times modulation
-mov r0.a, c3.a
-
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1, t0, c1 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 + +; interpolate between illuminated + non-selfilluminated +mul r0.rgb, t0, c3 + ; base times modulation +mov r0.a, c3.a + +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1, t0, c1 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminatedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminatedEnvMapV2.psh index 2d280f5c..b8ba4d13 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminatedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminatedEnvMapV2.psh @@ -1,21 +1,21 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0
-tex t1
-
-mul r0.rgb, t0, c3 + ; base times modulation
-mov r0.a, c3.a ; use modulation alpha (don't use texture alpha)
-
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1, t0, c1 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting
-
-mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 +tex t1 + +mul r0.rgb, t0, c3 + ; base times modulation +mov r0.a, c3.a ; use modulation alpha (don't use texture alpha) + +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1, t0, c1 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting + +mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminatedMaskedEnvMapV2.psh b/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminatedMaskedEnvMapV2.psh index da6b77c3..44fe15d6 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminatedMaskedEnvMapV2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitGeneric_SelfIlluminatedMaskedEnvMapV2.psh @@ -1,23 +1,23 @@ -; DYNAMIC: "WRITEONETODESTALPHA" "0..1"
-ps.1.1
-
-; Get the color from the texture
-tex t0 ; base
-tex t1 ; env map
-tex t2 ; mask
-
-mul r0.rgb, t0, c3 + ; base times modulation
-mul r0.a, c3.a, t2.a ; alpha = mod alpha * mask alpha
-
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1, t0, c1 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting
-
-mul r1, t2, t1 ; envmapmask * envmap
-mad r0.rgb, r1, c2, r0 ; + envmapmask * envmap * envmaptint (color only)
-
-#if WRITEONETODESTALPHA
-+mov r0.a, c4 ; make alpha 255
-#endif
+; DYNAMIC: "WRITEONETODESTALPHA" "0..1" +ps.1.1 + +; Get the color from the texture +tex t0 ; base +tex t1 ; env map +tex t2 ; mask + +mul r0.rgb, t0, c3 + ; base times modulation +mul r0.a, c3.a, t2.a ; alpha = mod alpha * mask alpha + +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1, t0, c1 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting + +mul r1, t2, t1 ; envmapmask * envmap +mad r0.rgb, r1, c2, r0 ; + envmapmask * envmap * envmaptint (color only) + +#if WRITEONETODESTALPHA ++mov r0.a, c4 ; make alpha 255 +#endif diff --git a/mp/src/materialsystem/stdshaders/VertexLitTexture.psh b/mp/src/materialsystem/stdshaders/VertexLitTexture.psh index 7a692c92..628cfc66 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitTexture.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitTexture.psh @@ -1,15 +1,15 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-; Get the color from the texture
-tex t0
-
-mul r0, t0, v0
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +; Get the color from the texture +tex t0 + +mul r0, t0, v0 + diff --git a/mp/src/materialsystem/stdshaders/VertexLitTexture_Overbright2.psh b/mp/src/materialsystem/stdshaders/VertexLitTexture_Overbright2.psh index a69250bf..db2c4e2f 100644 --- a/mp/src/materialsystem/stdshaders/VertexLitTexture_Overbright2.psh +++ b/mp/src/materialsystem/stdshaders/VertexLitTexture_Overbright2.psh @@ -1,16 +1,16 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-; Get the color from the texture
-tex t0
-
-mul_x2 r0.rgb, t0, v0
-+ mul r0.a, t0, v0
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +; Get the color from the texture +tex t0 + +mul_x2 r0.rgb, t0, v0 ++ mul r0.a, t0, v0 + diff --git a/mp/src/materialsystem/stdshaders/WaterCheapFresnelOpaque_ps14.psh b/mp/src/materialsystem/stdshaders/WaterCheapFresnelOpaque_ps14.psh index 08438dcb..2aff6a46 100644 --- a/mp/src/materialsystem/stdshaders/WaterCheapFresnelOpaque_ps14.psh +++ b/mp/src/materialsystem/stdshaders/WaterCheapFresnelOpaque_ps14.psh @@ -1,40 +1,40 @@ -ps.1.4
-
-; Get the 3-vector from the normal map
-texld r0, t0
-; Get environment matrix
-texcrd r1.rgb, t1
-texcrd r2.rgb, t2
-texcrd r3.rgb, t3
-; Normalize eye-ray vector through normalizer cube map
-texld r4, t4 ; <---- CUBE MAP here!!!
-
-; Transform normal
-dp3 r5.r, r1, r0_bx2
-dp3 r5.g, r2, r0_bx2
-dp3 r5.b, r3, r0_bx2
-; Reflection calculatiom
-dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye)
-mul r3.rgb, r5, r3 ; 2N(N.Eye)
-dp3 r2.rgb, r5, r5 ; N.N
-mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N)
-
-phase
-
-; Sample environment map
-texld r3, r2
-texld r4, t5 ; Normalize the tangent-space eye vector
-
-; dot eye-vector with per-pixel normal from r0
-dp3_sat r1, r4_bx2, r0_bx2
-
-; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel
-mul r0.a, 1-r1.a, 1-r1.a ; squared
-mul r0.a, r0.a, r0.a ; quartic
-mul_sat r1.a, r0.a, 1-r1.a ; quintic
-
-; multiply color by reflecttint
-mul r0, r3, c1
-
-; blend between reflected color and fog color based on fresnel
+ps.1.4 + +; Get the 3-vector from the normal map +texld r0, t0 +; Get environment matrix +texcrd r1.rgb, t1 +texcrd r2.rgb, t2 +texcrd r3.rgb, t3 +; Normalize eye-ray vector through normalizer cube map +texld r4, t4 ; <---- CUBE MAP here!!! + +; Transform normal +dp3 r5.r, r1, r0_bx2 +dp3 r5.g, r2, r0_bx2 +dp3 r5.b, r3, r0_bx2 +; Reflection calculatiom +dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye) +mul r3.rgb, r5, r3 ; 2N(N.Eye) +dp3 r2.rgb, r5, r5 ; N.N +mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N) + +phase + +; Sample environment map +texld r3, r2 +texld r4, t5 ; Normalize the tangent-space eye vector + +; dot eye-vector with per-pixel normal from r0 +dp3_sat r1, r4_bx2, r0_bx2 + +; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel +mul r0.a, 1-r1.a, 1-r1.a ; squared +mul r0.a, r0.a, r0.a ; quartic +mul_sat r1.a, r0.a, 1-r1.a ; quintic + +; multiply color by reflecttint +mul r0, r3, c1 + +; blend between reflected color and fog color based on fresnel lrp r0.rgb, r1.a, r0, c0
\ No newline at end of file diff --git a/mp/src/materialsystem/stdshaders/WaterCheapFresnel_ps14.psh b/mp/src/materialsystem/stdshaders/WaterCheapFresnel_ps14.psh index 5ebb39f4..741881be 100644 --- a/mp/src/materialsystem/stdshaders/WaterCheapFresnel_ps14.psh +++ b/mp/src/materialsystem/stdshaders/WaterCheapFresnel_ps14.psh @@ -1,39 +1,39 @@ -ps.1.4
-
-; Get the 3-vector from the normal map
-texld r0, t0
-; Get environment matrix
-texcrd r1.rgb, t1
-texcrd r2.rgb, t2
-texcrd r3.rgb, t3
-; Normalize eye-ray vector through normalizer cube map
-texld r4, t4 ; <---- CUBE MAP here!!!
-
-; Transform normal
-dp3 r5.r, r1, r0_bx2
-dp3 r5.g, r2, r0_bx2
-dp3 r5.b, r3, r0_bx2
-; Reflection calculatiom
-dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye)
-mul r3.rgb, r5, r3 ; 2N(N.Eye)
-dp3 r2.rgb, r5, r5 ; N.N
-mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N)
-
-phase
-
-; Sample environment map
-texld r3, r2
-texld r4, t5 ; Normalize the tangent-space eye vector
-
-; dot eye-vector with per-pixel normal from r0
-dp3_sat r1, r4_bx2, r0_bx2
-
-; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel
-mul r0.a, 1-r1.a, 1-r1.a ; squared
-mul r0.a, r0.a, r0.a ; quartic
-mul_sat r1.a, r0.a, 1-r1.a ; quintic
-
-; multiply color by reflecttint
-mul r0.rgb, r3, c1
-+mov_sat r0.a, v0.a
-add_sat r0.a, r1.a, r0.a
+ps.1.4 + +; Get the 3-vector from the normal map +texld r0, t0 +; Get environment matrix +texcrd r1.rgb, t1 +texcrd r2.rgb, t2 +texcrd r3.rgb, t3 +; Normalize eye-ray vector through normalizer cube map +texld r4, t4 ; <---- CUBE MAP here!!! + +; Transform normal +dp3 r5.r, r1, r0_bx2 +dp3 r5.g, r2, r0_bx2 +dp3 r5.b, r3, r0_bx2 +; Reflection calculatiom +dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye) +mul r3.rgb, r5, r3 ; 2N(N.Eye) +dp3 r2.rgb, r5, r5 ; N.N +mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N) + +phase + +; Sample environment map +texld r3, r2 +texld r4, t5 ; Normalize the tangent-space eye vector + +; dot eye-vector with per-pixel normal from r0 +dp3_sat r1, r4_bx2, r0_bx2 + +; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel +mul r0.a, 1-r1.a, 1-r1.a ; squared +mul r0.a, r0.a, r0.a ; quartic +mul_sat r1.a, r0.a, 1-r1.a ; quintic + +; multiply color by reflecttint +mul r0.rgb, r3, c1 ++mov_sat r0.a, v0.a +add_sat r0.a, r1.a, r0.a diff --git a/mp/src/materialsystem/stdshaders/WaterCheapNoFresnelOpaque_ps11.psh b/mp/src/materialsystem/stdshaders/WaterCheapNoFresnelOpaque_ps11.psh index 60502016..c1a28c10 100644 --- a/mp/src/materialsystem/stdshaders/WaterCheapNoFresnelOpaque_ps11.psh +++ b/mp/src/materialsystem/stdshaders/WaterCheapNoFresnelOpaque_ps11.psh @@ -1,19 +1,19 @@ -ps.1.1
-
-; Get the 3-vector from the normal map
-tex t0
-
-; Perform matrix multiply to get a local normal bump. Then
-; reflect the eye vector through the normal and sample from
-; a cubic environment map.
-texm3x3pad t1, t0_bx2
-texm3x3pad t2, t0_bx2
-texm3x3vspec t3, t0_bx2
-
-mul r0, t3, c1 ; multiply color by reflecttint
-lrp r0.rgb, c1.a, r0, c0 ; blend between reflected color and fog color based on constant factor
-
-
-
-
-
+ps.1.1 + +; Get the 3-vector from the normal map +tex t0 + +; Perform matrix multiply to get a local normal bump. Then +; reflect the eye vector through the normal and sample from +; a cubic environment map. +texm3x3pad t1, t0_bx2 +texm3x3pad t2, t0_bx2 +texm3x3vspec t3, t0_bx2 + +mul r0, t3, c1 ; multiply color by reflecttint +lrp r0.rgb, c1.a, r0, c0 ; blend between reflected color and fog color based on constant factor + + + + + diff --git a/mp/src/materialsystem/stdshaders/WaterCheapNoFresnel_ps11.psh b/mp/src/materialsystem/stdshaders/WaterCheapNoFresnel_ps11.psh index fe76d772..d63151bb 100644 --- a/mp/src/materialsystem/stdshaders/WaterCheapNoFresnel_ps11.psh +++ b/mp/src/materialsystem/stdshaders/WaterCheapNoFresnel_ps11.psh @@ -1,18 +1,18 @@ -ps.1.1
-
-; Get the 3-vector from the normal map
-tex t0
-
-; Perform matrix multiply to get a local normal bump. Then
-; reflect the eye vector through the normal and sample from
-; a cubic environment map.
-texm3x3pad t1, t0_bx2
-texm3x3pad t2, t0_bx2
-texm3x3vspec t3, t0_bx2
-
-mul r0.rgb, t3, c1 ; multiply color by reflecttint
-+mov_sat r0.a, v0.a ; NOTE: This is necessary since v0.a can be outside 0 - 1!
-add_sat r0.a, c1.a, r0.a ; cheap water blend factor + constant blend factor
-
-
-
+ps.1.1 + +; Get the 3-vector from the normal map +tex t0 + +; Perform matrix multiply to get a local normal bump. Then +; reflect the eye vector through the normal and sample from +; a cubic environment map. +texm3x3pad t1, t0_bx2 +texm3x3pad t2, t0_bx2 +texm3x3vspec t3, t0_bx2 + +mul r0.rgb, t3, c1 ; multiply color by reflecttint ++mov_sat r0.a, v0.a ; NOTE: This is necessary since v0.a can be outside 0 - 1! +add_sat r0.a, c1.a, r0.a ; cheap water blend factor + constant blend factor + + + diff --git a/mp/src/materialsystem/stdshaders/WaterCheapOpaque_ps11.psh b/mp/src/materialsystem/stdshaders/WaterCheapOpaque_ps11.psh index 50d7f803..9704bfde 100644 --- a/mp/src/materialsystem/stdshaders/WaterCheapOpaque_ps11.psh +++ b/mp/src/materialsystem/stdshaders/WaterCheapOpaque_ps11.psh @@ -1,26 +1,26 @@ -ps.1.1
-
-; Get the 3-vector from the normal map
-tex t0
-
-; Perform matrix multiply to get a local normal bump. Then
-; reflect the eye vector through the normal and sample from
-; a cubic environment map.
-texm3x3pad t1, t0_bx2
-texm3x3pad t2, t0_bx2
-texm3x3vspec t3, t0_bx2
-
-mul r0, t3, c1 ; envmap color * envmaptint
-
-dp3_sat t2, v0_bx2, t0_bx2 ; dot eye-vector with per-pixel normal from t0
-
-; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel
-; NOTE: This is not perspective-correct and results in strange artifacts
-mul r1.a, 1-t2.a, 1-t2.a ; squared
-mul r1.a, r1.a, r1.a ; quartic
-mul_sat r1.a, r1.a, 1-t2.a ; quintic
-
-; t1.a is now the fresnel factor
-lrp r0.rgb, r1.a, r0, c0 ; blend between reflected color and fog color based on fresnel
-
-
+ps.1.1 + +; Get the 3-vector from the normal map +tex t0 + +; Perform matrix multiply to get a local normal bump. Then +; reflect the eye vector through the normal and sample from +; a cubic environment map. +texm3x3pad t1, t0_bx2 +texm3x3pad t2, t0_bx2 +texm3x3vspec t3, t0_bx2 + +mul r0, t3, c1 ; envmap color * envmaptint + +dp3_sat t2, v0_bx2, t0_bx2 ; dot eye-vector with per-pixel normal from t0 + +; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel +; NOTE: This is not perspective-correct and results in strange artifacts +mul r1.a, 1-t2.a, 1-t2.a ; squared +mul r1.a, r1.a, r1.a ; quartic +mul_sat r1.a, r1.a, 1-t2.a ; quintic + +; t1.a is now the fresnel factor +lrp r0.rgb, r1.a, r0, c0 ; blend between reflected color and fog color based on fresnel + + diff --git a/mp/src/materialsystem/stdshaders/WaterCheapOpaque_ps14.psh b/mp/src/materialsystem/stdshaders/WaterCheapOpaque_ps14.psh index bd491d58..a1b52625 100644 --- a/mp/src/materialsystem/stdshaders/WaterCheapOpaque_ps14.psh +++ b/mp/src/materialsystem/stdshaders/WaterCheapOpaque_ps14.psh @@ -1,31 +1,31 @@ -ps.1.4
-
-; Get the 3-vector from the normal map
-texld r0, t0
-; Get environment matrix
-texcrd r1.rgb, t1
-texcrd r2.rgb, t2
-texcrd r3.rgb, t3
-; Normalize eye-ray vector through normalizer cube map
-texld r4, t4 ; <---- CUBE MAP here!!!
-
-; Transform normal
-dp3 r5.r, r1, r0_bx2
-dp3 r5.g, r2, r0_bx2
-dp3 r5.b, r3, r0_bx2
-; Reflection calculatiom
-dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye)
-mul r3.rgb, r5, r3 ; 2N(N.Eye)
-dp3 r2.rgb, r5, r5 ; N.N
-mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N)
-
-phase
-
-; Sample environment map
-texld r3, r2
-
-; multiply color by reflecttint
-mul r0, r3, c1
-
-; blend between reflected color and fog color based on constant factor
-lrp r0.rgb, c1.a, r0, c0
+ps.1.4 + +; Get the 3-vector from the normal map +texld r0, t0 +; Get environment matrix +texcrd r1.rgb, t1 +texcrd r2.rgb, t2 +texcrd r3.rgb, t3 +; Normalize eye-ray vector through normalizer cube map +texld r4, t4 ; <---- CUBE MAP here!!! + +; Transform normal +dp3 r5.r, r1, r0_bx2 +dp3 r5.g, r2, r0_bx2 +dp3 r5.b, r3, r0_bx2 +; Reflection calculatiom +dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye) +mul r3.rgb, r5, r3 ; 2N(N.Eye) +dp3 r2.rgb, r5, r5 ; N.N +mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N) + +phase + +; Sample environment map +texld r3, r2 + +; multiply color by reflecttint +mul r0, r3, c1 + +; blend between reflected color and fog color based on constant factor +lrp r0.rgb, c1.a, r0, c0 diff --git a/mp/src/materialsystem/stdshaders/WaterCheap_ps11.psh b/mp/src/materialsystem/stdshaders/WaterCheap_ps11.psh index 34178d28..f12a1bc4 100644 --- a/mp/src/materialsystem/stdshaders/WaterCheap_ps11.psh +++ b/mp/src/materialsystem/stdshaders/WaterCheap_ps11.psh @@ -1,26 +1,26 @@ -ps.1.1
-
-; Get the 3-vector from the normal map
-tex t0
-
-; Perform matrix multiply to get a local normal bump. Then
-; reflect the eye vector through the normal and sample from
-; a cubic environment map.
-texm3x3pad t1, t0_bx2
-texm3x3pad t2, t0_bx2
-texm3x3vspec t3, t0_bx2
-
-mul r0.rgb, t3, c1 ; envmap color * envmaptint
-+mov_sat r0.a, v0.a ; Put the cheap water blend factor here
-
-dp3_sat t2, v0_bx2, t0_bx2 ; dot eye-vector with per-pixel normal from t0
-
-; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel
-; NOTE: This is not perspective-correct and results in strange artifacts
-mul r1.a, 1-t2.a, 1-t2.a ; squared
-mul r1.a, r1.a, r1.a ; quartic
-mul_sat r1.a, r1.a, 1-t2.a ; quintic
-
-; t1.a is now the fresnel factor
-add_sat r0.a, r1.a, r0.a ; Now we have the final blend factor between cheap water + refraction
-
+ps.1.1 + +; Get the 3-vector from the normal map +tex t0 + +; Perform matrix multiply to get a local normal bump. Then +; reflect the eye vector through the normal and sample from +; a cubic environment map. +texm3x3pad t1, t0_bx2 +texm3x3pad t2, t0_bx2 +texm3x3vspec t3, t0_bx2 + +mul r0.rgb, t3, c1 ; envmap color * envmaptint ++mov_sat r0.a, v0.a ; Put the cheap water blend factor here + +dp3_sat t2, v0_bx2, t0_bx2 ; dot eye-vector with per-pixel normal from t0 + +; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 in alpha channel +; NOTE: This is not perspective-correct and results in strange artifacts +mul r1.a, 1-t2.a, 1-t2.a ; squared +mul r1.a, r1.a, r1.a ; quartic +mul_sat r1.a, r1.a, 1-t2.a ; quintic + +; t1.a is now the fresnel factor +add_sat r0.a, r1.a, r0.a ; Now we have the final blend factor between cheap water + refraction + diff --git a/mp/src/materialsystem/stdshaders/WaterCheap_ps14.psh b/mp/src/materialsystem/stdshaders/WaterCheap_ps14.psh index 2c452539..e38f65ee 100644 --- a/mp/src/materialsystem/stdshaders/WaterCheap_ps14.psh +++ b/mp/src/materialsystem/stdshaders/WaterCheap_ps14.psh @@ -1,30 +1,30 @@ -ps.1.4
-
-; Get the 3-vector from the normal map
-texld r0, t0
-; Get environment matrix
-texcrd r1.rgb, t1
-texcrd r2.rgb, t2
-texcrd r3.rgb, t3
-; Normalize eye-ray vector through normalizer cube map
-texld r4, t4 ; <---- CUBE MAP here!!!
-
-; Transform normal
-dp3 r5.r, r1, r0_bx2
-dp3 r5.g, r2, r0_bx2
-dp3 r5.b, r3, r0_bx2
-; Reflection calculatiom
-dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye)
-mul r3.rgb, r5, r3 ; 2N(N.Eye)
-dp3 r2.rgb, r5, r5 ; N.N
-mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N)
-
-phase
-
-; Sample environment map
-texld r3, r2
-
-; multiply color by reflecttint
-mul r0.rgb, r3, c1
-+mov_sat r0.a, v0.a ; Necessary since v0.a may be negative
-add_sat r0.a, c1.a, r0.a
+ps.1.4 + +; Get the 3-vector from the normal map +texld r0, t0 +; Get environment matrix +texcrd r1.rgb, t1 +texcrd r2.rgb, t2 +texcrd r3.rgb, t3 +; Normalize eye-ray vector through normalizer cube map +texld r4, t4 ; <---- CUBE MAP here!!! + +; Transform normal +dp3 r5.r, r1, r0_bx2 +dp3 r5.g, r2, r0_bx2 +dp3 r5.b, r3, r0_bx2 +; Reflection calculatiom +dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye) +mul r3.rgb, r5, r3 ; 2N(N.Eye) +dp3 r2.rgb, r5, r5 ; N.N +mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N) + +phase + +; Sample environment map +texld r3, r2 + +; multiply color by reflecttint +mul r0.rgb, r3, c1 ++mov_sat r0.a, v0.a ; Necessary since v0.a may be negative +add_sat r0.a, c1.a, r0.a diff --git a/mp/src/materialsystem/stdshaders/WaterReflect_ps11.psh b/mp/src/materialsystem/stdshaders/WaterReflect_ps11.psh index d31ab49c..785ced64 100644 --- a/mp/src/materialsystem/stdshaders/WaterReflect_ps11.psh +++ b/mp/src/materialsystem/stdshaders/WaterReflect_ps11.psh @@ -1,27 +1,27 @@ -ps.1.1
-
-; t0:
-; texture: dudv map
-; texcoords: dudvmap texcoords
-; t1:
-; texture: reflection render target
-; texcoords:
-; t2:
-; texture: normal map (usef for fresnel calculation)
-; texcoords:
-; t4: texture: normalization cube map
-; texcoords: eye vect
-
-tex t0 ; sample dudv map
-texbem t1, t0 ; reflection
-tex t2 ; normal map
-tex t3 ; eye vector (through normalization cubemap)
-
-; dot eye-vector with per-pixel normal from t2
-dp3_sat r1.rgba, t3_bx2, t2_bx2
-
-; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5
-mul r0.a, 1-r1.a, 1-r1.a // squared
-mul r0.a, r0.a, r0.a // quartic
-mul r0.rgb, t1, c0 // shove color from reflection render target into r0
+ps.1.1 + +; t0: +; texture: dudv map +; texcoords: dudvmap texcoords +; t1: +; texture: reflection render target +; texcoords: +; t2: +; texture: normal map (usef for fresnel calculation) +; texcoords: +; t4: texture: normalization cube map +; texcoords: eye vect + +tex t0 ; sample dudv map +texbem t1, t0 ; reflection +tex t2 ; normal map +tex t3 ; eye vector (through normalization cubemap) + +; dot eye-vector with per-pixel normal from t2 +dp3_sat r1.rgba, t3_bx2, t2_bx2 + +; run Fresnel approx. on it: R0 + (1-R0) (1-cos(q))^5 +mul r0.a, 1-r1.a, 1-r1.a // squared +mul r0.a, r0.a, r0.a // quartic +mul r0.rgb, t1, c0 // shove color from reflection render target into r0 +mul_sat r0.a, r0.a, 1-r1.a // quintic
\ No newline at end of file diff --git a/mp/src/materialsystem/stdshaders/WaterRefractFresnel_ps11.psh b/mp/src/materialsystem/stdshaders/WaterRefractFresnel_ps11.psh index 88d1f8dc..efade0f9 100644 --- a/mp/src/materialsystem/stdshaders/WaterRefractFresnel_ps11.psh +++ b/mp/src/materialsystem/stdshaders/WaterRefractFresnel_ps11.psh @@ -1,24 +1,24 @@ -ps.1.1
-
-; t0:
-; texture: dudv map
-; texcoords: dudvmap texcoords
-; t1:
-; texture: refraction render target
-; texcoords:
-
-tex t0 ; sample dudv map
-texbem t1, t0 ; refraction
-tex t2 ; The normal map
-tex t3 ; Normalize the tangent-space vector to the eye
-
-; dot eye-vector with per-pixel normal from t2
-dp3_sat r1.rgba, t2_bx2, t3_bx2
-
-mul r0.a, 1-r1.a, 1-r1.a ; squared
-mul r0.a, r0.a, r0.a ; quartic
-
-mul r0.rgb, t1, c0
-+mul_sat r0.a, r0.a, 1-r1.a ; quintic
-
-add_sat r0.a, r0.a, v0.a ; cheap water distance
+ps.1.1 + +; t0: +; texture: dudv map +; texcoords: dudvmap texcoords +; t1: +; texture: refraction render target +; texcoords: + +tex t0 ; sample dudv map +texbem t1, t0 ; refraction +tex t2 ; The normal map +tex t3 ; Normalize the tangent-space vector to the eye + +; dot eye-vector with per-pixel normal from t2 +dp3_sat r1.rgba, t2_bx2, t3_bx2 + +mul r0.a, 1-r1.a, 1-r1.a ; squared +mul r0.a, r0.a, r0.a ; quartic + +mul r0.rgb, t1, c0 ++mul_sat r0.a, r0.a, 1-r1.a ; quintic + +add_sat r0.a, r0.a, v0.a ; cheap water distance diff --git a/mp/src/materialsystem/stdshaders/WaterRefract_ps11.psh b/mp/src/materialsystem/stdshaders/WaterRefract_ps11.psh index 7e3ee733..fbe75475 100644 --- a/mp/src/materialsystem/stdshaders/WaterRefract_ps11.psh +++ b/mp/src/materialsystem/stdshaders/WaterRefract_ps11.psh @@ -1,13 +1,13 @@ -ps.1.1
-
-; t0:
-; texture: dudv map
-; texcoords: dudvmap texcoords
-; t1:
-; texture: refraction render target
-; texcoords:
-
-tex t0 ; sample dudv map
-texbem t1, t0 ; refraction
-
-mul r0, t1, c0
+ps.1.1 + +; t0: +; texture: dudv map +; texcoords: dudvmap texcoords +; t1: +; texture: refraction render target +; texcoords: + +tex t0 ; sample dudv map +texbem t1, t0 ; refraction + +mul r0, t1, c0 diff --git a/mp/src/materialsystem/stdshaders/Water_ps14.psh b/mp/src/materialsystem/stdshaders/Water_ps14.psh index e9daecd1..55e6b0ce 100644 --- a/mp/src/materialsystem/stdshaders/Water_ps14.psh +++ b/mp/src/materialsystem/stdshaders/Water_ps14.psh @@ -1,96 +1,96 @@ -; STATIC: "REFLECT" "0..1"
-; STATIC: "REFRACT" "0..1"
-ps.1.4
-; T2 - refraction
-; T3 - normal map
-; T4 - reflection
-; TC0 - normal map coords
-; TC1 - proj tex coords (reflection)
-; TC2 - proj tex coords (refraction)
-; TC3 - tangent space view vec
-; TC4 - displacement scale
-
-; sample normal map
-texld r3, t0
-
-#if REFLECT
-; reflection coords
-texcrd r4.xy, t1_dw.xyw
-#endif
-#if REFRACT
-; refraction coords
-texcrd r2.xy, t2_dw.xyw
-#endif
-; tangent space eye vector
-texld r1, t5 ; <---- Normalizing CUBE MAP here!!!
-; reflection/refraction scale (x,y)
-texcrd r0.xyz, t4.xyz
-
-; perturb coords by constant displacement
-; and by normal map alpha (which has 1/(2**miplevel in it)
-mul r0.rg, r0, r3.a
-#if REFLECT
-mad r4.rg, r3_bx2, r0.x, r4
-#endif
-
-#if REFRACT
-mad r2.rg, r3_bx2, r0.y, r2
-#endif
-
-; stuff something into z so that texld will deal
-#if REFLECT
-mov r4.b, c5
-#endif
-#if REFRACT
-mov r2.b, c5
-#endif
-
-phase
-
-#if REFLECT
-; reflection
-texld r4, r4
-#endif
-#if REFRACT
-; refraction
-texld r2, r2
-#endif
-
-#if REFLECT
-; N.V
-dp3_sat r1.a, r3_bx2, r1_bx2
-#endif
-
-#if REFRACT
-; tint refraction
-mul r2.rgb, r2, c1
-#endif
-
-#if REFLECT
-; tint reflction
-mul r4.rgb, r4, c4
-
-; (1-N.V) ^ 5
-+mul r0.a, 1-r1.a, 1-r1.a
-mul r0.a, r0.a, r0.a
-mul_sat r0.a, r0.a, 1-r1.a
-#endif
-
-#if !REFLECT && !REFRACT
-; This is wrong!!!!
-mov r0.rgba, c0
-#endif
-
-#if !REFLECT && REFRACT
-mov r0.rgba, r2
-#endif
-
-#if REFLECT && !REFRACT
-mov r0.rgba, r4
-#endif
-
-#if REFLECT && REFRACT
-; reflection * fresnel + refraction * ( 1 - fresnel )
-lrp r0.rgba, r0.a, r4, r2
-#endif
-
+; STATIC: "REFLECT" "0..1" +; STATIC: "REFRACT" "0..1" +ps.1.4 +; T2 - refraction +; T3 - normal map +; T4 - reflection +; TC0 - normal map coords +; TC1 - proj tex coords (reflection) +; TC2 - proj tex coords (refraction) +; TC3 - tangent space view vec +; TC4 - displacement scale + +; sample normal map +texld r3, t0 + +#if REFLECT +; reflection coords +texcrd r4.xy, t1_dw.xyw +#endif +#if REFRACT +; refraction coords +texcrd r2.xy, t2_dw.xyw +#endif +; tangent space eye vector +texld r1, t5 ; <---- Normalizing CUBE MAP here!!! +; reflection/refraction scale (x,y) +texcrd r0.xyz, t4.xyz + +; perturb coords by constant displacement +; and by normal map alpha (which has 1/(2**miplevel in it) +mul r0.rg, r0, r3.a +#if REFLECT +mad r4.rg, r3_bx2, r0.x, r4 +#endif + +#if REFRACT +mad r2.rg, r3_bx2, r0.y, r2 +#endif + +; stuff something into z so that texld will deal +#if REFLECT +mov r4.b, c5 +#endif +#if REFRACT +mov r2.b, c5 +#endif + +phase + +#if REFLECT +; reflection +texld r4, r4 +#endif +#if REFRACT +; refraction +texld r2, r2 +#endif + +#if REFLECT +; N.V +dp3_sat r1.a, r3_bx2, r1_bx2 +#endif + +#if REFRACT +; tint refraction +mul r2.rgb, r2, c1 +#endif + +#if REFLECT +; tint reflction +mul r4.rgb, r4, c4 + +; (1-N.V) ^ 5 ++mul r0.a, 1-r1.a, 1-r1.a +mul r0.a, r0.a, r0.a +mul_sat r0.a, r0.a, 1-r1.a +#endif + +#if !REFLECT && !REFRACT +; This is wrong!!!! +mov r0.rgba, c0 +#endif + +#if !REFLECT && REFRACT +mov r0.rgba, r2 +#endif + +#if REFLECT && !REFRACT +mov r0.rgba, r4 +#endif + +#if REFLECT && REFRACT +; reflection * fresnel + refraction * ( 1 - fresnel ) +lrp r0.rgba, r0.a, r4, r2 +#endif + diff --git a/mp/src/materialsystem/stdshaders/WorldTexture.psh b/mp/src/materialsystem/stdshaders/WorldTexture.psh index 6144fdf2..933435bf 100644 --- a/mp/src/materialsystem/stdshaders/WorldTexture.psh +++ b/mp/src/materialsystem/stdshaders/WorldTexture.psh @@ -1,14 +1,14 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-; Get the color from the texture
-tex t0
-mov r0, t0
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +; Get the color from the texture +tex t0 +mov r0, t0 + diff --git a/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend.psh b/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend.psh index b9494b02..a3f3c6a4 100644 --- a/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend.psh +++ b/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend.psh @@ -1,21 +1,21 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-
-mov r0.rgb, t0 +
-mul r0.a, t0.a, v0.a ; Grab alpha from vertex color
-
-lrp r0.rgb, t2.a, t2, r0 ; Base = base * (1 - detail alpha) + detail * detail alpha
-mul r0.rgb, r0, v0 ; modulate by vertex color
-mul r0.rgb, t1, r0 ; fold in lightmap (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 + +mov r0.rgb, t0 + +mul r0.a, t0.a, v0.a ; Grab alpha from vertex color + +lrp r0.rgb, t2.a, t2, r0 ; Base = base * (1 - detail alpha) + detail * detail alpha +mul r0.rgb, r0, v0 ; modulate by vertex color +mul r0.rgb, t1, r0 ; fold in lightmap (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend_DetailAlpha.psh b/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend_DetailAlpha.psh index 033730bb..d5e07368 100644 --- a/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend_DetailAlpha.psh +++ b/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend_DetailAlpha.psh @@ -1,25 +1,25 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-def c1, 1.0f, 1.0f, 1.0f, 1.0f
-
-tex t0
-tex t1
-tex t2
-
-mov_x2_sat r0.rgb, t0 + ; r0 = sat( t0 * 2 )
-mul r0.a, t0.a, v0.a ; Grab alpha from vertex color
-
-lrp_sat r0.rgb, t2.a, r0, c1 ; r0 = B*Da + (1-Da)
-
-mul r0.rgb, r0, t2 ; modulate by detail color
-mul r0.rgb, r0, v0 ; modulate by vertex color
-mul r0.rgb, t1, r0 ; fold in lightmap (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +def c1, 1.0f, 1.0f, 1.0f, 1.0f + +tex t0 +tex t1 +tex t2 + +mov_x2_sat r0.rgb, t0 + ; r0 = sat( t0 * 2 ) +mul r0.a, t0.a, v0.a ; Grab alpha from vertex color + +lrp_sat r0.rgb, t2.a, r0, c1 ; r0 = B*Da + (1-Da) + +mul r0.rgb, r0, t2 ; modulate by detail color +mul r0.rgb, r0, v0 ; modulate by vertex color +mul r0.rgb, t1, r0 ; fold in lightmap (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend_SelfIlluminated.psh b/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend_SelfIlluminated.psh index 2f5a8ca5..75ce4b5d 100644 --- a/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend_SelfIlluminated.psh +++ b/mp/src/materialsystem/stdshaders/WorldTwoTextureBlend_SelfIlluminated.psh @@ -1,27 +1,27 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-
-mov r0.rgb, t0 +
-mov r0.a, v0.a ; Grab alpha from vertex color
-
-lrp r0.rgb, t2.a, t2, r0 ; Base = base * (1 - detail alpha) + detail * detail alpha
-mul r0.rgb, r0, v0 ; modulate by vertex color
-mul r0.rgb, t1, r0 ; fold in lightmap (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1.rgb, c1, t0 ; Self illum * tint
-+ mul r1.a, t0.a, 1-t2.a ; Reduce self-illum amount based on 1 - detailalpha
-
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lightmap
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 + +mov r0.rgb, t0 + +mov r0.a, v0.a ; Grab alpha from vertex color + +lrp r0.rgb, t2.a, t2, r0 ; Base = base * (1 - detail alpha) + detail * detail alpha +mul r0.rgb, r0, v0 ; modulate by vertex color +mul r0.rgb, t1, r0 ; fold in lightmap (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1.rgb, c1, t0 ; Self illum * tint ++ mul r1.a, t0.a, 1-t2.a ; Reduce self-illum amount based on 1 - detailalpha + +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lightmap + diff --git a/mp/src/materialsystem/stdshaders/WorldVertexAlpha.psh b/mp/src/materialsystem/stdshaders/WorldVertexAlpha.psh index e610452e..67e6a1e3 100644 --- a/mp/src/materialsystem/stdshaders/WorldVertexAlpha.psh +++ b/mp/src/materialsystem/stdshaders/WorldVertexAlpha.psh @@ -1,10 +1,10 @@ -ps.1.1
-
-tex t0 ; basetexture
-tex t1 ; lightmap
-
-mov r0.a, 1-t1.a
-;mov r0.rgb, t0 ; * 2 * (overbrightFactor/2)
-;mov_x2 r0.rgb, t0 ; * 2 * (overbrightFactor/2)
-mul r0.rgb, t0, t1;
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +tex t0 ; basetexture +tex t1 ; lightmap + +mov r0.a, 1-t1.a +;mov r0.rgb, t0 ; * 2 * (overbrightFactor/2) +;mov_x2 r0.rgb, t0 ; * 2 * (overbrightFactor/2) +mul r0.rgb, t0, t1; +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/WorldVertexTransition.psh b/mp/src/materialsystem/stdshaders/WorldVertexTransition.psh index 4fd2882b..76249b3d 100644 --- a/mp/src/materialsystem/stdshaders/WorldVertexTransition.psh +++ b/mp/src/materialsystem/stdshaders/WorldVertexTransition.psh @@ -1,18 +1,18 @@ -; STATIC: "DETAIL" "0..1"
-ps.1.1
-
-tex t0 ; basetexture
-tex t1 ; basetexture2
-tex t2 ; lightmap
-#if DETAIL
-tex t3 ; detail
-#endif
-
-mov_sat r1.a, v0.a
-lrp r0, r1.a, t1, t0
-
-mul r0, r0, t2
-#if DETAIL
-mul_x2 r0.rgb, r0, t3
-#endif
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+; STATIC: "DETAIL" "0..1" +ps.1.1 + +tex t0 ; basetexture +tex t1 ; basetexture2 +tex t2 ; lightmap +#if DETAIL +tex t3 ; detail +#endif + +mov_sat r1.a, v0.a +lrp r0, r1.a, t1, t0 + +mul r0, r0, t2 +#if DETAIL +mul_x2 r0.rgb, r0, t3 +#endif +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/WorldVertexTransition_BlendBase2.psh b/mp/src/materialsystem/stdshaders/WorldVertexTransition_BlendBase2.psh index d4a5c623..6c959f1a 100644 --- a/mp/src/materialsystem/stdshaders/WorldVertexTransition_BlendBase2.psh +++ b/mp/src/materialsystem/stdshaders/WorldVertexTransition_BlendBase2.psh @@ -1,16 +1,16 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-mul r0.rgb, t1, t0 ; fold in lightmap (color)
-+mov r0.a, v0.a ; fold in lightmap (alpha)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +mul r0.rgb, t1, t0 ; fold in lightmap (color) ++mov r0.a, v0.a ; fold in lightmap (alpha) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + diff --git a/mp/src/materialsystem/stdshaders/WorldVertexTransition_Editor.psh b/mp/src/materialsystem/stdshaders/WorldVertexTransition_Editor.psh index 936edc9e..a8181280 100644 --- a/mp/src/materialsystem/stdshaders/WorldVertexTransition_Editor.psh +++ b/mp/src/materialsystem/stdshaders/WorldVertexTransition_Editor.psh @@ -1,10 +1,10 @@ -ps.1.1
-
-tex t0 ; basetexture
-tex t1 ; basetexture2
-tex t2 ; lightmap
-
-; The editor uses vertex alpha as the blend factor
-lrp r0, 1-v0.a, t1, t0
-mul r0, r0, t2
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +tex t0 ; basetexture +tex t1 ; basetexture2 +tex t2 ; lightmap + +; The editor uses vertex alpha as the blend factor +lrp r0, 1-v0.a, t1, t0 +mul r0, r0, t2 +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/WorldVertexTransition_Seamless.psh b/mp/src/materialsystem/stdshaders/WorldVertexTransition_Seamless.psh index 8d4edad0..db9d0cd6 100644 --- a/mp/src/materialsystem/stdshaders/WorldVertexTransition_Seamless.psh +++ b/mp/src/materialsystem/stdshaders/WorldVertexTransition_Seamless.psh @@ -1,23 +1,23 @@ -ps.1.1
-
-def c0, 1.0f, 0.0f, 0.0f, 0.0f
-def c1, 0.0f, 1.0f, 0.0f, 0.0f
-def c2, 0.0f, 0.0f, 1.0f, 0.0f
-
-tex t0 ; basetexture zy
-tex t1 ; basetexture xz
-tex t2 ; basetexture xy
-tex t3 ; lightmap
-
-dp3_sat r1, v0, c0
-mul r0, t0, r1
-
-dp3_sat r1, v0, c1
-mad r0, t1, r1, r0
-
-dp3_sat r1, v0, c2
-mad r0, t2, r1, r0
-
-; multiply by lightmap
-mul_x2 r0.rgb, r0, t3
-+mov r0.a, v0 ; $vColor
+ps.1.1 + +def c0, 1.0f, 0.0f, 0.0f, 0.0f +def c1, 0.0f, 1.0f, 0.0f, 0.0f +def c2, 0.0f, 0.0f, 1.0f, 0.0f + +tex t0 ; basetexture zy +tex t1 ; basetexture xz +tex t2 ; basetexture xy +tex t3 ; lightmap + +dp3_sat r1, v0, c0 +mul r0, t0, r1 + +dp3_sat r1, v0, c1 +mad r0, t1, r1, r0 + +dp3_sat r1, v0, c2 +mad r0, t2, r1, r0 + +; multiply by lightmap +mul_x2 r0.rgb, r0, t3 ++mov r0.a, v0 ; $vColor diff --git a/mp/src/materialsystem/stdshaders/WorldVertexTransition_ps14.psh b/mp/src/materialsystem/stdshaders/WorldVertexTransition_ps14.psh index 763a5d11..3ddfa02c 100644 --- a/mp/src/materialsystem/stdshaders/WorldVertexTransition_ps14.psh +++ b/mp/src/materialsystem/stdshaders/WorldVertexTransition_ps14.psh @@ -1,32 +1,32 @@ -; STATIC: "DETAIL" "0..1"
-; STATIC: "BLENDMODULATETEXTURE" "0..1"
-ps.1.4
-
-def c1, 3.0, -2.0, 0.5, 0.5
-
-texld r0, t0
-texld r1, t1
-texld r2, t2
-#if DETAIL
-texld r3, t3 ; detail
-#endif
-#if BLENDMODULATETEXTURE
-texld r4, t4 ; detail
-#endif
-
-#if BLEND_MODULATETEXTURE
-sub r5.a, v0.a, r4.g
-add_sat r5.a, r5.a, c1.a
-mad r6.a, c1.g, r5.a, c1.r
-mul r6.a, r6.a, r5.a
-mul r5.a, r6.a, r5.a
-#else
-mov_sat r5.a, v0.a
-#endif
-lrp r0, r5.a, r1, r0
-
-mul r0, r0, r2
-#if DETAIL
-mul_x2 r0.rgb, r0, r3
-#endif
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+; STATIC: "DETAIL" "0..1" +; STATIC: "BLENDMODULATETEXTURE" "0..1" +ps.1.4 + +def c1, 3.0, -2.0, 0.5, 0.5 + +texld r0, t0 +texld r1, t1 +texld r2, t2 +#if DETAIL +texld r3, t3 ; detail +#endif +#if BLENDMODULATETEXTURE +texld r4, t4 ; detail +#endif + +#if BLEND_MODULATETEXTURE +sub r5.a, v0.a, r4.g +add_sat r5.a, r5.a, c1.a +mad r6.a, c1.g, r5.a, c1.r +mul r6.a, r6.a, r5.a +mul r5.a, r6.a, r5.a +#else +mov_sat r5.a, v0.a +#endif +lrp r0, r5.a, r1, r0 + +mul r0, r0, r2 +#if DETAIL +mul_x2 r0.rgb, r0, r3 +#endif +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/cloud_ps11.psh b/mp/src/materialsystem/stdshaders/cloud_ps11.psh index 8e5627cb..82ed1d60 100644 --- a/mp/src/materialsystem/stdshaders/cloud_ps11.psh +++ b/mp/src/materialsystem/stdshaders/cloud_ps11.psh @@ -1,6 +1,6 @@ -ps.1.1
-
-tex t0
-tex t1
-
-mul r0, t0, t1
+ps.1.1 + +tex t0 +tex t1 + +mul r0, t0, t1 diff --git a/mp/src/materialsystem/stdshaders/debugluxel.cpp b/mp/src/materialsystem/stdshaders/debugluxel.cpp index b3135fcb..328dfb6b 100644 --- a/mp/src/materialsystem/stdshaders/debugluxel.cpp +++ b/mp/src/materialsystem/stdshaders/debugluxel.cpp @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//===== Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -6,18 +6,11 @@ // $NoKeywords: $ //===========================================================================// -#include "shaderlib/cshader.h" - -#define USE_NEW_SHADER //Updating assembly shaders to fxc, this is for A/B testing. - -#ifdef USE_NEW_SHADER - -#include "unlitgeneric_vs20.inc" -#include "unlitgeneric_ps20.inc" -#include "unlitgeneric_ps20b.inc" - -#endif +#include "shaderlib/CShader.h" +#include "debugluxel_ps20b.inc" +#include "debugluxel_ps20.inc" +#include "debugluxel_vs20.inc" // memdbgon must be the last include file in a .cpp file!!! @@ -34,107 +27,71 @@ BEGIN_SHADER_FLAGS( DebugLuxels, "Help for DebugLuxels", SHADER_NOT_EDITABLE ) SET_FLAGS( MATERIAL_VAR_NO_DEBUG_OVERRIDE ); SET_FLAGS2( MATERIAL_VAR2_LIGHTING_LIGHTMAP ); -#ifdef USE_NEW_SHADER if( g_pHardwareConfig->GetDXSupportLevel() >= 90 ) { SET_FLAGS2( MATERIAL_VAR2_SUPPORTS_HW_SKINNING ); } -#endif -} - -SHADER_INIT -{ - LoadTexture( BASETEXTURE ); -} + } -SHADER_DRAW -{ - SHADOW_STATE + SHADER_INIT { - pShaderShadow->EnableTexture( SHADER_SAMPLER0, true ); - - if (IS_FLAG_SET(MATERIAL_VAR_TRANSLUCENT)) - { - pShaderShadow->EnableBlending( true ); - pShaderShadow->BlendFunc( SHADER_BLEND_SRC_ALPHA, SHADER_BLEND_ONE_MINUS_SRC_ALPHA ); - } + LoadTexture( BASETEXTURE ); + } - if (IS_FLAG_SET(MATERIAL_VAR_VERTEXCOLOR)) - pShaderShadow->DrawFlags( SHADER_DRAW_POSITION | SHADER_DRAW_COLOR | SHADER_DRAW_LIGHTMAP_TEXCOORD0 ); - else - pShaderShadow->DrawFlags( SHADER_DRAW_POSITION | SHADER_DRAW_LIGHTMAP_TEXCOORD0 ); -#ifdef USE_NEW_SHADER - if( g_pHardwareConfig->GetDXSupportLevel() >= 90 ) + SHADER_DRAW + { + SHADOW_STATE { - bool bVertexColor = IS_FLAG_SET(MATERIAL_VAR_VERTEXCOLOR); + pShaderShadow->EnableTexture( SHADER_SAMPLER0, true ); - DECLARE_STATIC_VERTEX_SHADER( unlitgeneric_vs20 ); - SET_STATIC_VERTEX_SHADER_COMBO( VERTEXCOLOR, bVertexColor ? 1 : 0 ); - SET_STATIC_VERTEX_SHADER( unlitgeneric_vs20 ); + DECLARE_STATIC_VERTEX_SHADER( debugluxel_vs20 ); + SET_STATIC_VERTEX_SHADER( debugluxel_vs20 ); if( g_pHardwareConfig->SupportsPixelShaders_2_b() ) { - DECLARE_STATIC_PIXEL_SHADER( unlitgeneric_ps20b ); - SET_STATIC_PIXEL_SHADER( unlitgeneric_ps20b ); + DECLARE_STATIC_PIXEL_SHADER( debugluxel_ps20b ); + SET_STATIC_PIXEL_SHADER( debugluxel_ps20b ); } else { - DECLARE_STATIC_PIXEL_SHADER( unlitgeneric_ps20 ); - SET_STATIC_PIXEL_SHADER( unlitgeneric_ps20 ); + DECLARE_STATIC_PIXEL_SHADER( debugluxel_ps20 ); + SET_STATIC_PIXEL_SHADER( debugluxel_ps20 ); } - } -#endif - } - DYNAMIC_STATE - { - BindTexture( SHADER_SAMPLER0, BASETEXTURE, FRAME ); - int texCoordScaleX = 1, texCoordScaleY = 1; - if (!params[NOSCALE]->GetIntValue()) - { - pShaderAPI->GetLightmapDimensions( &texCoordScaleX, &texCoordScaleY ); + SetDefaultBlendingShadowState( BASETEXTURE ); + DisableFog(); + pShaderShadow->VertexShaderVertexFormat( VERTEX_POSITION, 2, NULL, 0 ); } - -#ifdef USE_NEW_SHADER - if( g_pHardwareConfig->GetDXSupportLevel() >= 90 ) + DYNAMIC_STATE { - float vVertexColor[4] = { IS_FLAG_SET(MATERIAL_VAR_VERTEXCOLOR) ? 1.0f : 0.0f, 0.0f, 0.0f, 0.0f }; - pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_6, vVertexColor, 1 ); + BindTexture( SHADER_SAMPLER0, BASETEXTURE, FRAME ); - DECLARE_DYNAMIC_VERTEX_SHADER( unlitgeneric_vs20 ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); - SET_DYNAMIC_VERTEX_SHADER( unlitgeneric_vs20 ); + int texCoordScaleX = 1, texCoordScaleY = 1; + if (!params[NOSCALE]->GetIntValue()) + { + pShaderAPI->GetLightmapDimensions( &texCoordScaleX, &texCoordScaleY ); + } + + DECLARE_DYNAMIC_VERTEX_SHADER( debugluxel_vs20 ); + SET_DYNAMIC_VERTEX_SHADER( debugluxel_vs20 ); if( g_pHardwareConfig->SupportsPixelShaders_2_b() ) { - DECLARE_DYNAMIC_PIXEL_SHADER( unlitgeneric_ps20b ); - SET_DYNAMIC_PIXEL_SHADER( unlitgeneric_ps20b ); + DECLARE_DYNAMIC_PIXEL_SHADER( debugluxel_ps20b ); + SET_DYNAMIC_PIXEL_SHADER( debugluxel_ps20b ); } else { - DECLARE_DYNAMIC_PIXEL_SHADER( unlitgeneric_ps20 ); - SET_DYNAMIC_PIXEL_SHADER( unlitgeneric_ps20 ); + DECLARE_DYNAMIC_PIXEL_SHADER( debugluxel_ps20 ); + SET_DYNAMIC_PIXEL_SHADER( debugluxel_ps20 ); } //texture scale transform Vector4D transformation[2]; - transformation[0].Init( (float)texCoordScaleX, 0.0f, 0.0f, 0.0f ); - transformation[1].Init( 0.0f, (float)texCoordScaleY, 0.0f, 0.0f ); + transformation[0].Init( texCoordScaleX, 0.0f, 0.0f, 0.0f ); + transformation[1].Init( 0.0f, texCoordScaleY, 0.0f, 0.0f ); s_pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, transformation[0].Base(), 2 ); } - else -#endif - { - if (!params[NOSCALE]->GetIntValue()) - { - pShaderAPI->MatrixMode( MATERIAL_TEXTURE0 ); - pShaderAPI->LoadIdentity( ); - pShaderAPI->ScaleXY( texCoordScaleX, texCoordScaleY ); - } - } + Draw(); } - Draw(); -} END_SHADER diff --git a/mp/src/materialsystem/stdshaders/debugluxel_ps2x.fxc b/mp/src/materialsystem/stdshaders/debugluxel_ps2x.fxc new file mode 100644 index 00000000..81c8ae00 --- /dev/null +++ b/mp/src/materialsystem/stdshaders/debugluxel_ps2x.fxc @@ -0,0 +1,15 @@ +#include "common_ps_fxc.h" + +sampler TextureSampler : register( s0 ); + +struct PS_INPUT +{ + float2 baseTexCoord : TEXCOORD0; +}; + +float4 main( PS_INPUT i ) : COLOR +{ + float4 result = tex2D( TextureSampler, i.baseTexCoord ); + return FinalOutput( result, 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_NONE ); +} + diff --git a/mp/src/materialsystem/stdshaders/debugluxel_vs20.fxc b/mp/src/materialsystem/stdshaders/debugluxel_vs20.fxc new file mode 100644 index 00000000..3edee90b --- /dev/null +++ b/mp/src/materialsystem/stdshaders/debugluxel_vs20.fxc @@ -0,0 +1,40 @@ +#include "common_vs_fxc.h" + +const float4 cLightmapTexCoordTransform[2] : register( SHADER_SPECIFIC_CONST_0 ); + +struct VS_INPUT +{ + float3 vPos : POSITION; + float2 vBaseTexCoord : TEXCOORD0; + float2 vLightmapTexCoord : TEXCOORD1; +}; + +struct VS_OUTPUT +{ + float4 projPos : POSITION; + float2 baseTexCoord : TEXCOORD0; +}; + + +VS_OUTPUT main( const VS_INPUT v ) +{ + VS_OUTPUT o = ( VS_OUTPUT )0; + + float4 projPos; + float3 worldPos; + + worldPos = mul4x3( float4( v.vPos, 1 ), cModel[0] ); + projPos = mul( float4( worldPos, 1 ), cViewProj ); + o.projPos = projPos; + + o.baseTexCoord.x = dot( v.vLightmapTexCoord, cLightmapTexCoordTransform[0].xy ) + cLightmapTexCoordTransform[0].w; + o.baseTexCoord.y = dot( v.vLightmapTexCoord, cLightmapTexCoordTransform[1].xy ) + cLightmapTexCoordTransform[1].w; + +#ifdef _PS3 + // Account for OpenGL's flipped y coordinate and expanded z range [-1,1] instead of [0,1] + o.projPos.y = -o.projPos.y; + o.projPos.z = 2.0f * o.projPos.z - o.projPos.w; +#endif // _PS3 + + return o; +} diff --git a/mp/src/materialsystem/stdshaders/detail_ps11.psh b/mp/src/materialsystem/stdshaders/detail_ps11.psh index fb5916ab..8c49af16 100644 --- a/mp/src/materialsystem/stdshaders/detail_ps11.psh +++ b/mp/src/materialsystem/stdshaders/detail_ps11.psh @@ -1,12 +1,12 @@ -ps.1.1
-
-tex t0
-tex t1
-
-mul r0.rgb, t0, v0 +
-
-; handle distance fade
-sub r0.a, t0.a, 1-v0.a
-
-sub r0.a, r0.a, t1_bias.a
-cnd r0.a, r0.a, c0.a, c1.a
+ps.1.1 + +tex t0 +tex t1 + +mul r0.rgb, t0, v0 + + +; handle distance fade +sub r0.a, t0.a, 1-v0.a + +sub r0.a, r0.a, t1_bias.a +cnd r0.a, r0.a, c0.a, c1.a diff --git a/mp/src/materialsystem/stdshaders/eye_refract_helper.cpp b/mp/src/materialsystem/stdshaders/eye_refract_helper.cpp index af4d2c08..b7aa4caf 100644 --- a/mp/src/materialsystem/stdshaders/eye_refract_helper.cpp +++ b/mp/src/materialsystem/stdshaders/eye_refract_helper.cpp @@ -288,7 +288,7 @@ void Draw_Eyes_Refract_Internal( CBaseVSShader *pShader, IMaterialVar** params, SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLight ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLightVertex ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( NUM_LIGHTS, lightState.m_nNumLights ); SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); SET_DYNAMIC_VERTEX_SHADER( eye_refract_vs20 ); @@ -302,7 +302,7 @@ void Draw_Eyes_Refract_Internal( CBaseVSShader *pShader, IMaterialVar** params, SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLight ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLightVertex ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( NUM_LIGHTS, lightState.m_nNumLights ); SET_DYNAMIC_VERTEX_SHADER_COMBO( MORPHING, pShaderAPI->IsHWMorphingEnabled() ); SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); diff --git a/mp/src/materialsystem/stdshaders/eyes_dx8_dx9_helper.cpp b/mp/src/materialsystem/stdshaders/eyes_dx8_dx9_helper.cpp index 97e6ed32..e1edda0d 100644 --- a/mp/src/materialsystem/stdshaders/eyes_dx8_dx9_helper.cpp +++ b/mp/src/materialsystem/stdshaders/eyes_dx8_dx9_helper.cpp @@ -421,7 +421,7 @@ static void DrawUsingVertexShader( bool bDX9, CBaseVSShader *pShader, IMaterialV SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLight ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLightVertex ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); SET_DYNAMIC_VERTEX_SHADER_COMBO( NUM_LIGHTS, bUseStaticControlFlow ? 0 : lightState.m_nNumLights ); SET_DYNAMIC_VERTEX_SHADER( eyes_vs20 ); @@ -435,7 +435,7 @@ static void DrawUsingVertexShader( bool bDX9, CBaseVSShader *pShader, IMaterialV SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLight ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLightVertex ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( MORPHING, pShaderAPI->IsHWMorphingEnabled() ); SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); SET_DYNAMIC_VERTEX_SHADER( eyes_vs30 ); diff --git a/mp/src/materialsystem/stdshaders/eyes_flashlight2_ps11.psh b/mp/src/materialsystem/stdshaders/eyes_flashlight2_ps11.psh index 3b02fbb3..6cc5493e 100644 --- a/mp/src/materialsystem/stdshaders/eyes_flashlight2_ps11.psh +++ b/mp/src/materialsystem/stdshaders/eyes_flashlight2_ps11.psh @@ -1,17 +1,17 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw stuff
-;------------------------------------------------------------------------------
-
-tex t0 ; Contains spotlight
-tex t1 ; Contains base texture
-tex t2 ; Normalize world pos to light
-tex t3 ; Sample iris
-
-dp3 r0, t2_bx2, v0_bx2 ; r0 = N dot L
-lrp r1.rgb, t3.a, t3, t1 ; r1 = lerp( baseColor, irisSample.xyz, irisSample.a )
-mul r0.rgb, r0_sat, r1 ; Saturate ( N dot L )* lerp
-mul r0.rgb, r0, v0.a ; *= attenuation
-mul_x2 r0.rgb, r0, t0 + ; *= 2 * spotlight
-mov r0.a, t1.a
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw stuff +;------------------------------------------------------------------------------ + +tex t0 ; Contains spotlight +tex t1 ; Contains base texture +tex t2 ; Normalize world pos to light +tex t3 ; Sample iris + +dp3 r0, t2_bx2, v0_bx2 ; r0 = N dot L +lrp r1.rgb, t3.a, t3, t1 ; r1 = lerp( baseColor, irisSample.xyz, irisSample.a ) +mul r0.rgb, r0_sat, r1 ; Saturate ( N dot L )* lerp +mul r0.rgb, r0, v0.a ; *= attenuation +mul_x2 r0.rgb, r0, t0 + ; *= 2 * spotlight +mov r0.a, t1.a diff --git a/mp/src/materialsystem/stdshaders/flesh_interior_blended_pass_dx8_ps11.psh b/mp/src/materialsystem/stdshaders/flesh_interior_blended_pass_dx8_ps11.psh index fc7e32a9..a9e675d4 100644 --- a/mp/src/materialsystem/stdshaders/flesh_interior_blended_pass_dx8_ps11.psh +++ b/mp/src/materialsystem/stdshaders/flesh_interior_blended_pass_dx8_ps11.psh @@ -1,15 +1,15 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; c5 1, 1, 1, 1
-;------------------------------------------------------------------------------
-
-tex t0 ; Base color
-
-mul r0, v0, v0 ; // Mask^2
-mul r0, r0, r0 ; // Mask^4
-sub r0, c5, r0 ; // 1.0 - Mask^4
-
-mul r0.rgb, r0, t0 ; // * Flesh texture color
-mul r0.a, r0.a, t0.a ; // * Flesh X-rated mask
-mul r0.a, r0.a, v1.a ; // * Fresnel mask
+ps.1.1 + +;------------------------------------------------------------------------------ +; c5 1, 1, 1, 1 +;------------------------------------------------------------------------------ + +tex t0 ; Base color + +mul r0, v0, v0 ; // Mask^2 +mul r0, r0, r0 ; // Mask^4 +sub r0, c5, r0 ; // 1.0 - Mask^4 + +mul r0.rgb, r0, t0 ; // * Flesh texture color +mul r0.a, r0.a, t0.a ; // * Flesh X-rated mask +mul r0.a, r0.a, v1.a ; // * Fresnel mask diff --git a/mp/src/materialsystem/stdshaders/flesh_interior_blended_pass_helper.cpp b/mp/src/materialsystem/stdshaders/flesh_interior_blended_pass_helper.cpp index 03ae509d..885a4cf6 100644 --- a/mp/src/materialsystem/stdshaders/flesh_interior_blended_pass_helper.cpp +++ b/mp/src/materialsystem/stdshaders/flesh_interior_blended_pass_helper.cpp @@ -228,7 +228,7 @@ void DrawFleshInteriorBlendedPass( CBaseVSShader *pShader, IMaterialVar** params SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLight ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLightVertex ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); SET_DYNAMIC_VERTEX_SHADER_COMBO( NUM_LIGHTS, bUseStaticControlFlow ? 0 : lightState.m_nNumLights ); SET_DYNAMIC_VERTEX_SHADER( flesh_interior_blended_pass_vs20 ); diff --git a/mp/src/materialsystem/stdshaders/lightmappedgeneric_basealphamaskedenvmap.psh b/mp/src/materialsystem/stdshaders/lightmappedgeneric_basealphamaskedenvmap.psh index fbb4393f..80e6db4e 100644 --- a/mp/src/materialsystem/stdshaders/lightmappedgeneric_basealphamaskedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/lightmappedgeneric_basealphamaskedenvmap.psh @@ -1,22 +1,22 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-tex t3
-
-mul r0, t0, v0 ; base times vertex color (with alpha)
-mul r1, t2, 1-t3.a ; envmap * envmapmask alpha
-mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only)
-mul r0.rgb, t1, r0 ; fold in lighting (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 +tex t3 + +mul r0, t0, v0 ; base times vertex color (with alpha) +mul r1, t2, 1-t3.a ; envmap * envmapmask alpha +mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only) +mul r0.rgb, t1, r0 ; fold in lighting (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/lightmappedgeneric_basetextureblend.psh b/mp/src/materialsystem/stdshaders/lightmappedgeneric_basetextureblend.psh index 9380ec63..9ca0eeb0 100644 --- a/mp/src/materialsystem/stdshaders/lightmappedgeneric_basetextureblend.psh +++ b/mp/src/materialsystem/stdshaders/lightmappedgeneric_basetextureblend.psh @@ -1,9 +1,9 @@ -ps.1.1
-
-tex t0 ; base 1
-tex t1 ; base 2
-
-mov r1, t1
-lrp r0, 1-v0.a, t0, r1
-mul r0, r0, c0
-
+ps.1.1 + +tex t0 ; base 1 +tex t1 ; base 2 + +mov r1, t1 +lrp r0, 1-v0.a, t0, r1 +mul r0, r0, c0 + diff --git a/mp/src/materialsystem/stdshaders/lightmappedgeneric_envmap.psh b/mp/src/materialsystem/stdshaders/lightmappedgeneric_envmap.psh index 1e4a2bc4..49217fee 100644 --- a/mp/src/materialsystem/stdshaders/lightmappedgeneric_envmap.psh +++ b/mp/src/materialsystem/stdshaders/lightmappedgeneric_envmap.psh @@ -1,20 +1,20 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-
-mul r0, t0, v0 ; base times vertex color (with alpha)
-mad r0.rgb, t2, c2, r0 ; + envmap * envmaptint (color only)
-mul r0.rgb, t1, r0 ; fold in lightmap (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 + +mul r0, t0, v0 ; base times vertex color (with alpha) +mad r0.rgb, t2, c2, r0 ; + envmap * envmaptint (color only) +mul r0.rgb, t1, r0 ; fold in lightmap (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/lightmappedgeneric_maskedenvmap.psh b/mp/src/materialsystem/stdshaders/lightmappedgeneric_maskedenvmap.psh index 4f72286f..980269a1 100644 --- a/mp/src/materialsystem/stdshaders/lightmappedgeneric_maskedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/lightmappedgeneric_maskedenvmap.psh @@ -1,22 +1,22 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-tex t3
-
-mul r0, t0, v0 ; base times vertex color (with alpha)
-mul r1, t2, t3 ; envmap * envmapmask
-mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only)
-mul r0.rgb, t1, r0 ; fold in lighting (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 +tex t3 + +mul r0, t0, v0 ; base times vertex color (with alpha) +mul r1, t2, t3 ; envmap * envmapmask +mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only) +mul r0.rgb, t1, r0 ; fold in lighting (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/lightmappedgeneric_multiplybylightingbasealphamaskedselfillum.psh b/mp/src/materialsystem/stdshaders/lightmappedgeneric_multiplybylightingbasealphamaskedselfillum.psh index a525a7b2..47902397 100644 --- a/mp/src/materialsystem/stdshaders/lightmappedgeneric_multiplybylightingbasealphamaskedselfillum.psh +++ b/mp/src/materialsystem/stdshaders/lightmappedgeneric_multiplybylightingbasealphamaskedselfillum.psh @@ -1,24 +1,24 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-
-; Blend between grey and lightmap color based on total alpha
-
-def c0 0.5f 0.5f 0.5f 1.0f
-
-mul_x2 r1.rgb, c0, t1 ; Apply overbright to lightmap
-+ mul r1.a, t0, v0 ; base times vertex alpha
-; GR - workaround for const/lerp issues
-mul r0.rgb, c1, t0 ; Self illum * tint
-+mul_sat r0.a, c1, t0
-lrp r1.rgb, t0.a, r1, r0 ; Blend between self-illum + lightmap
-lrp r0, r1.a, r1, c0 ; interpolate between grey + color
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 +tex t1 + +; Blend between grey and lightmap color based on total alpha + +def c0 0.5f 0.5f 0.5f 1.0f + +mul_x2 r1.rgb, c0, t1 ; Apply overbright to lightmap ++ mul r1.a, t0, v0 ; base times vertex alpha +; GR - workaround for const/lerp issues +mul r0.rgb, c1, t0 ; Self illum * tint ++mul_sat r0.a, c1, t0 +lrp r1.rgb, t0.a, r1, r0 ; Blend between self-illum + lightmap +lrp r0, r1.a, r1, c0 ; interpolate between grey + color diff --git a/mp/src/materialsystem/stdshaders/lightmappedgeneric_multiplybylightingbasenotexture.psh b/mp/src/materialsystem/stdshaders/lightmappedgeneric_multiplybylightingbasenotexture.psh index 77b05b9f..8cc6b4cc 100644 --- a/mp/src/materialsystem/stdshaders/lightmappedgeneric_multiplybylightingbasenotexture.psh +++ b/mp/src/materialsystem/stdshaders/lightmappedgeneric_multiplybylightingbasenotexture.psh @@ -1,20 +1,20 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-
-; Blend between grey and lightmap color based on total alpha
-
-def c2, 0.5f, 0.5f, 0.5f, 1.0f
-
-mul_x2 r1.rgb, c0, t1 ; Apply overbright to lightmap
-+ mov r1.a, v0 ; vertex alpha
-lrp r0, r1.a, r1, c2 ; interpolate between grey + color
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 +tex t1 + +; Blend between grey and lightmap color based on total alpha + +def c2, 0.5f, 0.5f, 0.5f, 1.0f + +mul_x2 r1.rgb, c0, t1 ; Apply overbright to lightmap ++ mov r1.a, v0 ; vertex alpha +lrp r0, r1.a, r1, c2 ; interpolate between grey + color diff --git a/mp/src/materialsystem/stdshaders/lightmappedgeneric_selfilluminatedenvmap.psh b/mp/src/materialsystem/stdshaders/lightmappedgeneric_selfilluminatedenvmap.psh index 84b56437..4c80db2f 100644 --- a/mp/src/materialsystem/stdshaders/lightmappedgeneric_selfilluminatedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/lightmappedgeneric_selfilluminatedenvmap.psh @@ -1,27 +1,27 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-
-mul r0.rgb, t0, v0 + ; base times vertex color (no alpha)
-mov r0.a, v0.a ; Grab alpha from vertex color
-
-mad r0.rgb, t2, c2, r0 ; + envmap * envmaptint (color only)
-
-mul r0.rgb, t1, r0 ; fold in lighting (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1, t0, c1 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 + +mul r0.rgb, t0, v0 + ; base times vertex color (no alpha) +mov r0.a, v0.a ; Grab alpha from vertex color + +mad r0.rgb, t2, c2, r0 ; + envmap * envmaptint (color only) + +mul r0.rgb, t1, r0 ; fold in lighting (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1, t0, c1 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting + diff --git a/mp/src/materialsystem/stdshaders/lightmappedgeneric_selfilluminatedmaskedenvmap.psh b/mp/src/materialsystem/stdshaders/lightmappedgeneric_selfilluminatedmaskedenvmap.psh index b4893363..78072123 100644 --- a/mp/src/materialsystem/stdshaders/lightmappedgeneric_selfilluminatedmaskedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/lightmappedgeneric_selfilluminatedmaskedenvmap.psh @@ -1,27 +1,27 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; c1 - self-illum tint
-; c2 - envmap tint
-;------------------------------------------------------------------------------
-
-tex t0
-tex t1
-tex t2
-tex t3
-
-mul r0.rgb, t0, v0 + ; base times vertex color (with alpha)
-mov r0.a, v0.a ; Grab alpha from vertex color
-
-mul r1, t2, t3 ; envmap * envmapmask
-mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only)
-
-mul r1, c1, t0.a ; Self illum alpha * tint
-mad r1, t0, r1, t1 ; Self illum * tint + lightmap
-mul r0.rgb, r1, r0 ; fold in lighting (color only)
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; c1 - self-illum tint +; c2 - envmap tint +;------------------------------------------------------------------------------ + +tex t0 +tex t1 +tex t2 +tex t3 + +mul r0.rgb, t0, v0 + ; base times vertex color (with alpha) +mov r0.a, v0.a ; Grab alpha from vertex color + +mul r1, t2, t3 ; envmap * envmapmask +mad r0.rgb, r1, c2, r0 ; + envmap * envmapmask * envmaptint (color only) + +mul r1, c1, t0.a ; Self illum alpha * tint +mad r1, t0, r1, t1 ; Self illum * tint + lightmap +mul r0.rgb, r1, r0 ; fold in lighting (color only) +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/sky_hdr_dx9.cpp b/mp/src/materialsystem/stdshaders/sky_hdr_dx9.cpp index 285879c0..008f37e3 100644 --- a/mp/src/materialsystem/stdshaders/sky_hdr_dx9.cpp +++ b/mp/src/materialsystem/stdshaders/sky_hdr_dx9.cpp @@ -220,7 +220,7 @@ BEGIN_VS_SHADER( Sky_HDR_DX9, "Help for Sky_HDR_DX9 shader" ) float w=txtr->GetActualWidth(); float h=txtr->GetActualHeight(); float FUDGE=0.01/max(w,h); // per ATI - float c1[4]={0.5/w-FUDGE, 0.5/h-FUDGE, w, h }; + float c1[4]={(float)(0.5/w-FUDGE), (float)(0.5/h-FUDGE), w, h }; pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, c1); BindTexture( SHADER_SAMPLER0, HDRCOMPRESSEDTEXTURE, FRAME ); diff --git a/mp/src/materialsystem/stdshaders/sprite_ps11.psh b/mp/src/materialsystem/stdshaders/sprite_ps11.psh index 5f5def5b..021246d1 100644 --- a/mp/src/materialsystem/stdshaders/sprite_ps11.psh +++ b/mp/src/materialsystem/stdshaders/sprite_ps11.psh @@ -1,15 +1,15 @@ -; STATIC: "VERTEXCOLOR" "0..1"
-; STATIC: "CONSTANTCOLOR" "0..1"
-
-ps.1.1
-
-tex t0
-mov r0, t0
-
-#if VERTEXCOLOR
-mul r0, r0, v0
-#endif
-
-#if CONSTANTCOLOR
-mul r0, r0, c0
+; STATIC: "VERTEXCOLOR" "0..1" +; STATIC: "CONSTANTCOLOR" "0..1" + +ps.1.1 + +tex t0 +mov r0, t0 + +#if VERTEXCOLOR +mul r0, r0, v0 +#endif + +#if CONSTANTCOLOR +mul r0, r0, c0 #endif
\ No newline at end of file diff --git a/mp/src/materialsystem/stdshaders/spritecard.cpp b/mp/src/materialsystem/stdshaders/spritecard.cpp index 850c357a..2eb65b64 100644 --- a/mp/src/materialsystem/stdshaders/spritecard.cpp +++ b/mp/src/materialsystem/stdshaders/spritecard.cpp @@ -417,7 +417,7 @@ SHADER_DRAW if ( bZoomSeq2 ) { float flZScale=1.0/(params[ZOOMANIMATESEQ2]->GetFloatValue()); - float C0[4]={ 0.5*(1.0+flZScale), flZScale, 0, 0 }; + float C0[4]={ (float)(0.5*(1.0+flZScale)), flZScale, 0, 0 }; pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_7, C0, ARRAYSIZE(C0)/4 ); } @@ -428,7 +428,7 @@ SHADER_DRAW float VC0[8]={ params[MINSIZE]->GetFloatValue(), params[MAXSIZE]->GetFloatValue(), params[STARTFADESIZE]->GetFloatValue(), params[ENDFADESIZE]->GetFloatValue(), - flStartFade, 1.0/(flMaxDistance-flStartFade), + flStartFade, (float)(1.0/(flMaxDistance-flStartFade)), 0,0 }; pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_8, VC0, ARRAYSIZE(VC0)/4 ); diff --git a/mp/src/materialsystem/stdshaders/teeth.cpp b/mp/src/materialsystem/stdshaders/teeth.cpp index a3168822..b3dc9ff9 100644 --- a/mp/src/materialsystem/stdshaders/teeth.cpp +++ b/mp/src/materialsystem/stdshaders/teeth.cpp @@ -236,7 +236,7 @@ BEGIN_VS_SHADER( Teeth_DX9, "Help for Teeth_DX9" ) DECLARE_DYNAMIC_VERTEX_SHADER( teeth_bump_vs20 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLight ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLightVertex ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); SET_DYNAMIC_VERTEX_SHADER_COMBO( NUM_LIGHTS, bUseStaticControlFlow ? 0 : lightState.m_nNumLights ); SET_DYNAMIC_VERTEX_SHADER( teeth_bump_vs20 ); @@ -273,7 +273,7 @@ BEGIN_VS_SHADER( Teeth_DX9, "Help for Teeth_DX9" ) DECLARE_DYNAMIC_VERTEX_SHADER( teeth_bump_vs30 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLight ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLightVertex ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( MORPHING, pShaderAPI->IsHWMorphingEnabled() ); SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); SET_DYNAMIC_VERTEX_SHADER( teeth_bump_vs30 ); @@ -306,7 +306,7 @@ BEGIN_VS_SHADER( Teeth_DX9, "Help for Teeth_DX9" ) SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLight ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLightVertex ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); SET_DYNAMIC_VERTEX_SHADER_COMBO( NUM_LIGHTS, bUseStaticControlFlow ? 0 : lightState.m_nNumLights ); SET_DYNAMIC_VERTEX_SHADER( teeth_vs20 ); @@ -334,7 +334,7 @@ BEGIN_VS_SHADER( Teeth_DX9, "Help for Teeth_DX9" ) SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLight ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLightVertex ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( MORPHING, pShaderAPI->IsHWMorphingEnabled() ); SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression ); SET_DYNAMIC_VERTEX_SHADER( teeth_vs30 ); diff --git a/mp/src/materialsystem/stdshaders/unlitgeneric_basetimesdetail.psh b/mp/src/materialsystem/stdshaders/unlitgeneric_basetimesdetail.psh index 8f9139df..563845de 100644 --- a/mp/src/materialsystem/stdshaders/unlitgeneric_basetimesdetail.psh +++ b/mp/src/materialsystem/stdshaders/unlitgeneric_basetimesdetail.psh @@ -1,24 +1,24 @@ -ps.1.1
-def c0,0,0,0,.1
-def c1,0,0,0,.1
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-; tc3 - detail texcoords
-;
-; c3 = outline color
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t3 ; detail mask
-
-mul r1,t0,t3 ; multiply
-
-mov r0.rgb, c3 ; color = outline color
-;add r0.a, r1.a, c0.a
-;cnd r0.rgb, r0.a, r0, r1 ; if ( alpha+c0 > 0.5 ) color = outline, else color = base
-sub r0.a, r1.a, c1.a
-cnd r0.rgb, r0.a, r1, r0 ; if ( alpha -c1 > 0.5) color=base
+ps.1.1 +def c0,0,0,0,.1 +def c1,0,0,0,.1 +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +; tc3 - detail texcoords +; +; c3 = outline color +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t3 ; detail mask + +mul r1,t0,t3 ; multiply + +mov r0.rgb, c3 ; color = outline color +;add r0.a, r1.a, c0.a +;cnd r0.rgb, r0.a, r0, r1 ; if ( alpha+c0 > 0.5 ) color = outline, else color = base +sub r0.a, r1.a, c1.a +cnd r0.rgb, r0.a, r1, r0 ; if ( alpha -c1 > 0.5) color=base diff --git a/mp/src/materialsystem/stdshaders/vertexlit_and_unlit_generic_ps2x.fxc b/mp/src/materialsystem/stdshaders/vertexlit_and_unlit_generic_ps2x.fxc index 1d1a47d0..abfd9b6f 100644 --- a/mp/src/materialsystem/stdshaders/vertexlit_and_unlit_generic_ps2x.fxc +++ b/mp/src/materialsystem/stdshaders/vertexlit_and_unlit_generic_ps2x.fxc @@ -31,6 +31,9 @@ // DYNAMIC: "LIGHTING_PREVIEW" "0..0" [XBOX] // DYNAMIC: "FLASHLIGHTSHADOWS" "0..1" [ps20b] // DYNAMIC: "FLASHLIGHTSHADOWS" "0..1" [ps30] +// DYNAMIC: "STATIC_LIGHT_LIGHTMAP" "0..1" [ps20b] [ps30] +// DYNAMIC: "STATIC_LIGHT_LIGHTMAP" "0..0" [ps20] +// DYNAMIC: "DEBUG_LUXELS" "0..1" [ps20b] [ps30] // detail blend mode 6 = ps20b only // SKIP: $DETAIL_BLEND_MODE == 6 [ps20] @@ -71,6 +74,9 @@ // SKIP: $CUBEMAP_SPHERE_LEGACY && ($CUBEMAP == 0) +// Debugging luxels only makes sense if we have lightmaps on this geometry. +// SKIP: ($STATIC_LIGHT_LIGHTMAP == 0) && ($DEBUG_LUXELS == 1) + #include "common_flashlight_fxc.h" #include "common_vertexlitgeneric_dx9.h" @@ -105,6 +111,7 @@ sampler FlashlightSampler : register( s7 ); sampler ShadowDepthSampler : register( s8 ); // Flashlight shadow depth map sampler sampler DepthSampler : register( s10 ); //depth buffer sampler for depth blending sampler SelfIllumMaskSampler : register( s11 ); // selfillummask +sampler LightMapSampler : register( s12 ); struct PS_INPUT { @@ -167,6 +174,10 @@ const float4 g_OutlineParams : register( c9 ); const float3 g_DetailTint : register( c10 ); #endif +#if DEBUG_LUXELS +const float4 g_LuxelScale : register( c11 ); +#endif + // Calculate unified fog float CalcPixelFogFactorConst( float fPixelFogType, const float4 fogParams, const float flEyePosZ, const float flWorldPosZ, const float flProjPosZ ) @@ -331,11 +342,23 @@ float4 main( PS_INPUT i ) : COLOR } float3 diffuseLighting = float3( 1.0f, 1.0f, 1.0f ); - if( bDiffuseLighting || bVertexColor && !( bVertexColor && bDiffuseLighting ) ) + if( bDiffuseLighting || bVertexColor ) { diffuseLighting = i.color.rgb; } +#if STATIC_LIGHT_LIGHTMAP + // This matches the behavior of vertex lighting, which multiplies by cOverbright (which is not accessible here) + // And converts from Gamma space to Linear space before being used. + float2 lightmapTexCoords = i.baseTexCoord.xy; + #if DEBUG_LUXELS + lightmapTexCoords.xy *= g_LuxelScale.xy; + #endif + float3 f3LightmapColor = GammaToLinear( 2.0f * tex2D( LightMapSampler, lightmapTexCoords ).rgb ); + diffuseLighting = f3LightmapColor; +#endif + + float3 albedo = baseColor; if (bBlendTintByBaseAlpha) { diff --git a/mp/src/materialsystem/stdshaders/vertexlit_and_unlit_generic_vs20.fxc b/mp/src/materialsystem/stdshaders/vertexlit_and_unlit_generic_vs20.fxc index 9db6f864..43dae3a0 100644 --- a/mp/src/materialsystem/stdshaders/vertexlit_and_unlit_generic_vs20.fxc +++ b/mp/src/materialsystem/stdshaders/vertexlit_and_unlit_generic_vs20.fxc @@ -12,7 +12,8 @@ // STATIC: "DONT_GAMMA_CONVERT_VERTEX_COLOR" "0..1" // DYNAMIC: "COMPRESSED_VERTS" "0..1" // DYNAMIC: "DYNAMIC_LIGHT" "0..1" -// DYNAMIC: "STATIC_LIGHT" "0..1" +// DYNAMIC: "STATIC_LIGHT_VERTEX" "0..1" +// DYNAMIC: "STATIC_LIGHT_LIGHTMAP" "0..1" // DYNAMIC: "DOWATERFOG" "0..1" // DYNAMIC: "SKINNING" "0..1" // DYNAMIC: "LIGHTING_PREVIEW" "0..1" [PC] @@ -125,7 +126,7 @@ VS_OUTPUT main( const VS_INPUT v ) VS_OUTPUT o = ( VS_OUTPUT )0; bool bDynamicLight = DYNAMIC_LIGHT ? true : false; - bool bStaticLight = STATIC_LIGHT ? true : false; + bool bStaticLight = STATIC_LIGHT_VERTEX ? true : false; bool bDoLighting = !g_bVertexColor && (bDynamicLight || bStaticLight); float4 vPosition = v.vPos; diff --git a/mp/src/materialsystem/stdshaders/vertexlit_notexture.psh b/mp/src/materialsystem/stdshaders/vertexlit_notexture.psh index 8b550bde..5241abd7 100644 --- a/mp/src/materialsystem/stdshaders/vertexlit_notexture.psh +++ b/mp/src/materialsystem/stdshaders/vertexlit_notexture.psh @@ -1,13 +1,13 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-mov r0, v0
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +mov r0, v0 +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_basealphamaskedenvmap.psh b/mp/src/materialsystem/stdshaders/vertexlitgeneric_basealphamaskedenvmap.psh index 5faa681d..db80aefd 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_basealphamaskedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_basealphamaskedenvmap.psh @@ -1,19 +1,19 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask (in alpha channel)
-
-mul r0, t0, c3 ; base times modulation
-mul r1, t1, 1-t2.a ; Envmap * mask (in alpha channel)
-mad r0.rgb, r1, c2, r0 ; Base * mod + envmap * mask * tint
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask (in alpha channel) + +mul r0, t0, c3 ; base times modulation +mul r1, t1, 1-t2.a ; Envmap * mask (in alpha channel) +mad r0.rgb, r1, c2, r0 ; Base * mod + envmap * mask * tint +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailbasealphamaskedenvmap.psh b/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailbasealphamaskedenvmap.psh index ab653f19..82989f4e 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailbasealphamaskedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailbasealphamaskedenvmap.psh @@ -1,21 +1,21 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask (in alpha channel)
-tex t3 ; detail texture
-
-mul r0, t0, c3 ; base times modulation
-mul_x2 r0.rgb, r0, t3 ; detail texture
-mul r1, t1, 1-t2.a ; Envmap * mask (in alpha channel)
-mad r0.rgb, r1, c2, r0 ; Base * mod + envmap * mask * tint
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask (in alpha channel) +tex t3 ; detail texture + +mul r0, t0, c3 ; base times modulation +mul_x2 r0.rgb, r0, t3 ; detail texture +mul r1, t1, 1-t2.a ; Envmap * mask (in alpha channel) +mad r0.rgb, r1, c2, r0 ; Base * mod + envmap * mask * tint +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailenvmap.psh b/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailenvmap.psh index ac030f0a..e95d932b 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailenvmap.psh +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailenvmap.psh @@ -1,19 +1,19 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t3 ; detail texture
-
-mul r0, t0, c3 ; base times modulation
-mul_x2 r0.rgb, r0, t3 ; detail texture
-mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only)
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map +tex t3 ; detail texture + +mul r0, t0, c3 ; base times modulation +mul_x2 r0.rgb, r0, t3 ; detail texture +mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only) +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailmaskedenvmap.psh b/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailmaskedenvmap.psh index 51873a08..ace4a68f 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailmaskedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailmaskedenvmap.psh @@ -1,21 +1,21 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask
-tex t3 ; detail texture
-
-mul r0, t0, c3 ; Base times modulation
-mul_x2 r0.rgb, r0, t3 ; detail texture
-mul r1, t1, t2 ; Envmap * mask
-mad r0.rgb, r1, c2, r0 ; Base * mod + envmap * mask * tint
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask +tex t3 ; detail texture + +mul r0, t0, c3 ; Base times modulation +mul_x2 r0.rgb, r0, t3 ; detail texture +mul r1, t1, t2 ; Envmap * mask +mad r0.rgb, r1, c2, r0 ; Base * mod + envmap * mask * tint +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailselfilluminatedenvmap.psh b/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailselfilluminatedenvmap.psh index 44dee8d4..9cc71776 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailselfilluminatedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailselfilluminatedenvmap.psh @@ -1,28 +1,28 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-; Get the color from the texture
-tex t0
-tex t1
-tex t3
-
-mul r0.rgb, t0, c3 + ; base times modulation
-mov r0.a, c3.a ; use modulation alpha (don't use texture alpha)
-
-mul_x2 r0.rgb, r0, t3 ; detail texture
-
-mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only)
-
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1, t0, c1 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +; Get the color from the texture +tex t0 +tex t1 +tex t3 + +mul r0.rgb, t0, c3 + ; base times modulation +mov r0.a, c3.a ; use modulation alpha (don't use texture alpha) + +mul_x2 r0.rgb, r0, t3 ; detail texture + +mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only) + +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1, t0, c1 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting + diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailselfilluminatedmaskedenvmap.psh b/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailselfilluminatedmaskedenvmap.psh index 4be599ca..24396a07 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailselfilluminatedmaskedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_detailselfilluminatedmaskedenvmap.psh @@ -1,29 +1,29 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-; Get the color from the texture
-tex t0 ; base
-tex t1 ; env map
-tex t2 ; mask
-tex t3 ; Detail
-
-mul r0.rgb, t0, c3 + ; base times modulation
-mul r0.a, c3.a, t2.a ; alpha = mod alpha * mask alpha
-
-mul_x2 r0.rgb, r0, t3 ; detail texture
-
-mul r1, t2, t1 ; envmapmask * envmap
-mad r0.rgb, r1, c2, r0 ; + envmapmask * envmap * envmaptint (color only)
-
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1, t0, c1 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +; Get the color from the texture +tex t0 ; base +tex t1 ; env map +tex t2 ; mask +tex t3 ; Detail + +mul r0.rgb, t0, c3 + ; base times modulation +mul r0.a, c3.a, t2.a ; alpha = mod alpha * mask alpha + +mul_x2 r0.rgb, r0, t3 ; detail texture + +mul r1, t2, t1 ; envmapmask * envmap +mad r0.rgb, r1, c2, r0 ; + envmapmask * envmap * envmaptint (color only) + +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1, t0, c1 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9.cpp b/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9.cpp index 47105813..4281dcac 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9.cpp +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9.cpp @@ -41,6 +41,7 @@ BEGIN_VS_SHADER( VertexLitGeneric, "Help for VertexLitGeneric" ) SHADER_PARAM( SELFILLUMFRESNELMINMAXEXP, SHADER_PARAM_TYPE_VEC4, "0", "Self illum fresnel min, max, exp" ) SHADER_PARAM( ALPHATESTREFERENCE, SHADER_PARAM_TYPE_FLOAT, "0.0", "" ) SHADER_PARAM( FLASHLIGHTNOLAMBERT, SHADER_PARAM_TYPE_BOOL, "0", "Flashlight pass sets N.L=1.0" ) + SHADER_PARAM( LIGHTMAP, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "lightmap texture--will be bound by the engine") // Debugging term for visualizing ambient data on its own SHADER_PARAM( AMBIENTONLY, SHADER_PARAM_TYPE_INTEGER, "0", "Control drawing of non-ambient light ()" ) @@ -163,6 +164,7 @@ BEGIN_VS_SHADER( VertexLitGeneric, "Help for VertexLitGeneric" ) info.m_nEnvmapSaturation = ENVMAPSATURATION; info.m_nAlphaTestReference = ALPHATESTREFERENCE; info.m_nFlashlightNoLambert = FLASHLIGHTNOLAMBERT; + info.m_nLightmap = LIGHTMAP; info.m_nFlashlightTexture = FLASHLIGHTTEXTURE; info.m_nFlashlightTextureFrame = FLASHLIGHTTEXTUREFRAME; diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9_helper.cpp b/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9_helper.cpp index b1f49eab..40390824 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9_helper.cpp +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9_helper.cpp @@ -32,6 +32,7 @@ static ConVar mat_fullbright( "mat_fullbright","0", FCVAR_CHEAT ); static ConVar r_lightwarpidentity( "r_lightwarpidentity","0", FCVAR_CHEAT ); +static ConVar mat_luxels( "mat_luxels", "0", FCVAR_CHEAT ); static inline bool WantsSkinShader( IMaterialVar** params, const VertexLitGeneric_DX9_Vars_t &info ) @@ -382,7 +383,8 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial bool bIsAlphaTested = IS_FLAG_SET( MATERIAL_VAR_ALPHATEST ) != 0; bool bHasDiffuseWarp = (!bHasFlashlight || IsX360() ) && hasDiffuseLighting && (info.m_nDiffuseWarpTexture != -1) && params[info.m_nDiffuseWarpTexture]->IsTexture(); - + bool bHasLightmapTexture = IsTextureSet( info.m_nLightmap, params ); + bool bHasMatLuxel = bHasLightmapTexture && mat_luxels.GetBool(); //bool bNoCull = IS_FLAG_SET( MATERIAL_VAR_NOCULL ); bool bFlashlightNoLambert = false; @@ -622,6 +624,11 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial pShaderShadow->EnableTexture( SHADER_SAMPLER11, true ); // self illum mask } + + // Always enable this sampler, used for lightmaps depending on the dynamic combo. + // Lightmaps are generated in gamma space, but not sRGB, so leave that disabled. Conversion is done in the shader. + pShaderShadow->EnableTexture( SHADER_SAMPLER12, true ); + bool bSRGBWrite = true; if( (info.m_nLinearWrite != -1) && (params[info.m_nLinearWrite]->GetIntValue() == 1) ) { @@ -1188,12 +1195,33 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial // Set up light combo state - LightState_t lightState = {0, false, false}; + LightState_t lightState = { 0, false, false, false }; if ( bVertexLitGeneric && (!bHasFlashlight || IsX360() ) ) { pShaderAPI->GetDX9LightState( &lightState ); } + // Override the lighting desired if we have a lightmap set! + if ( bHasLightmapTexture ) + { + lightState.m_bStaticLightVertex = false; + lightState.m_bStaticLightTexel = true; + + // Usual case, not debugging. + if (!bHasMatLuxel) + { + pShader->BindTexture(SHADER_SAMPLER12, info.m_nLightmap); + } + else + { + float dimensions[] = { 0.0f, 0.0f, 0.0f, 0.0f }; + DynamicCmdsOut.BindStandardTexture( SHADER_SAMPLER12, TEXTURE_DEBUG_LUXELS ); + pShader->GetTextureDimensions( &dimensions[0], &dimensions[1], info.m_nLightmap ); + DynamicCmdsOut.SetPixelShaderConstant( 11, dimensions, 1 ); + } + } + + MaterialFogMode_t fogType = pShaderAPI->GetSceneFogMode(); int fogIndex = ( fogType == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ? 1 : 0; int numBones = pShaderAPI->GetCurrentNumBones(); @@ -1277,7 +1305,7 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial if ( bAmbientOnly ) // Override selected light combo to be ambient only { lightState.m_bAmbientLight = true; - lightState.m_bStaticLight = false; + lightState.m_bStaticLightVertex = false; lightState.m_nNumLights = 0; } @@ -1289,7 +1317,8 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial DECLARE_DYNAMIC_VERTEX_SHADER( vertexlit_and_unlit_generic_vs20 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLight ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_VERTEX, lightState.m_bStaticLightVertex ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, lightState.m_bStaticLightTexel ? 1 : 0); SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, fogIndex ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, numBones > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( @@ -1306,6 +1335,8 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial // SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() ); SET_DYNAMIC_PIXEL_SHADER_COMBO( FLASHLIGHTSHADOWS, bFlashlightShadows ); + SET_DYNAMIC_PIXEL_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, lightState.m_bStaticLightTexel ? 1 : 0 ); + SET_DYNAMIC_PIXEL_SHADER_COMBO( DEBUG_LUXELS, bHasMatLuxel ? 1 : 0 ); SET_DYNAMIC_PIXEL_SHADER_COMBO( LIGHTING_PREVIEW, pShaderAPI->GetIntRenderingParameter(INT_RENDERPARM_ENABLE_FIXED_LIGHTING) ); @@ -1315,6 +1346,7 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial { DECLARE_DYNAMIC_PIXEL_SHADER( vertexlit_and_unlit_generic_ps20 ); SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() ); + SET_DYNAMIC_PIXEL_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, lightState.m_bStaticLightTexel ? 1 : 0 ); SET_DYNAMIC_PIXEL_SHADER_COMBO( LIGHTING_PREVIEW, pShaderAPI->GetIntRenderingParameter(INT_RENDERPARM_ENABLE_FIXED_LIGHTING) ); @@ -1328,7 +1360,8 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial DECLARE_DYNAMIC_VERTEX_SHADER( vertexlit_and_unlit_generic_vs30 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DYNAMIC_LIGHT, lightState.HasDynamicLight() ); - SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT, lightState.m_bStaticLight ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_VERTEX, lightState.m_bStaticLightVertex ? 1 : 0 ); + SET_DYNAMIC_VERTEX_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, lightState.m_bStaticLightTexel ? 1 : 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, fogIndex ); SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, numBones > 0 ); SET_DYNAMIC_VERTEX_SHADER_COMBO( LIGHTING_PREVIEW, @@ -1340,6 +1373,8 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial DECLARE_DYNAMIC_PIXEL_SHADER( vertexlit_and_unlit_generic_ps30 ); // SET_DYNAMIC_PIXEL_SHADER_COMBO( PIXELFOGTYPE, pShaderAPI->GetPixelFogCombo() ); SET_DYNAMIC_PIXEL_SHADER_COMBO( FLASHLIGHTSHADOWS, bFlashlightShadows ); + SET_DYNAMIC_PIXEL_SHADER_COMBO( STATIC_LIGHT_LIGHTMAP, lightState.m_bStaticLightTexel ? 1 : 0 ); + SET_DYNAMIC_PIXEL_SHADER_COMBO( DEBUG_LUXELS, bHasMatLuxel ? 1 : 0 ); SET_DYNAMIC_PIXEL_SHADER_COMBO( LIGHTING_PREVIEW, pShaderAPI->GetIntRenderingParameter(INT_RENDERPARM_ENABLE_FIXED_LIGHTING) ); SET_DYNAMIC_PIXEL_SHADER_CMD( DynamicCmdsOut, vertexlit_and_unlit_generic_ps30 ); diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9_helper.h b/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9_helper.h index 0b5b02e4..8bc8d430 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9_helper.h +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_dx9_helper.h @@ -54,6 +54,7 @@ struct VertexLitGeneric_DX9_Vars_t int m_nFlashlightNoLambert; int m_nFlashlightTexture; int m_nFlashlightTextureFrame; + int m_nLightmap; int m_nSelfIllumTint; int m_nSelfIllumFresnel; diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_envmap.psh b/mp/src/materialsystem/stdshaders/vertexlitgeneric_envmap.psh index e539da67..019f8c0a 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_envmap.psh +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_envmap.psh @@ -1,17 +1,17 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-
-mul r0, t0, c3 ; base times modulation
-mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only)
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map + +mul r0, t0, c3 ; base times modulation +mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only) +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_lightingonly_overbright2.psh b/mp/src/materialsystem/stdshaders/vertexlitgeneric_lightingonly_overbright2.psh index dd19efce..722e1418 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_lightingonly_overbright2.psh +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_lightingonly_overbright2.psh @@ -1,5 +1,5 @@ -ps.1.1
-
-mov r0, v0
-
-
+ps.1.1 + +mov r0, v0 + + diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_maskedenvmap.psh b/mp/src/materialsystem/stdshaders/vertexlitgeneric_maskedenvmap.psh index c10600e3..afee48ad 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_maskedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_maskedenvmap.psh @@ -1,19 +1,19 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-tex t0 ; base color
-tex t1 ; cube map
-tex t2 ; envmap mask
-
-mul r0, t0, c3 ; Base times modulation
-mul r1, t1, t2 ; Envmap * mask
-mad r0.rgb, r1, c2, r0 ; Base * mod + envmap * mask * tint
-mul r0.rgb, v0, r0 ; apply vertex lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +tex t0 ; base color +tex t1 ; cube map +tex t2 ; envmap mask + +mul r0, t0, c3 ; Base times modulation +mul r1, t1, t2 ; Envmap * mask +mad r0.rgb, r1, c2, r0 ; Base * mod + envmap * mask * tint +mul r0.rgb, v0, r0 ; apply vertex lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_selfilluminatedenvmap.psh b/mp/src/materialsystem/stdshaders/vertexlitgeneric_selfilluminatedenvmap.psh index 321e797b..4b479199 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_selfilluminatedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_selfilluminatedenvmap.psh @@ -1,25 +1,25 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-; Get the color from the texture
-tex t0
-tex t1
-
-mul r0.rgb, t0, c3 + ; base times modulation
-mov r0.a, c3.a ; use modulation alpha (don't use texture alpha)
-
-mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only)
-
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1, t0, c1 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting
-
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +; Get the color from the texture +tex t0 +tex t1 + +mul r0.rgb, t0, c3 + ; base times modulation +mov r0.a, c3.a ; use modulation alpha (don't use texture alpha) + +mad r0.rgb, t1, c2, r0 ; + envmap * envmaptint (color only) + +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1, t0, c1 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting + diff --git a/mp/src/materialsystem/stdshaders/vertexlitgeneric_selfilluminatedmaskedenvmap.psh b/mp/src/materialsystem/stdshaders/vertexlitgeneric_selfilluminatedmaskedenvmap.psh index e7c52910..38c80e4f 100644 --- a/mp/src/materialsystem/stdshaders/vertexlitgeneric_selfilluminatedmaskedenvmap.psh +++ b/mp/src/materialsystem/stdshaders/vertexlitgeneric_selfilluminatedmaskedenvmap.psh @@ -1,26 +1,26 @@ -ps.1.1
-
-;------------------------------------------------------------------------------
-; Draw a texture . . woo hoo!
-; t0 - texture
-;
-; The texture coordinates need to be defined as follows:
-; tc0 - texcoords
-;------------------------------------------------------------------------------
-
-; Get the color from the texture
-tex t0 ; base
-tex t1 ; env map
-tex t2 ; mask
-
-mul r0.rgb, t0, c3 + ; base times modulation
-mul r0.a, c3.a, t2.a ; alpha = mod alpha * mask alpha
-
-mul r1, t2, t1 ; envmapmask * envmap
-mad r0.rgb, r1, c2, r0 ; + envmapmask * envmap * envmaptint (color only)
-
-mul r0.rgb, v0, r0 ; Apply lighting
-mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2)
-
-mul r1, t0, c1 ; Self illum * tint
-lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting
+ps.1.1 + +;------------------------------------------------------------------------------ +; Draw a texture . . woo hoo! +; t0 - texture +; +; The texture coordinates need to be defined as follows: +; tc0 - texcoords +;------------------------------------------------------------------------------ + +; Get the color from the texture +tex t0 ; base +tex t1 ; env map +tex t2 ; mask + +mul r0.rgb, t0, c3 + ; base times modulation +mul r0.a, c3.a, t2.a ; alpha = mod alpha * mask alpha + +mul r1, t2, t1 ; envmapmask * envmap +mad r0.rgb, r1, c2, r0 ; + envmapmask * envmap * envmaptint (color only) + +mul r0.rgb, v0, r0 ; Apply lighting +mul_x2 r0.rgb, c0, r0 ; * 2 * (overbrightFactor/2) + +mul r1, t0, c1 ; Self illum * tint +lrp r0.rgb, t0.a, r1, r0 ; Blend between self-illum + base * lighting diff --git a/mp/src/materialsystem/stdshaders/water.cpp b/mp/src/materialsystem/stdshaders/water.cpp index 92a26375..11353577 100644 --- a/mp/src/materialsystem/stdshaders/water.cpp +++ b/mp/src/materialsystem/stdshaders/water.cpp @@ -488,9 +488,9 @@ BEGIN_VS_SHADER( Water_DX90, float cheapWaterEndDistance = params[CHEAPWATERENDDISTANCE]->GetFloatValue(); float cheapWaterParams[4] = { - cheapWaterStartDistance * VSHADER_VECT_SCALE, - cheapWaterEndDistance * VSHADER_VECT_SCALE, - PSHADER_VECT_SCALE / ( cheapWaterEndDistance - cheapWaterStartDistance ), + (float)(cheapWaterStartDistance * VSHADER_VECT_SCALE), + (float)(cheapWaterEndDistance * VSHADER_VECT_SCALE), + (float)(PSHADER_VECT_SCALE / ( cheapWaterEndDistance - cheapWaterStartDistance )), cheapWaterStartDistance / ( cheapWaterEndDistance - cheapWaterStartDistance ), }; pShaderAPI->SetPixelShaderConstant( 1, cheapWaterParams ); diff --git a/mp/src/materialsystem/stdshaders/waterreflect_ps14.psh b/mp/src/materialsystem/stdshaders/waterreflect_ps14.psh index 7104e45c..4d277b1e 100644 --- a/mp/src/materialsystem/stdshaders/waterreflect_ps14.psh +++ b/mp/src/materialsystem/stdshaders/waterreflect_ps14.psh @@ -1,8 +1,8 @@ -ps.1.4
-
-texld r0, t0_dw.xyw ; sample dudv map
-
-phase
-
-texld r0, t0
-
+ps.1.4 + +texld r0, t0_dw.xyw ; sample dudv map + +phase + +texld r0, t0 + diff --git a/mp/src/materialsystem/stdshaders/waterrefract_ps14.psh b/mp/src/materialsystem/stdshaders/waterrefract_ps14.psh index 5b5d1755..8d63934d 100644 --- a/mp/src/materialsystem/stdshaders/waterrefract_ps14.psh +++ b/mp/src/materialsystem/stdshaders/waterrefract_ps14.psh @@ -1,23 +1,23 @@ -ps.1.4
-
-; non-fresnel version
-; t0:
-; texture: dudv map
-; texcoords: coords for normal map
-; t1:
-; texcoords: uvw for first dp3
-; t2:
-; texture: renderable texture that we are going to perturb
-; texcoords: uvw for second dp3
-;tex t0 ; sample dudv map
-;texm3x2pad t1, t0 ;
-;texm3x2tex t2, t0 ; sample renderabletexture
-
-;mul r0, t2, c1
-
-
-texld r0, t0 ; sample dudv map
-
-phase
-
-texld r0, t2_dw.xyw
+ps.1.4 + +; non-fresnel version +; t0: +; texture: dudv map +; texcoords: coords for normal map +; t1: +; texcoords: uvw for first dp3 +; t2: +; texture: renderable texture that we are going to perturb +; texcoords: uvw for second dp3 +;tex t0 ; sample dudv map +;texm3x2pad t1, t0 ; +;texm3x2tex t2, t0 ; sample renderabletexture + +;mul r0, t2, c1 + + +texld r0, t0 ; sample dudv map + +phase + +texld r0, t2_dw.xyw |