Is it possible to implement deferred shading in WebGL?

故事扮演 提交于 2019-12-08 02:48:09

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/9820496/is-it-possible-to-implement-deferred-shading-in-webgl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!