aWeirdo Posted January 6, 2016 Share Posted January 6, 2016 Hello!So, i have been messing around with babylonjs for a couple weeks now, just trying different stuff out, now, i have a rectangular plain, aprox 150x100, i want the "center" of the plain to be well lit from all directions, while at the edge, the light should rapidly fade out to black, I have tried several set-ups, so far, the best results i've gotten regarding getting the fade-out effect is using 3 spotlights(1 in each end and 1 in the middel of the plain), but since they only cast light from above, all the objects sides are completely black. Does anyone have a solution for this? is it even possible?var light0 = new BABYLON.SpotLight("Spot0", new BABYLON.Vector3(0, 100, 0), new BABYLON.Vector3(0, -1, 0), 0.8, 2, scene); light0.diffuse = new BABYLON.Color3(1, 1, 1); light0.specular = new BABYLON.Color3(0, 0, 0); Quote Link to comment Share on other sites More sharing options...
chg Posted January 6, 2016 Share Posted January 6, 2016 You want far away parts of the world to be dark, have you considered using fog for this instead of lighting? (if not, maybe you should...)Then use some ambient lighting term and maybe a secondary light to act as a highlight (because ambient terms are rather flat) Quote Link to comment Share on other sites More sharing options...
jahow Posted January 6, 2016 Share Posted January 6, 2016 Hey and welcome, If the bright area is centered on the camera, then as chg said: fog + ambient lighting is definitely the way to go. If not, then I think your best bet is writing a custom ShaderMaterial, to which you'll pass the center coordinates of the bright area and then to a nice color fadeoff according to this. Try looking at the docs if you don't know where to start Good luck Quote Link to comment Share on other sites More sharing options...
gryff Posted January 6, 2016 Share Posted January 6, 2016 Hi aW Is this what you are trying to do? Playground Two lights, one a point light and one a hemispheric light. Important lines are 35 and 36 - what objects get illuminated by what light. You can play with pointlight's intensity and range to get the fall off effect you want cheers, gryff Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted January 6, 2016 Author Share Posted January 6, 2016 Hi aW Is this what you are trying to do? Playground Two lights, one a point light and one a hemispheric light. Important lines are 35 and 36 - what objects get illuminated by what light. You can play with pointlight's intensity and range to get the fall off effect you want cheers, gryff Yes, That is exactly what i was looking for. Thank you :-) 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.