MSAA Variable rate shading

Return to WebGPU Experiments
Published on 2024-07-12 by Noxim

This is an experiment in approximating variable rate shading (VRS) with a quarter resolution 4x MSAA framebuffer. By rendering to a downscaled framebuffer, you can save significant amount of fragment shading work. However, normally the upscaled framebuffer has a blurry look. By using 4x MSAA, you can render the edges of primitives at "native" resolution, reducing the blurriness for slight performance hit. Quarter-res rendering can be very useful for drawing already blurry things, like objects behind glass or particles.

WebGPU does not have programmable sample locations, so the edge quality is not great due to the sampling grid being irregular. This may or may not be a deal breaker. You can use a more sophisticated compute shader to resolve the final image, possibly blending between samples as well.

This trick has been previously detailed in "Stairway To (Programmable Sample Point) Heaven" by MJP.

Your browser does not support canvas elements
Press Alt-Enter to execute