Jump to content

"Flashlight/candle" type effect


Michael3D
 Share

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.

Link to comment
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 :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...