渲染到纹理的一部分
由于 OpenGL 中使用几何着色器的分层渲染在某些驱动程序/硬件上似乎有点棘手,因此我想用我自己的解决方案替换该功能。这是通过使用大纹理作为渲染目标,例如分辨率为 300²。然后通过渲染纹理中的 100² 块来模拟分层渲染。使用该分辨率,将产生 9 个图块/图层,如下面的模型所示:
问题是;如何使用 OpenGL 做到这一点?据说是在几何着色器的帮助下,一次性将场景渲染到不同的图块上。?
Since layered rendering with a geometry shader in OpenGL seems a bit dodgy on some drivers/hardware, I would like to substitute the functionality with my own solution. This by using a big texture as rendertarget, with for example a resolution of 300². Then simulating layered rendering by rendering to 100² chunks in the texture. With that resolution it would result in 9 tiles/layers as shown in the mockup below:
The question is; how to this with OpenGL? Supposedly with help of a geometry shader that renders the scene to the different tiles in one pass.?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有简单的方法可以做到这一点。您可以使用几何着色器将其组合在一起,但它很可能会很慢,因为您必须执行大量几何实例,然后还使用几何着色器进行顶点着色,因为顶点着色器已退出游戏。
解决问题的基本方法:
There is no simple way to do it. You can use geometry shader to hack it together but it will most probably be slow, as you have to perform a lot of geometry instancing and then use the geometry shader for vertex shading as well because vertex shader is out of the game.
Basic approach to the problem: