📄 mv_render.fx.bak
字号:
PS_OUTPUT0 Out = (PS_OUTPUT0) 0;
Out.Color = float4(0, 0, 0, 0.0);
Out.Depth = 100.0;
if(ClipTest.r > 0 && ClipTest.g > 0)
{
float sliceData = tex3D( MinMaxVolumeSampler, FrontSliceTex ); // front slice volume data loading
if( sliceData != 0) {
Out.Depth = InterTex.b - 0.02; // z 蔼阑 depth 肺 免仿
}
}
return Out;
}
//-------------------------------------------------------------------------------------------------------------
//---------------------- EmptySkipPShaderShowDepth (ps_pass0_showDepth) ---------------------------------------
PS_OUTPUT0 EmptySkipPShaderShowDepth( float4 FrontSliceTex : TEXCOORD0, // front slice
float4 InterTex : TEXCOORD2,
float4 ClipTest : TEXCOORD7 )
{
PS_OUTPUT0 Out = (PS_OUTPUT0) 0;
Out.Color = float4(0, 0, 0, 0.0);
Out.Depth = 100.0;
if(ClipTest.r > 0 && ClipTest.g > 0)
{
float sliceData = tex3D( MinMaxVolumeSampler, FrontSliceTex ); // front slice volume data loading
if(sliceData != 0) {
Out.Depth = InterTex.b;// - 0.02; //!!!
Out.Color.rgb = InterTex.bbb;
Out.Color.a = 1.0;
}
}
return Out;
}
//-------------------------------------------------------------------------------------------------------------
//---------------------- VolumeRenderPShader (ps_pass1) --------------------------------------------------------
PS_OUTPUT1 VolumeRenderPShader( float4 FrontSliceTex : TEXCOORD0, // front slice
float4 BackSliceTex : TEXCOORD1, // back slice
float4 ClipTest : TEXCOORD7 )
{
PS_OUTPUT1 Out = (PS_OUTPUT1) 0;
// clip(ClipTest);
if(ClipTest.r > 0 && ClipTest.g > 0)
{
float fSliceData = tex3D( VolumeDenSampler, FrontSliceTex ); // front slice volume data loading
float bSliceData = tex3D( VolumeDenSampler, BackSliceTex ); // back slice volume data loading
// FTB 捞骨肺 preInt 老锭档 front slice 俊辑 gradient 啊廉颗.
float3 gradient = tex3D( GradientSampler, FrontSliceTex ).rgb; // gradient from front slice
gradient = normalize( gradient - 0.5 ); // normalize
// float4 diff = saturate( dot( gradient, lightVec )); // diffuse component N.L
float4 diff = abs( dot( gradient, lightVec )); // diffuse component N.L
// float4 diff = abs( dot( gradient, float3(0,1,0) )); // light 绊沥
float4 otfCAlpha = tex2D( PreIntOtfSampler, float2(fSliceData, bSliceData) ); // load otf color & alpha value
// Out.Color = 0.2 + 0.8 * diff;
Out.Color = 0.1 + 0.8 * diff;
/* // 2. using shader alpha blending
float4 interColor = tex2D( IntermediateRenderTarget, InterTex.rg );
float invAlphaIn = 1-interColor.a;
Out.Color.rgb = interColor.rgb + invAlphaIn*Out.Color.rgb*otfCAlpha.a; // mul otf color value
Out.Color.a = interColor.a + otfCAlpha.a*invAlphaIn; // set out alpha to otf alpha value
*/
// 1. using FF alpha blending
// Out.Color.rgb *= otfCAlpha.a; // nonPre-Int 老 版快
Out.Color.rgb *= otfCAlpha.rgb; // pre-Int 老 版快 OW 烙..
Out.Color.a = otfCAlpha.a;
}
return Out;
}
//-------------------------------------------------------------------------------------------------------------
//---------------------- EarlyRayPShader (ps_pass2) -----------------------------------------------------------
PS_OUTPUT0 EarlyRayPShader( float4 InterTex : TEXCOORD2 )
{
PS_OUTPUT0 Out = (PS_OUTPUT0) 0;
//------- for Early RayTermination --------------
float4 interColor = tex2D( RenderTargetSampler, InterTex.rg );
Out.Depth = 0.0;
Out.Color = 0.0;
// early ray termination
if( interColor.a >= 0.99 ) {
Out.Depth = 100.0;
}
return Out;
}
//-------------------------------------------------------------------------------------------------------------
//---------------------- FinalPShader (ps_passFinall) ------------------------------------------------------
float4 FinalPShader( float4 QuadTex : TEXCOORD0 ) : COLOR0
{
float4 Color = tex2D( RenderTargetSampler, QuadTex );
// Color.a = 1;
// Color.r = 1;
return Color;
}
//-------------------------------------------------------------------------------------------------------------
//---------------------- Mesh shader ------------------------------------------------------
PS_OUTPUT1 MeshRenderPShader( float3 MeshTex : TEXCOORD0 )
{
PS_OUTPUT1 Out;
Out.Color = tex2D( MeshSampler, MeshTex );
return Out;
}
PS_OUTPUT1 MPRRenderPShader( float3 MeshTex : TEXCOORD0 )
{
PS_OUTPUT1 Out;
float color;
color = tex3D( VolumeDenSampler, MeshTex );
Out.Color.rgb = color;
Out.Color.a = 1.0f;
return Out;
}
//-------------------------------------------------------------------------------------------------------------
technique MVRenderTechnique
{
pass EmptySkipPass // pass0
{
ClipPlaneEnable=0;
AlphaBlendEnable=false;
ZEnable=true;
ZWriteEnable=true;
ZFunc=less;
CullMode=none;
VertexShader = compile vs_2_0 EmptySkipVShader();
PixelShader = compile ps_2_0 EmptySkipPShader();
}
pass VolumeRenderPass // pass1
{
ClipPlaneEnable=CLIPPLANE0 | CLIPPLANE1 | CLIPPLANE2 | CLIPPLANE3 | CLIPPLANE4 | CLIPPLANE5;
AlphaBlendEnable=true;
ZEnable=true;
ZWriteEnable=false; // FALSE !
ZFunc=greaterequal;
CullMode=none;
VertexShader = compile vs_2_0 VolumeRenderVShader();
PixelShader = compile ps_2_0 VolumeRenderPShader();
}
pass EarlyRayPass // pass2
{
ClipPlaneEnable=CLIPPLANE0 | CLIPPLANE1 | CLIPPLANE2 | CLIPPLANE3 | CLIPPLANE4 | CLIPPLANE5;
AlphaBlendEnable=true;
ZEnable=true; // D3DRS_ZENABLE 捞 拌加 TRUE 肺 汲沥登绢具 shader 郴何俊辑 depth 函版啊瓷窍骨肺 TRUE肺..
ZWriteEnable=true; // TRUE !
ZFunc=greaterequal;
CullMode=none;
VertexShader = compile vs_2_0 EarlyRayVShader();
PixelShader = compile ps_2_0 EarlyRayPShader();
}
pass FinalPass // pass3
{
ClipPlaneEnable=0;
AlphaBlendEnable=false;
ZEnable=false;
ZWriteEnable=false;
CullMode=none;
VertexShader = NULL;
PixelShader = compile ps_2_0 FinalPShader();
}
pass ShowDepthPass // pass4
{
ClipPlaneEnable=0;
AlphaBlendEnable=false;
ZEnable=true;
ZWriteEnable=true;
ZFunc=less;
CullMode=none;
VertexShader = compile vs_2_0 EmptySkipVShader();
PixelShader = compile ps_2_0 EmptySkipPShaderShowDepth();
}
pass MeshRenderPass // pass5
{
ClipPlaneEnable=CLIPPLANE0 | CLIPPLANE1;
AlphaBlendEnable=true;
ZEnable=false;
CullMode=ccw;
VertexShader = compile vs_2_0 MeshRenderVShader();
PixelShader = compile ps_2_0 MeshRenderPShader();
}
pass MPRRenderPass // pass6
{
ClipPlaneEnable=CLIPPLANE0 | CLIPPLANE1;
AlphaBlendEnable=true;
ZEnable=false;
CullMode=none;
VertexShader = compile vs_2_0 MPRRenderVShader();
PixelShader = compile ps_2_0 MPRRenderPShader();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -