FBO +具有多重采样和深度/模板的 RTT

发布于 2024-12-26 17:16:57 字数 1214 浏览 0 评论 0原文

我目前正在通过 FBO+RTT 和 MRT 进行渲染,并且我正在研究通过多重采样(而不是超级采样)实现抗锯齿的可能性,但我对规范有点困惑(我指的是 opengl 规范 4.2 - 所以 FBO 中的多重采样纹理是支持)以及我读过的内容......特别是:

1)

如果我做对了,我有2个选择:a)通过多重采样进行多重采样渲染缓冲区,或 b) 使用多重采样纹理进行多重采样(并继续使用 RTT,就像我现在所做的那样),现在:

两种方法都会产生相同的输出吗?

2)

我使用 RTT,因为我需要 4 个颜色附件来进行多通道渲染。将第一个场景渲染为纹理后,该纹理将被馈送到不同的片段着色器,这些片段着色器通过普通的 Sampler2D 访问其数据。

我应该使用渲染缓冲区而不是纹理,片段着色器有没有办法访问渲染缓冲区的数据?

3)

我在规范中读到,附加了多重采样渲染缓冲区的 FBO 不需要深度/模板,因为该信息保存在多重采样渲染缓冲区中,

这是否意味着附加了多重采样渲染缓冲区的每个颜色附件都具有它自己的深度/模板?

FBO 中的多重采样纹理作为 RT 怎么样?我不认为他们存储任何深度/模板信息..我是对的吗?如果我使用 FBO+多重采样纹理实现多重采样,我还需要 DEPTH_STENCIL_ATTACHMENT 吗?如果是这样,深度多重采样怎么样?

4)

我只需要 1 个纹理/渲染缓冲区进行抗锯齿,而另一个纹理/渲染缓冲区必须保持其锯齿状边缘。我在规范中读到,使用 FBO 和多重采样,附加的每个可渲染对象必须具有相同数量的样本(尽管可能有所不同)尺寸)。

有没有办法只对 2 个 RT 中的 1 个进行多重采样?以下是规范中关于 teximage2DMultisample (fixedsampledlocation) 中最后一个参数的内容:

If fixedsamplelocations is TRUE, the image will use identical
sample locations and the same number of samples for all texels
in the image, and the sample locations will not depend on the
internalformat or size of the image.

这是否意味着样本位置固定的多重采样纹理将保持多重采样格式,但实际上表现为常规(非多重采样)纹理? (即:每个样本位置都具有相同的值)?

I am currently rendering via FBO+RTT with MRT, and I was investigating the possibility to implement antialiasing via multisampling (instead of supersampling), but Im a bit puzzled by the specs (I refer to opengl spec 4.2 - so multisampled textures in FBO are supported) and what Ive read around.. in particular:

1)

if I got it right, I have 2 options: a) multisampling via multisampled renderbuffer(s), or b) multisampling using multisampled texture(s) (and keep on with RTT as Im doing right now), now:

do both methods produce identical output?

2)

im using RTT because I need 4 color attachements for a multipass rendering. After the first scene has been rendered to texture, that texture is then fed to different fragment shaders that access its data by a normal sampler2D.

should I use renderbuffers instead of textures, is there a way for a fragment shader to access the data of a renderbuffer?

3)

Ive read in the specs that a FBO with multisampled renderbuffers attached does not need a depth/stencil, since that information is kept in the multisampled renderbuffer(s)

does it mean that every color attachment to which a multisampled renderbuffer is attached, has its own depth/stencil?

what about multisampled textures as RT in a FBO? I dont think they store any depth/stencil information.. am I right? If I implement multisampling with a FBO+multisampled texture(s), do I still need a DEPTH_STENCIL_ATTACHMENT? if so, what about multisampling on depth?

4)

I only need 1 texture/renderbuffer to be antialiased, while another one MUST keep its jagged edges.. Ive read in the specs that with a FBO and multisampling, every renderable attached must have the same number of samples (altough may vary in size).

Is there a way to have only 1 of 2 RT multisampled? heres what the specs say concering the last param in teximage2DMultisample (fixedsampledlocation):

If fixedsamplelocations is TRUE, the image will use identical
sample locations and the same number of samples for all texels
in the image, and the sample locations will not depend on the
internalformat or size of the image.

does it mean that a multisampled texture with the sample locations fixed will keep the multisampled format but actually behave as a regular (non-multisampled) texture? (ie: every sample location will have the same value)?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文