Advertisement

Render to specific cubemap mip

Started by May 19, 2017 08:58 PM
1 comment, last by galop1n 7 years, 8 months ago

Hey all!

I am starting to implement dynamic cubemaps in my renderer. I have to top level mip by rendering 6 faces into 6 separate RTs. I then merge them into a cubemap.

All of this is fine, I now want to filter the mips with some brdf convolution a-la UE4. I can't find how can I render to a specific mip of the cubemap? I assume I need to render to different cubemaps and then merge them into a mip chain? How can I do this? I am not finding info online...

To be clear, I am not asking for the convolution technique per se, but just how to set the render to separate mips in d3d or how to merge separate targets into a mip chain.

Thank you very much

Jacques

If you're using a pixel shader and you would like to write to a specific mip as a render target, you need to create a render target view that specifically targets the mipmap and face index. You can do that by specifying the appropriate values for MipSlice, FirstArraySlice, and ArraySize in the D3D11_TEX2D_ARRAY_RTV struct that's a member of D3D11_RENDER_TARGET_VIEW_DESC (it's the same for D3D12 if you're using that API instead of D3D11). If you're using a compute shader, you have to instead create an unordered access view that targets the mip level that you want to write to. It's basically the same as creating the RTV, where you set the appropriate values for the MipSlice, FirstArraySlice, and ArraySlice members of D3D11_TEX2D_ARRAY_UAV, which is a member of D3D11_UNORDERED_ACCESS_VIEW_DESC.

Advertisement
Something to note, the uav way open optimisation as you can produce severalemips in one pass, reducing load bandwidth for example.

This topic is closed to new replies.

Advertisement