pichou Posted October 28, 2018 Share Posted October 28, 2018 Hi everyone, I come here to share with you something While working on a project, I had issues because of the maxSimultaneousLights for a material. Indeed my scene can have a lot of lights. Rather than increasing the maxSimultaneousLights parameter, I thought it would be more performant to check what was the mesh around the light depending on its range. So I ended up with this code : checkIncludedMeshes () { let includedContent = []; for (let i = 0; i < scene.meshes.length; i++) { let mesh = scene.meshes[i]; if (mesh.absolutePosition) { let dist = BABYLON.Vector3.Distance(this.light.absolutePosition, mesh.absolutePosition); if (dist < this.light.range) includedContent.push(mesh); } } this.light.includedOnlyMeshes = includedContent; } But then I ask myself: "Why is it not the default light behaviour in BABYLONJS?" I guess there would be performance issues doing that. Anyway, I wanted to have your opinion on this and I thought that could help the community! Blax 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted October 29, 2018 Share Posted October 29, 2018 This is perfect. We do not do it for perf reasons (not all light has range, not all light has includedOnly, etc..) 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.