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/WaterCheapFresnelOpaque_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/WaterCheapFresnelOpaque_ps14.psh')
| -rw-r--r-- | materialsystem/stdshaders/WaterCheapFresnelOpaque_ps14.psh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/materialsystem/stdshaders/WaterCheapFresnelOpaque_ps14.psh b/materialsystem/stdshaders/WaterCheapFresnelOpaque_ps14.psh new file mode 100644 index 0000000..2aff6a4 --- /dev/null +++ b/materialsystem/stdshaders/WaterCheapFresnelOpaque_ps14.psh @@ -0,0 +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 +lrp r0.rgb, r1.a, r0, c0
\ No newline at end of file |