Forum

Get light intersection with mesh in superphysical

I have a mesh deforming on the fly and I am lighting it with a spotlight in superphysical.
The mesh textures are also generated on the fly and I would really love to know (as texture, data or whatever) which part of the mesh is in shadow at the moment.

Does anyone have a simple (and cheap) Idea how I could get that info?
I could run a whole seperate superphysical instance to only render the shadowmap but that seems really wasteful.

Thanks so much! :)

Hi.
This depends a bit on how much knowledge in shader coding you have.
If you have a look inside the SuperPhysical main shader, there is the “shadow” property within the lighting-loop, which contains the information.
You could use a multi-pass renderer and render that information to a seperate channel. Or you could render it to the alpha channel, if you are not using that.
Do you actually need the information outside of the shader at all?