14.12.2012 Views

Direct3D HLSL Programming using RenderMonkey IDE

Direct3D HLSL Programming using RenderMonkey IDE

Direct3D HLSL Programming using RenderMonkey IDE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

More Tips To Generate Better PS_1_x<br />

Code Through Good <strong>HLSL</strong> Use<br />

• Complement (1 – x)<br />

1 – value<br />

generates 1 – rX modifier on the source register,<br />

where rX is the source register.<br />

• Saturate ( _sat )<br />

– Use either saturate() or clamp() intrinsics<br />

– _sat can be combined with other modifiers<br />

• Negate ( - X )<br />

– Simplest to use: generates<br />

• Bias (_bias)<br />

value * 0.5f<br />

return –Color; mov r0, -c0<br />

generates _bias modifier on the source register<br />

– Note that _bias cannot be used in ps_1_1/2/3 unless the source is in [0,1] range<br />

Game Developer Conference, San Jose, CA, March 7 th 2003

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

Saved successfully!

Ooh no, something went wrong!