Shadow shader and FBO
Hi everyone,
I'm trying to implement a custom shader for casting shadows using a shadow map technique. To do so, i'd need to render the scene off-screen into a framebuffer as viewed from the light position. What it's not clear to me is if i can write into a framebuffer and access it from within the same shader in one pass or it is not possible in a jitter shader.
I saw time ago an illuminating example of a jitter patch implementing a depth of field fx in which the depth map was rendered to a texture with the "to_texture" message to [jit.gl.render] and the rendering happened in two steps. I think this may work as an alternative, but i was wandering if there's a simpler and hopefully more performant way to accomplish the task. (btw, "to_texture" doesn't work with [jit.world], right?).
Could you give me an insight?
Thanks!
search the file browser for lights.shadow.map.texture for an example of how to get the depth-texture used for shadowing from the jit.gl.light object, that you can perform custom shadowing with.
otherwise you can use a jit.gl.camera @capture 1 to render objects with your own custom shadow depth capture shader, if the built-in algo jit.gl.light uses is insufficient
Thanks Rob, that was exactly waht i was looking for!
Definitely interested to see how this develops Matteo
I' ll keep you updated Federico ;)
Hi, did you have any success with this? I'm trying to make crosshatched shadows (see this forum post), and I think that is is something that I need to solve to do it.