【发布时间】:2012-09-25 03:21:48
【问题描述】:
我正在尝试使用 MRT 实现延迟着色。为此,我需要在两个渲染目标中累积颜色和法线。为此,我定义了两个 R32G32B32A32 纹理。
像素缓冲区输出到两个渲染目标。但是,我如何指示它累积这些值,而不是替换或混合它们?
我尝试定义以下混合状态:
blendState.RenderTarget[0].BlendEnable = TRUE;
blendState.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
blendState.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
blendState.RenderTarget[0].DestBlend = D3D11_BLEND_ONE;
blendState.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
blendState.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
blendState.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE;
blendState.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
blendState.RenderTarget[1].BlendEnable = TRUE;
blendState.RenderTarget[1].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
blendState.RenderTarget[1].SrcBlend = D3D11_BLEND_ONE;
blendState.RenderTarget[1].DestBlend = D3D11_BLEND_ONE;
blendState.RenderTarget[1].BlendOp = D3D11_BLEND_OP_ADD;
blendState.RenderTarget[1].SrcBlendAlpha = D3D11_BLEND_ONE;
blendState.RenderTarget[1].DestBlendAlpha = D3D11_BLEND_ONE;
blendState.RenderTarget[1].BlendOpAlpha = D3D11_BLEND_OP_ADD;
但是我得到的值很奇怪。
请帮忙!如何积累价值?
【问题讨论】:
-
..你的意思是'如何添加颜色'?
-
从某种意义上说,是的。我希望它们在渲染目标上累积,以便在下一次传递中使用它们。
标签: graphics directx shader lighting