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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Diffusely Reflective Marble<br />

Blending between two colors <strong>using</strong> a blending factor:<br />

float4 mix(float4 a, float4 b, float blendFactor)<br />

{<br />

// a * blendFactor + b * (1-blendFactor)<br />

return lerp(b, a, blendFactor);}<br />

}<br />

Computing diffuse material color:<br />

// Get the blended color (pre-diffuse):<br />

float4 Ct = mix (vein_color, base_color,turbulenceFactor);<br />

// Compute diffuse and ambient contributions:<br />

float4 DiffuseMarble = light_color *<br />

(Ct * ( Ka*ambient + Kd * soft_diffuse(Neye, Peye)<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!