Direct3D HLSL Programming using RenderMonkey IDE
Direct3D HLSL Programming using RenderMonkey IDE Direct3D HLSL Programming using RenderMonkey IDE
Anisotropic Metal Shader Algorithm: Basic Steps 1. Determine the coordinates for vertex along the rings “trunk” volume to figure out direction of anisotropy 2. Compute anisotropic lighting contribution for two lights in the scene 3. Sample ring gradient and combine it with lighting contribution to achieve the final brushed metal look Game Developer Conference, San Jose, CA, March 7 th 2003
Determining Direction of Anisotropy Using input position, the ring volume texture Ring Compute trunk coordinate center, direction is direction determined of anisotropy and in scale texture for the determines space rings and and the propagate placement it to the propagated of the pixel to the rings shader pixel trunk for shader. volume later use VS_OUTPUT main( float4 inPos: POSITION, float4 inNormal: NORMAL ) { VS_OUTPUT o = (VS_OUTPUT)0; // Texture space coordinates: float3 texPos = ((float3)inPos) - vRingCenter; float3 texSpacePos = texPos * vRingScale + vRingDirection; texSpacePos = mul(texSpacePos, (float3x3)texture_space_matrix ); o.TexPos.xyz = texSpacePos; // Compute direction of anisotropy: float3 dirAniso = cross(inNormal, normalize(texPos)); // Propagate direction of anisotropy: o.DirAniso = dirAniso * 0.5 +(float3)0.5; … Game Developer Conference, San Jose, CA, March 7 th 2003
- Page 1 and 2: Direct3D® High Level Shader Langua
- Page 3 and 4: RenderMonkey Addresses the Needs of
- Page 5 and 6: Program Your Shaders Using Our Intu
- Page 7 and 8: High Level Shading Language • Int
- Page 9 and 10: Creating an HLSL-based Effect Using
- Page 11 and 12: HLSL Shader Editor Plug-in • Allo
- Page 13 and 14: Diffuse Lighting Effect: Pixel Shad
- Page 15 and 16: Specular Lighting: Vertex Shader st
- Page 17 and 18: Advanced Shader Examples • Marble
- Page 19 and 20: Veined Marble Shader • Based on t
- Page 21 and 22: Veined Marble Shader Algorithm: Bas
- Page 23 and 24: Vein Turbulence • Compute vein tu
- Page 25 and 26: Diffusely Reflective Marble Blendin
- Page 27 and 28: Anisotropic Metal Shader Game Devel
- Page 29: RenderMonkey Anisotropic Metal Exam
- Page 33 and 34: Computing Anisotropic Lighting: Ver
- Page 35 and 36: Assembling The Final Look • Ring
- Page 37 and 38: Translucent Iridescent Shader: Butt
- Page 39 and 40: RenderMonkey Butterfly Wings Shader
- Page 41 and 42: Translucent Iridescent Shader: Vert
- Page 43 and 44: Diffuse Illumination For Translucen
- Page 45 and 46: Making Butterly Wings Iridescent Ir
- Page 47 and 48: Example of Translucent Iridescent S
- Page 49 and 50: Generate Better PS_1_x Code Through
- Page 51 and 52: Summary • Use HLSL for your shade
Determining Direction of<br />
Anisotropy<br />
Using input position, the ring volume texture<br />
Ring Compute trunk<br />
coordinate<br />
center, direction<br />
is<br />
direction<br />
determined<br />
of anisotropy and<br />
in<br />
scale<br />
texture<br />
for the determines<br />
space<br />
rings and<br />
and<br />
the<br />
propagate placement it to the<br />
propagated<br />
of the pixel<br />
to the<br />
rings shader<br />
pixel<br />
trunk for<br />
shader.<br />
volume later use<br />
VS_OUTPUT main( float4 inPos: POSITION, float4 inNormal: NORMAL )<br />
{<br />
VS_OUTPUT o = (VS_OUTPUT)0;<br />
// Texture space coordinates:<br />
float3 texPos = ((float3)inPos) - vRingCenter;<br />
float3 texSpacePos = texPos * vRingScale + vRingDirection;<br />
texSpacePos = mul(texSpacePos, (float3x3)texture_space_matrix );<br />
o.TexPos.xyz = texSpacePos;<br />
// Compute direction of anisotropy:<br />
float3 dirAniso = cross(inNormal, normalize(texPos));<br />
// Propagate direction of anisotropy:<br />
o.DirAniso = dirAniso * 0.5 +(float3)0.5;<br />
…<br />
Game Developer Conference, San Jose, CA, March 7 th 2003