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/stdshaders/LightmappedGeneric_BumpmappedEnvmap_ps14.psh | |
| 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/stdshaders/LightmappedGeneric_BumpmappedEnvmap_ps14.psh')
| -rw-r--r-- | mp/src/materialsystem/stdshaders/LightmappedGeneric_BumpmappedEnvmap_ps14.psh | 144 |
1 files changed, 72 insertions, 72 deletions
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 |