英文:
How to render at a lower resolution in wgpu?
问题
我正在使用wgpu,但找不到如何在特定分辨率下进行渲染的方法。我尝试设置表面的宽度和高度,但似乎没有任何效果。我在使用的渲染或表面结构中也找不到任何方法。
英文:
I am using wgpu and I can't find anywhere how to render at a given resolution. I have tried with setting the Surface width and height but that didn't seem to do anything. I also couldn't find any methods in the render or surface structs I am using either.
答案1
得分: 1
如果您想以比您显示的“Surface”更低的分辨率进行渲染,那么您需要
- 创建所需大小的纹理,
- 渲染到该纹理(方式与渲染到表面相同),以及
- 在单独的渲染通道中,通过将它放在覆盖整个屏幕的三角形上,将该纹理渲染到表面上。
这需要一些设置工作,但第二个渲染通道也是执行事物如色调映射和其他屏幕空间效果的有用机会。
英文:
If you want to render at a lower resolution than the Surface
you're displaying to then you have to
- create a texture of the size you want,
- render to that (in exactly the same way you'd render to the surface), and
- in a separate render pass, render that texture to the surface by putting it on a triangle that covers the entire screen.
A fair bit of setup, but the second render pass is also a useful opportunity to do things like tone mapping and other screen-space effects.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论