It seems to can not transmit light space matrix to vertex shader, any way else can implement shadow ?
Maybe you could explain a little bit more about what do you want to achieve?
Are you talking about ray/shadowcasting like this:
My project is based 3d, I want to know how to implement shadow in 3d game ? like shadow mapping/shadow volume.
Well, realtime shadows is something of a jungle and not the easiest to jumpstart into but I would start by looking at http://fabiensanglard.net/shadowmapping/ and then see if you can figure out what to do with the render script to support that.
Something like this maybe:
- Render “something” into a texture / framebuffer, where something could be a textured quad or whatever or even just a clear color
- Verify the result when rendering out the scene, i.e use the texture and sample from it to make sure you rendered to it
- Switch to rendering the 3D scene with a depth shader to the texture with an orthographic camera
- Sample the shadow map with a different shader that projects the fragment into the shadow POV camera and compare the depths
- Celebrate success!
There’s obviously lot’s of steps and details in between, but I don’t think we can just provide a snippet of code that just works right off the shelf atm. If I have time some day maybe I can implement it
Thank you ! if have chance, please give me a demo.