Shadow Volumes in WebGL/GLSL

泪湿孤枕 提交于 2020-01-25 08:14:26

问题


I am trying to implement shadow volumes using webgl and glsl for shaders.

Currently I have a cube floating above a green ground with light coming from above but I am completely unaware of how to begin the implementation of shadow volumes. If anyone has any helpful tutorials or advice that would be greatly appreciated. I am fascinated by Shadow Volumes (not Shadow Maps) and really want to learn how to create them.

I understand the general procedure to be:

  1. Perform ambient rendering pass
  2. Choose a light source and determine which objects cast shadows into visible region of the world
  3. Calculate the silhouette and construct a shadow volume
  4. Render the shadow volume using stencil opeerations that leave nonzero values in the stencil buffer
  5. Perform a lighting pass using the stencil to mask areas that are not illuminated by the light source

That being said I don't really understand how to do this in webgl and am looking for help.

I also had one question. Given that this seems to have multiple rendering passes does that mean I need to implement deferred shading?

Hopefully some of you would be gracious enough to help me learn and make something cool.

Thanks for taking the time to read this over.

来源:https://stackoverflow.com/questions/59232100/shadow-volumes-in-webgl-glsl

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