how to achieve split screen effect in directx11

400 Views Asked by At

hey i am working on msaa in directx11 which is pretty easy to implement.

but now trying to make split screen for example, left side of screen is rendered without MSAA and right side is with MSAA, so i can see the differences between.

enter image description here

for my idea, i think, i have to create two different swapchain and different scenes from these and render together side by side, since we can set msaa count when creating swapchain. Is my opinion too much or not? Is there any standard or common(?!) way to implement this effect in directx11? just a few idea would be really appreciated !!

1

There are 1 best solutions below

1
Problematic On

You can setup 2 difference viewport, For example:

//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);

Although you have 2 draw calls per frame but that probably fine

Read this for more information:

Getting Started with the Rasterizer Stage