如何使用 CheckMultisampleQualityLevels 并启用多重采样
我正在学习 directx 11 并尝试设置多重采样。由于某种原因,互联网上的每个教程都禁用多重采样,并且从未讨论如何启用它。
首先:我进行了搜索,但找不到任何有关如何使用 CheckMultisampleQualityLevels
的示例。似乎您需要创建一个设备,调用该函数,找出可用级别,然后销毁该设备并使用您想要的设置创建一个新设备。这是执行此操作的正确方法吗?或者有更好的方法吗?
其次,如何启用多重采样?由于我不确定如何使 CheckMultisampleQualityLevels
正常工作,因此我尝试为 DXGI_SWAP_CHAIN_DESC.SampleDesc.Count
和 DXGI_SWAP_CHAIN_DESC.SampleDesc.Quality
输入一些值> (如 4 和 4),当它运行时,没有显示任何内容(如果我输入像 33 和 2 这样的疯狂值,它会出错)。除了交换链描述之外,是否还需要在其他地方设置它,或者着色器是否以某种方式干扰它(我设置了基本的灯光和纹理着色器)?
我有 GTX 570,所以我知道它可以支持大多数 AA 设置。我正在关注这组教程,以防有任何帮助: http://rastertek.com/tutindex.html
I'm learning directx 11 and trying to set up multisampling. For some reason every tutorial on the internet disables multisampling and never goes over how to enable it.
First: I've searched around and can't find any examples of how to use CheckMultisampleQualityLevels
. It seems like you need to create a device, call that function, find out the available levels, then destroy that device and create a new one with the settings you want. Is this the correct way to do this? Or is there a better way?
Secondly, how do you enable multisampling? Since I'm not sure how to get CheckMultisampleQualityLevels
working, I tried putting in some values for DXGI_SWAP_CHAIN_DESC.SampleDesc.Count
and DXGI_SWAP_CHAIN_DESC.SampleDesc.Quality
(like 4 and 4) and while it does run, nothing is displayed (it does error if I put in crazy values like 33 and 2). Does this need to be set somewhere else besides the swap chain description or do shaders interfere with it in some way (I have a basic light and texture shader set up)?
I have a GTX 570, so I know it can support most AA settings. I'm following this set of tutorials, in case it's of any help: http://rastertek.com/tutindex.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
1.调用 ID3D11Device::CheckMultisampleQualityLevels ,它为您提供适配器支持的质量级别。
2.填写DXGI_SWAP_CHAIN_DESC时,设置 SampleDesc.Count 和 SampleDesc.Quality。
3.如果使用多样本抗锯齿,则所有绑定的渲染目标和深度缓冲区必须具有相同的样本计数和质量级别。 (DXGI_SAMPLE_DESC 结构 )
根据关于D3D11_RASTERIZER_DESC的msdn文档(D3D11_RASTERIZER_DESC结构),API 功能级别 10.1 及更高版本中,MultisampleEnable 对 MSAA 方面的点和三角形没有影响,仅影响线条渲染算法的选择。
您应该查看 msdn 以获取更多详细信息。
1.Call ID3D11Device::CheckMultisampleQualityLevels, which gives you the quality level supported by the adapter.
2.While filling out the DXGI_SWAP_CHAIN_DESC, set the SampleDesc.Count and SampleDesc.Quality.
3.If multi-sample antialiasing is being used, all bound render targets and depth buffers must have the same sample counts and quality levels. (DXGI_SAMPLE_DESC structure)
According to the msdn document about D3D11_RASTERIZER_DESC (D3D11_RASTERIZER_DESC structure), API feature level 10.1 and higher, MultisampleEnable has no effect on points and triangles with regard to MSAA and impacts only the selection of the line-rendering algorithm.
You should check out the msdn for more details.
这对我有帮助:
感谢@Telanor 和@user1253930
this helped me:
thanks @Telanor and @user1253930
您应该尝试设置 MultisampleEnable D3D11_RASTERIZER_DESC 。
还将质量设置为 1。
对于 CheckmultisampleQuality,您只需设置要创建的 DXGI 格式即可。您想要的样本数量。最后传递一个指向 uint 的指针,它将返回可用的质量级别数。如果它返回 0,则不支持多重采样,否则您知道可以设置什么质量级别。
You should try setting MultisampleEnable D3D11_RASTERIZER_DESC.
Also set quality to 1.
As for CheckmultisampleQuality you simply set the DXGI format you want to create. The number of samples you want. Finally pass in a pointer to a uint and it will return the number of quality levels available to you. If it returns 0 then multisampling is not supported otherwise you know what quality levels you can set.