JonVarner Posted October 16, 2018 Share Posted October 16, 2018 I have a situation where I have three meshes: "A, B, C". What I would like to do is have mesh "A" cast a shadow on mesh "B" and meshes "A and B" to cast shadow on mesh "C". But I do not want mesh "B" to cast shadows on itself. What I have so far: window.shadowGenerator = new BABYLON.ShadowGenerator(512, light, true,true); window.shadowGenerator.getShadowMap().renderList.push(window.mesh_A); window.mesh_B.receiveShadows = true; Quote Link to comment Share on other sites More sharing options...
Guest Posted October 16, 2018 Share Posted October 16, 2018 So yes this is possible but a bit tricky You may need to create multiple lights and shadow generators. light #1 would be from A to B for instance (and thus you will add A to the shadowgenerator but exclude it from the lith with light.addExcludedMesh), etc... Quote Link to comment Share on other sites More sharing options...
JonVarner Posted October 17, 2018 Author Share Posted October 17, 2018 Thanks Deltakosh, that was the ticket. For those who might run into a similar situation here is what I came up with. light2.excludedMeshes.push(mesh_A,mesh_B); shadowGenerator = new BABYLON.ShadowGenerator(1024, light1, true,true); shadowGenerator.getShadowMap().renderList.push(window.mesh_A); mesh_B.receiveShadows = true; var shadowGenerator2 = new BABYLON.ShadowGenerator(1024, light2); var shadowGenerator2.getShadowMap().renderList.push(mesh_A,mesh_B); mesh_C.receiveShadows = true; GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.