DirectX 10 中多重采样的操作顺序
我对 DirectX 10 中抗锯齿所需完成的过程感到困惑。我以前根本没有做过,所以可能只是我对一般过程感到困惑。
这是我到目前为止所知道的(或者我认为我知道的):您需要为着色器中使用的 RasterizerState 对象启用多重采样,并且交换链描述 (DXGI_SWAP_CHAIN_DESC) 中的 SampleDesc 需要设置为支持的值计数(质量应该保持为 0,因为其他值或特定于硬件 - 尽管我不知道有什么用)。在准备更多绘制的调用(ClearRenderTargetView 和 IASetInputLayout)和对 Present 的调用之间,应将后台缓冲区下采样(通过 ResolveSubresource)为其他大小相等的纹理。然后,(这是我找不到任何东西的部分)以某种方式呈现下采样的纹理。
难道是我一路上遇到了什么麻烦事?或者我只是在最后一步犯了错误?我看到一些资源提到在最后一次绘制具有多重采样着色器纹理(Texture2DMS<>)的全屏四边形时进行采样分辨率,但无法弄清楚这会带来什么,或者为什么要这样做通过设备调用来解决它。
我对此所做的任何尝试都不会提高图像质量。
I'm confused on the process that needs to be done for anti-aliasing in DirectX 10. I haven't done it at all before, so it may just be that I'm confused on the procedure in general.
Here's what I know so far (or think I know): you need to enable multisampling for your RasterizerState object that you use in the shader, and that the SampleDesc in the swap chain description (DXGI_SWAP_CHAIN_DESC) needs to be set to a supported value for Count (and that Quality should stay 0, since other values or hardware-specific - though I don't know what for). Between the calls to prepare for more drawing (ClearRenderTargetView and IASetInputLayout) and the call to Present, the back buffer should be downsampled (via ResolveSubresource) to an otherwise equal-sized texture. Then, (this is the part I can't find anything on) somehow present the downsampled texture.
Do I have something messed up along the way? Or am I just mistaken on the last step? I saw a few resources refer to doing the sampling resolution during one last draw to a full-screen quad with a multisampled shader texture (Texture2DMS<>), but can't figure out what that would entail, or why you would do it over the device call to just resolve it that way.
Any attempt I've made at this doesn't produce any increase in image quality.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:我正在使用DX11,你只需使用D3D10_而不是D3D11_,谢谢DeadMG。
您不需要进行任何下采样。
了解您的 GPU 支持哪种质量模式和样本数量。
你说质量等级应该是0,这是错误的。使用它来获取支持的质量模式和样本计数:
如果您想在着色器中读取多重采样纹理(例如,如果您渲染全屏四边形),则必须声明纹理Texture2DMS<>。
EDIT: I'm using DX11, you just use D3D10_ instead of D3D11_, thanks DeadMG.
You don't need to do any downsampling.
Find out what kind of quality modes and sample count your GPU supports.
You said that the quality level should be 0, that is wrong. Use this to get the supported quality modes with sample counts:
If you want to read a multisampled texture in your shader (if you render a fullscreen quad for example) you must declare the texture Texture2DMS<>.