⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 watercheap_ps14.psh

📁 hl2 source code. Do not use it illegal.
💻 PSH
字号:
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

; dot eye-vector with per-pixel normal from r0
dp3_sat	r1, v0_bx2, r0_bx2

; multiply color by reflecttint
mul    r3.rgb, r3, c1

; 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 r0.a, r0.a, 1-r1.a				; quintic

#if 1
lrp r0.rgb, r0.a, r3, c0			; blend between reflected color and fog color based on fresnel
+mov r0.a, v0.a						; get the blend amount for cheap water
#else
mov r0, v0.a
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -