Is it possible to implement deferred shading in We

2019-05-29 09:52发布

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?

标签: webgl
1条回答
Melony?
2楼-- · 2019-05-29 10:03

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 :)

查看更多
登录 后发表回答