aboutsummaryrefslogtreecommitdiff
path: root/mp/src/materialsystem/stdshaders/Water_ps14.psh
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-12-23 14:58:45 -0800
committerJoe Ludwig <[email protected]>2013-12-23 15:00:03 -0800
commit7309a5f13f63fdcc7b1e090f6c176113a9d95061 (patch)
treead65c7fbe46a3c70bdc0a1426e88247ce1b0d7f5 /mp/src/materialsystem/stdshaders/Water_ps14.psh
parentMerge pull request #182 from ardneran/master (diff)
downloadsource-sdk-2013-7309a5f13f63fdcc7b1e090f6c176113a9d95061.tar.xz
source-sdk-2013-7309a5f13f63fdcc7b1e090f6c176113a9d95061.zip
Added many shader source files
This should include the latest version of every shader that was in the 2007 SDK. It also includes a smattering of debug shaders, both VR distortion shaders, and other assorted shaders that will hopefully be useful. None of these new files are included in the game shader DLL project. If you need to modify one of these shaders for use in your mod you will need to rename it so that you don't collide with the version of that shader that lives in stdshader_dx9.dll.
Diffstat (limited to 'mp/src/materialsystem/stdshaders/Water_ps14.psh')
-rw-r--r--mp/src/materialsystem/stdshaders/Water_ps14.psh96
1 files changed, 96 insertions, 0 deletions
diff --git a/mp/src/materialsystem/stdshaders/Water_ps14.psh b/mp/src/materialsystem/stdshaders/Water_ps14.psh
new file mode 100644
index 00000000..e9daecd1
--- /dev/null
+++ b/mp/src/materialsystem/stdshaders/Water_ps14.psh
@@ -0,0 +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
+