DirectX 中的拉伸位块传输会导致锯齿状边缘

发布于 2024-08-15 13:08:33 字数 388 浏览 12 评论 0原文

我有一个 Direct3D 应用程序,它以固定分辨率(例如 800x600)运行窗口或全屏。为了支持宽屏模式,我以 800x600 渲染到后台缓冲区,然后使用 Blt 将最终帧绘制到前台缓冲区的一部分中,该部分通常更大(例如 1280x720),因此 800x600 图像被拉伸到 960x720 以保持长宽比。

这工作得很好,除了在某些显卡/操作系统/驱动程序组合(nVidia Quadro、DX11、Windows 7)中,块传输似乎是使用点采样完成的,导致锯齿状边缘和通常不平滑的最终图像。

有什么办法可以避免这种情况吗?例如,在放大时强制 Blt 使用线性滤波器?

(注:我知道我可以将原始 800x600 资源渲染为 960x720,而不是在最后拉伸,但这还有其他缺点,因此在最后拉伸是首选解决方案)

I have a Direct3D app which runs windowed or fullscreen at a fixed res (say 800x600). To support widescreen modes, I render to the back buffer at 800x600 and then use Blt to draw the final frame into a portion of the front buffer, which is usually bigger (say 1280x720), so the 800x600 image is stretched to 960x720 to maintain the aspect ratio.

This works fine, except in some video cards/OS/driver combination (nVidia Quadro, DX11, Windows 7) where the blit appears to be done using point sampling, resulting in jagged edges and a generally unsmooth final image.

Is there any way to avoid this? For example, force Blt to use a linear filter when scaling up?

(Note : I know I can render the original 800x600 assets to 960x720 instead of stretching at the end, but that has other drawbacks, so stretching at the end is the preferred solution)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

原来分手还会想你 2024-08-22 13:08:33

我不认为有任何方法可以控制这一点。我读到一些内容说这种行为在 windows7 中通过某些驱动程序发生了变化,但我现在找不到参考。

您也许可以渲染为 800x600 的纹理,然后使用该纹理以实际屏幕尺寸绘制全屏四边形。那么至少你可以控制过滤。

I don't think there is any way to control this. I read something saying that this behavour changed in windows7 with some drivers but I can't find the reference now.

You could perhaps render to a texture at 800x600 and then draw a full screen quad using this texture at the actual screen size. Then at least you could control the filtering.

ˇ宁静的妩媚 2024-08-22 13:08:33

您是否考虑过将场景渲染到纹理,然后将该纹理渲染到拉伸的后缓冲区?这会让你感到胆怯。

它在某些机器上工作的原因是,这正是驱动程序实现 blit 的方式。

不过,为了获得最佳结果,您真的最好不要只渲染到适当大小的后缓冲区。即,如果您想要 1280x720 ... 渲染到 1280x720 后台缓冲区,并进行适当的视野和纵横比修改。

Have you considered rendering the scene to a texture and then rendering that texture to the backbuffer stretched? This will give you bilerping.

The reason it works on some machines is that this is exactly how the blit will be implemented by the driver

To get best results, though, you REALLY are betetr off just rendering to the proper sized backbuffer. ie if you want 1280x720 ... render to a 1280x720 back buffer with the appropriate field of view and aspect ratio modifications.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文