3 ms·
This is a great tutorial leading one to learn about GPU imposters. If you liked this, I suggest you look at Fortnite: https://www.shaderbits.com/blog/octahedra
by fxtentacle 6y ago
This is a great tutorial leading one to learn about GPU imposters.
If you liked this, I suggest you look at Fortnite:
https://www.shaderbits.com/blog/octahedral-impostors https://www.shaderbits.com/blog/octahedral-impostors
However, let me point out a very big gotcha with this technology: Usually, outputting a custom z-depth will disable any sort of early z-culling in the GPU. That means the performance hit of drawing this might be huge, and even more costly than drawing the high-res models if screen coverage is large enough. That's why game engines will usually run a skybox pre-pass to get a stencil mask on where imposters might be needed and then only render there.
- jleahy 6y agoDoes a depth prepass not avoid this?
- fxtentacle 6y agoYes and no. The pixel shader still has to be run for every pixel covered by the impostor, because you don't know in advance if the custom depth will be in front of or behind the z-prepass. So you likely pay the full rendering price for an impostor, even if it completely invisible.
- bgolus 6y agoSV_Depth disables early z culling for that draw. But doesn't disable early z culling for subsequent draws. It does disable some z buffer compression that some older / mobile GPUs implement, but that's less of an issue for modern GPUs. As for disabling early Z culling when drawing the impostor, the section titled "Fragmented Depth" covers this problem, and the solution. https://bgolus.medium.com/rendering-a-sphere-on-a-quad-13c92025570c#bb36 https://bgolus.medium.com/rendering-a-sphere-on-a-quad-13c92...
- fxtentacle 6y agoYes, there is a SM5 extension to reduce the impact when you're on a high-end Windows PC. But for most games, relying on that is not really practical, or else you lose Linux, Mac, most consoles and mobile. I agree that impostors are great for far-distance background. But I would never use them for anything too close to the camera. So in a sense, impostors are the new skybox.
- bgolus 6y agoVulkan & Metal both have equivalents, at least for Linux & MacOS. As do most modern consoles. Mobile is an issue, yes. Though curiously sphere impostors were first proposed for use with and implemented using GLES 2.0 for a significant performance and quality improvement in drawing thousands of spheres for molecular rendering. It all depends on what your use case is. Also hardware with Shader Model 5.0 support came out >10 years ago now. There aren't a lot of desktop computers still using hardware that don't support it.