Michael3D Posted August 28, 2017 Share Posted August 28, 2017 I am trying to create a light on the camera that light up the area when the camera gets close to an object. I had tried it with a point light, where it wouldn't give me the effect I needed unless the intensity too high, causing the shadows on the wall the be bleached out. Now I am trying it with the spot light. This give a slightly better effect, but the light doesn't act light a flashlight when I start to rotate around an arch. I cant understand how the spotlight can rotate in the correct directing the camera is facing. DEMO: http://www.babylonjs-playground.com/#6FUUGB Issue: The light mirrors the cameras rotation, eg. I rotate the camera anti-clockwise(to the left), I should start to see the spotlight shining to the right corner of the wall. Instead the light moves the the left of the wall before appearing only on the right wall. Desired Results: When I rotate the camera to look right, I wish for the spot light to shine in that direction. If there is any more info needed. please ask. Ignore the Black and Red as there are textures I have on my local computer. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 28, 2017 Share Posted August 28, 2017 Hello! do you mind simplifying your demo a bit. There are too much non related code. A simple plane should be enough:) Based on this: https://github.com/BabylonJS/Babylon.js/blob/master/src/Lights/babylon.shadowLight.ts#L87, the behavior you want SHOULD work Quote Link to comment Share on other sites More sharing options...
dbawel Posted August 29, 2017 Share Posted August 29, 2017 math, math ,math... and of course a simple material and shader or texture. But DK is correct... you're overthinking this way too much. Quote Link to comment Share on other sites More sharing options...
gryff Posted August 31, 2017 Share Posted August 31, 2017 @Michael3D : Hi and welcome to the forum. You might want to have a look at this example I created. Walk around in the maze Maze It uses a single point light attached to the camera and two hemi lights to provide up and down "fill" lighting (lighting the floor and ceiling parts). The point light uses a range not "radius" which you tried in your code I notice!! I set the range to 5, the intensity to 3 and diffuseColor to 0.4708,0.477,0.2397. Sometimes it takes a bit of playing around to get exactly what you want. cheers, gryff PS hi @dbawel : good to see you again - I've sent you a PM. gryff Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Michael3D Posted September 6, 2017 Author Share Posted September 6, 2017 Sorry for my late reply. Thank you @gryff for your suggestion. I was able to get the effect needed more with the light exponent value and mixing a few other values with the other lights. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted September 6, 2017 Share Posted September 6, 2017 you might be able to convert my old scene from playcanvas to bjs https://playcanv.as/p/KldzHOs6/ which kind of simulates "fire" light 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.