如何在wgpu中以较低分辨率渲染?

huangapple go评论72阅读模式
英文:

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”更低的分辨率进行渲染,那么您需要

  1. 创建所需大小的纹理,
  2. 渲染到该纹理(方式与渲染到表面相同),以及
  3. 在单独的渲染通道中,通过将它放在覆盖整个屏幕的三角形上,将该纹理渲染到表面上。

这需要一些设置工作,但第二个渲染通道也是执行事物如色调映射和其他屏幕空间效果的有用机会。

英文:

If you want to render at a lower resolution than the Surface you're displaying to then you have to

  1. create a texture of the size you want,
  2. render to that (in exactly the same way you'd render to the surface), and
  3. 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.

huangapple
  • 本文由 发表于 2023年2月6日 13:24:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/75357601.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定