多重采样和超级采样哪个流畅_显式多重采样与OpenGL中的常规多重采样有何不同...

I was reading this tutorial on MSAA in deferred shading, from 28byteslater.com.

It says that in explicit multisampling we can access a particular sample.

Could not we do the same from a regular texture that was bound to GL_TEXTURE_2D_MULTISAMPLE for instance?

This was the shader code that I used to use earlier for accessing individual samples (without using explict multisampling):

uniform sampler2DMS Diffuse;

ivec2 Texcoord = ivec2(textureSize(Diffuse) * In.Texcoord);

vec4 colorFirstSample = texelFetch(Diffuse, Texcoord, 0);

vec4 colorSecondSample = texelFetch(Diffuse, Texcoord, 1);

vec4 colorThirdSample = texelFetch(Diffuse, Texcoord, 2);

The only thing I see different in explicit multisampling is that they are using texelFetchRenderbuffer() in shader and texture is bound to GL_TEXTURE_RENDERBUFFER_NV.

Plus If I remember correctly its not possible to use a RenderBuffer in shader and now we can?

解决方案

I think you are a little confused. Before OpenGL 3.2 / DirectX 10 came along, the only way to do multisample anti-aliasing (MSAA) was to blit a multisample buffer and have it do the "resolve" (the process by which multiple samples are literally resolved into a single sample for normal output). This was about all multisampling was good for, too - it could not be used explicitly in shaders.

GL3.2 / DX10 introduced "explicit" (programmable) multisample resolve, in the form of multisample textures. The way you access the individual samples in a shader is through the use of texelFetch (...). This new functionality allows MSAA to be implemented in deferred shading engines, because now the lighting shader is able to multisample resolve the G-Buffers when they are fetched. This new feature also opened up the possibility of using multisample buffers for things unrelated to anti-aliasing, order-independent transparency through a technique called Stencil Routed A-Buffering comes to mind immediately.

In short, DX10-class hardware allows multisample buffers to function as textures. This means very little had to be done to existing shading languages like HLSL and GLSL in order to expose multisample fetches; you do sacrifice certain things like mipmaps and filtering, but you can actually implement those yourself if you are so inclined. One thing DX10 lacked, however, was support for multisample depth textures - DX10.1 added this.

Prior to OpenGL 3.2, there were vendor specific extensions (e.g. NV_explicit_multisample) that allowed multisample texturing, since the hardware had already supported it since ~2007 (with the release of DX10). On OpenGL 3.2 implementations, ignore the vendor specific stuff and simply use ARB_texture_multisample.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值