I have a scene in GLTF format. I can easily get and set the “receive shadow” parameter for each mesh with a simple mesh.receiveShadows accessor. But I can’t find the same for “cast shadow” functionality. Basically I want to know if a mesh is set to cast shadows on other meshes in a scene.
Will you please suggest the option of how I can derive this information for the meshes in a GLTF scene? Is there an accessor for it or a property? I’ve tried to find it in the API doc, but no success.
Shadow caster meshes are stored in an array located at the shadow generator’s render list. you can check if the mesh is in this array. Maybe someone else have a nicer answer, but that will work
Not sure if I get you correctly. From what I understand - you speak about the situation when the shadow generator’s render list is already populated. What I want to do - is exactly POPULATE the shadow generator’s render list based on the information of which meshes in the scene are set to cast shadows.
So this means, when I first read the scene, I don’t know yet which of its meshes are set to cast shadows. So I need to distinguish the meshes that are set to cast shadows from those which are not. And that’s exactly what I need that “cast shadows” information for. So any ideas how I can achieve this?
@RaananW, well yes, of course, I can define them manually in the code. But instead, I want my 3D modeler to define it, not me. And then I just want to derive this information from the scene itself. As far as I know Blender2Babylon exporter allows to set these flags for objects, here:
But then, how can I read this information from the scene?
But wait, @RaananW, AFAIK shadow generators are created for LIGHT sources, not meshes. I.e. if you would set this “Cast shadows” flag for a mesh in Blender, you would also need to define which light source this mesh should cast shadows from. And it’s obviously not like that there. So how does it work then?
Maybe we need to ping someone else to explain this?