Graphics Reference
In-Depth Information
// check if obstructed
// get source depth
float4 poscs2 = tex2D ( Color1SamplerPoint ,
uvoffset );
// check if source is closer to camera than target
if ( poscs2 . z < poscs . z ) return backcolor ;
// blend a bit
return lerp ( backcolor , color ,
saturate (1
yoffset ￿ d /3.8));
//
return backcolor ;
}
technique defaultshader
{ pass p0
{
= None ;
CullMode
ZEnable
= false ;
ZWriteEnable
= false ;
//
StencilEnable
= true ;
StencilFunc
= Equal ;
StencilPass
= Keep ;
StencilFail
= Keep ;
StencilZFail
= Keep ;
StencilRef
=2;
// stencil mask is set to 2
//
VertexShader
= compile vs_3_0 vsmain () ;
PixelShader
= compile ps_3_0 psmain () ;
}
}
Bibliography
[Pelzer 04] Kurt Pelzer. “Rendering Countless Blades of Waving Grass.” In GPU
Gems , edited by Randima Fernando, Chapter 7. Upper Saddle River, NJ:
Addison-Wesley, 2004.
[Whatley 05] David Whatley. “Toward Photorealism in Virtual Botany.” In GPU
Gems 2 , edited by Matt Pharr, Chapter 1. Upper Saddle River, NJ: Addison-
Wesley, 2005.
Search WWH ::




Custom Search