Hacker News new | ask | show | jobs
by stevebmark 546 days ago
One of the big unlocks of WebGPU - shown here - is many lights in the scene, which is not possible with WebGL.

You might notice this still looks pretty dated, and that's primarily because the scene doesn't include ambient occlusion, which is usually the most important lighting feature to fake for realistic looking lighting.

4 comments

What do you mean? Many lights rendering is very possible in WebGL. You need MRT (Multiple Render Target) support, which is widely available, and you can use that to implement a deferred pipeline. Here's an example from my favorite WebGL library: https://oframe.github.io/ogl/examples/?src=mrt.html

MRT support is available in WebGL 2 by default and in WebGL 1 with an extension.

You might be referring to some of the newer GPU-side light culling algorithms using compute shaders. I think that's the only major drawback of WebGL, the lack of compute shaders, but that can be worked around with some effort.

The only thing which I'd call unreasonable to implement in WebGL would the fancier virtual geometry approaches like Nanite, but for 98% of web 3D graphics WebGPU still seems excessive to me. Maybe around 2030 it'll be stable and widely available enough to start using for everything

You don't even need MRT to do deferred shading. You can do a light pre-pass as described here https://diaryofagraphicsprogrammer.blogspot.com/2008/03/ligh.... There's limitations because without MRT you can only output the normal in RGB and roughtness in A, but it works.
You can support many lights in WebGL just like you would with OpenGL. I implemented a rendering engine in WebGL2 a couple of months ago with deferred shading and support for hundreds of point lights using light volumes. I also implemented ambient occlusion, and directional lights with cascaded shadow mapping.
You can enable SSAO (Screen Space Ambient Occlusion) in the demo settings.
>One of the big unlocks of WebGPU - shown here - is many lights in the scene, which is not possible with WebGL.

Why not? My Firefox won't run the demo, so I don't know what it is doing that wouldn't be possible with WebGL. AFAIK there is no inherent reason why you can't render many lights using WebGL.