问题
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:
- Perform ambient rendering pass
- Choose a light source and determine which objects cast shadows into visible region of the world
- Calculate the silhouette and construct a shadow volume
- Render the shadow volume using stencil opeerations that leave nonzero values in the stencil buffer
- 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