我正在尝试使用 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;
但是我得到的值很奇怪。
请帮忙!我如何积累价值?