home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Igromania 2005 May
/
Igromania_2005-05.iso
/
DemosThemes2
/
Demo1944BattleOfTheBulge
/
demo1944english.exe
/
Inf
/
water1x1-shadow.ps.ati
< prev
next >
Wrap
Text File
|
2004-06-18
|
2KB
|
78 lines
ps_2_0
; c0 = mastercolor
; c1 = ambient color
def c12, 0, 0, 0, 1
def c13, 0.00048828125f, 0, 0, 0
def c14, 0, 0.00048828125f, 0, 0
def c15, 0.00048828125f, 0.00048828125f, 0, 0
def c16, 2048, 2048, 2048, 2048
def c17, 0.2, 0.1, 0.4, 0.7
dcl v0 ; vertex color
dcl v1 ; specular color
dcl_2d s0 ; shadow map
dcl_2d s1 ; bump map
dcl_2d s2 ; reflection map
dcl t0.xyzw ; shadow map coord
dcl t1.xy ; bump coord
dcl t2.xy ; reflection coord
#if 1
// regi shadow-map kod
rcp r0, t0.w
mul r0, t0, r0
texld r1, r0, s0
sub r1, r0.z, r1.r
cmp r0, r1, c1, v0
#else
; uj shadow map kod itt kezdodik
rcp r0, t0.w ; r0.w=1/t0.w
mul r0, t0, r0 ; r0=t0/t0.w
; more taps
; r0=alap tap
add r1, r0, c13
add r2, r0, c14
add r3, r0, c15
mul r4, r0, c16 ; r4, texel space
frc r4, r4 ; r4.xy=interpolant
texld r5, r0, s0 ; tap0 sample
texld r6, r1, s0 ; tap1 sample
texld r7, r2, s0 ; tap2 sample
texld r8, r3, s0 ; tap3 sample
sub r1.r, r0.z, r5.r ; kivonas 00
sub r1.g, r0.z, r6.r ; kivonas 10
sub r1.b, r0.z, r7.r ; kivonas 01
sub r1.a, r0.z, r8.r ; kivonas 11
cmp r2, r1, c12.x, c12.w ; 0 vagy 1
lrp r5, r4.x, r2.g, r2.r
lrp r6, r4.x, r2.a, r2.b
lrp r7, r4.y, r6, r5
lrp r0, r7, v0, c1
#endif
; itt van vege. eredmeny r0-ban
texld r1, t1, s1 ; sample bump map, marad is
mad r2.xy, r1, c17.x, c17.y ; *0.2-0.1 (-0.1..0.1)
add r2.xy, r2, t2 ; add reflection coord
texld r2, r2, s2 ; sample reflection (r2)
mad r3.rgb, r1, c17.z, c17.w ; fake shading from bump
mul r3.rgb, r3, r0 ; scale shading
mul r3.rgb, r3, r2 ; mul reflection
mad r3.rgb, r1, v1, r3 ; scale and add specular
mov r3.a, v0.a
mov oC0, r3