diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /materialsystem/stdshaders/Water_ps14.psh | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'materialsystem/stdshaders/Water_ps14.psh')
| -rw-r--r-- | materialsystem/stdshaders/Water_ps14.psh | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/materialsystem/stdshaders/Water_ps14.psh b/materialsystem/stdshaders/Water_ps14.psh new file mode 100644 index 0000000..55e6b0c --- /dev/null +++ b/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 + |