webgl2 and multisamplerendertarget
See original GitHub issuenow that threejs has switched officially to webgl2, could pp perhaps optimize with a flag or something so that we get native MSAA instead of having to use SMAA as an effect pass?
@looeee wrote down the basic steps here: https://discourse.threejs.org/t/advantages-disadvantages-of-using-webgl2/7717/7
const composer = new EffectComposer(renderer, {
frameBufferType: HalfFloatType,
webgl2: true // ?
})
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Multisample render buffer for post processing in a WebGL2 ...
I'm using a multisample render buffer for post processing using three.js. I use a multisample renderbuffer for both read and write buffers in ......
Read more >WebGLMultipleRenderTargets – three.js docs
A special render target that enables a fragment shader to write to several textures. This approach is useful for advanced rendering techniques like ......
Read more >WebGL2 render to texture with MSAA anti-aliasing and ...
Therefore, I'm setting up rendering pipeline with a multisample renderbuffer to render to a target texture. Anti-aliasing seems to work, however if I...
Read more >Multisampling over Multiple Render Target - mrdoob/three.js
Hello! WebGL2 enables MSAA which is a great antialiasing feature. On top of that, the recent introduction of Multiple Render Target on threejs ......
Read more >WebGLMultisampleRenderTarget - Verge3D User Manual
A special render target that can be used to utilize multi-sampled renderbuffers. Heads up: WebGLMultisampleRenderTarget can only be used with a WebGL 2...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I believe it affects every effect that uses depth (SMAA with depth-based edge detection, DoF & SSAO). The
OutlineEffect
should be fine, but I haven’t checked.This article by Matt Pettineo explains MSAA in detail and says that “The coverage and occlusion tests are both performed at higher-than-normal resolution, which is typically 2x through 8x” and “For occlusion testing, the triangle depth is interpolated at each covered sample point and tested against the depth value in the z buffer. Since the depth test is performed for each subsample and not for each pixel, the size of the depth buffer must be augmented to store the additional depth values. In practice this means that the depth buffer will [be] N times the size of the non-MSAA case. So for 2xMSAA the depth buffer will be twice the size, for 4x it will be four times the size, and so on.”
The size difference of the depth texture is probably what’s causing the artifacts. This post by Phil Fortier has a section called “MSAA and SSAO together” that briefly mentions MSAA artifacts. Afaik, there’s no obvious go-to solution for this other than maybe re-rendering depth into another render target.
It’s been a few months since I’ve worked on this and I haven’t taken any notes. However, I remember trying to blit/resolve the anitialiased image into another non-multisampled render target before running SSAO, but that didn’t remove the artifacts.
MSAA support was added in postprocessing@6.13.0. Note that some effects don’t work well with MSAA. See the wiki for details.