0

嘿,我正在使用 Directx11 中的 msaa,这很容易实现。

但现在尝试制作分屏,例如,屏幕左侧没有 MSAA 渲染,右侧使用 MSAA,所以我可以看到两者之间的差异。

在此处输入图像描述

对于我的想法,我认为,我必须创建两个不同的交换链和不同的场景并并排渲染,因为我们可以在创建交换链时设置 msaa 计数。我的意见是不是太多了?在directx11中是否有任何标准或通用(?!)方式来实现这种效果?只是一些想法将不胜感激!

4

1 回答 1

0

您可以设置 2 个不同的视口,例如:

//You can adjust these numbers as you like
//Left viewport
D3D11_VIEWPORT left_vp;
left_vp.Width = screen_width / 2;
left_vp.Height = screen_height / 2;
left_vp.MinDepth = 0;
left_vp.MaxDepth = 1;
left_vp.TopLeftX = 0;
left_vp.TopLeftY = 0;
device_context->RSSetViewports(1u, &left_vp);

device_context->Draw(3, 0);

//Right viewport
D3D11_VIEWPORT right_vp;
vp.Width = screen_width / 2;
vp.Height = screen_height / 2;
vp.MinDepth = 0;
vp.MaxDepth = 1;
vp.TopLeftX = screen_width / 2;
vp.TopLeftY = screen_height / 2;
device_context->RSSetViewports(1u, &right_vp);

device_context->Draw(3, 0);

虽然你每帧有 2 个绘图调用,但这可能没问题

阅读本文了解更多信息:

光栅化阶段入门

于 2021-02-24T15:19:29.183 回答