30.04.2014 Views

Introduction to the DirectX 9 Shader Models - Nvidia

Introduction to the DirectX 9 Shader Models - Nvidia

Introduction to the DirectX 9 Shader Models - Nvidia

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Pixel <strong>Shader</strong> Predication – 2x2<br />

Shadow Testing<br />

def c0, 0.0f, 0.0f, 0.0f, 0.0f<br />

def c1, 1.0f, 1.0f, 1.0f, 1.0f<br />

. . .<br />

sub_sat r0, r0, r1 // compare 4 values<br />

dp4<br />

r0, r0, c1 // sum <strong>the</strong> result<br />

mov r2, c2<br />

// ambient light<br />

setp_gt p0, r0, c0 // set predication<br />

p0 add r2, r2, c3<br />

// conditionally add lighting

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!