Michael3D

"Flashlight/candle" type effect

Recommended Posts

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.

Share this post


Link to post
Share on other sites

@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 :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.