rainerpl Posted November 2, 2016 Share Posted November 2, 2016 Hi, I have a scene where a mesh has a light 10 units away from it with intensity of 1. Id like to know a formula/way of setting lights intensity to such a value, that when it is moved to 20 units away from the mesh, it would still light the mesh as intensely as before. Simply doubling the intensity value doesnt work. Quote Link to comment Share on other sites More sharing options...
Convergence Posted November 2, 2016 Share Posted November 2, 2016 I don't believe lights in babylon attenuate, so this already happens by default. Quote Link to comment Share on other sites More sharing options...
rainerpl Posted November 2, 2016 Author Share Posted November 2, 2016 I think it depends on the range and radius attributes. It does attenuate once distance is greater than range, but it seems up to that point...it remains constant Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 2, 2016 Share Posted November 2, 2016 @rainerpl It highly depends on the type of light And please create a PG; http://www.babylonjs-playground.com/ Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 2, 2016 Share Posted November 2, 2016 For point light or spot lights, here is the formula: https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/ShadersInclude/lightsFragmentFunctions.fx#L19 To avoid the attenuation just set light.range to number.MAXVALUE JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
rainerpl Posted November 2, 2016 Author Share Posted November 2, 2016 Thanks for the replies. I was using point lights, and i was using a custom range, so light would attenuate and help to create more depth perception. Now im thinking of creating extra lights, 1 set with no attenuation, to consistently light the player, and other lights to light the scene. I read somewhere that its not recommended to use more than 8 lights or something. Is it better for performance if i use e.g 5 lights with includedOnlyMeshes array containing only 1 mesh, and then another 5 which apply to all meshes. ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 3, 2016 Share Posted November 3, 2016 The advice is to keep the number of light per mesh to the minimal value. So your suggestion is fine to me as you won't have more than 6 lights per object 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.