Reputation: 3455
As I understand, the only way to implement deferred shading is using MRT and binding different textures to store data to the color attachments. The problem is that the WebGL specifications defines a single color attachment: COLOR_ATTACHMENT0. Is it possible to implement deferred shading at all in WebGL with this restriction?
Upvotes: 2
Views: 1246
Reputation: 579
You can implement deferred shading by rendering to textures, but you need to either redraw all geometry for each pass (diffuse, depth, whatnot) or come up with a way to store all information you need into a single RGBA texture. Then sample these textures in your shader to produce the final result.
There's an extension for float textures you might want to use but isn't guaranteed to work everywhere.
As you probably understand, deferred is not optimal in WebGL :)
Upvotes: 2