shader code

dcl_2d s0

dcl_2d s1

def c0, 50.000000, 500.000000, 2.600000, 10000.000000

dcl t0.xy

dcl t1.xy

dcl v0

texld r3, t0, s0

mul r2.xy, t1, c0.x

mul r0.xy, t1, c0.w

mul r1.xy, t1, c0.y

texld r4, r2, s1

texld r0, r0, s1

texld r1, r1, s1

texld r2, t1, s1

mul r2, r3, r2

mul r2, r4, r2

mul r1, r1, c0.z

mul r0, r0, c0.z

mul r1, r2, r1

mul r0, r1, r0

mul r0, r0, c0.z

mul r0,r0,v0

mov oC0, r0

vertex shader

vs.2.0

dcl_position v0; ; declare position

dcl_normal v1; ; declare normal

dcl_color v2; ; declare color

dcl_texcoord0 v3; ; declare texture coordinate

;definition de la couleur ambiante

;def c19,0.0,0.0,0.0,1.0

;def c20,0.5,0.5,0.5,0.0

;def c21,1.0,1.0,1.0,1.0

; transpose and transform position to clip space

m4x4 oPos,v0,c4

;le 200607

; calculate light vector

mov r3,c8

m4x4 r2,r3,c0

; normalize light vector

dp3 r2.w, r2, r2

rsq r2.w, r2.w

mul r2, r2, r2.w

; calculate light color

dp3 r3, v1, r2 ; dp3 with negative light vector

add r3,r3,c20 ;

min r3,r3,c21 ; prendre max 1

lit r5, r3 ; clamp to zero if r3 < 0, r5 has diffuce component in r5.y

mul r5.xyz, r5.y, c9 ; ouput diffuse color

add oD0,r5,c19

mov oT0, v3 ; store texture coordinates

;mul r3,v3,c18

mov oT1,r3

if it can help somebody

more info to come

good night