Jump to content

Lighting - How achieve this kind of result from lighting ?


Recommended Posts

( Probably this isn't ideal post for babylon.js forum. But will help many learn lighting if some lighting expert can throw some insights. )

There's three.js based application which has very realistic lighting and shadows. I tried so many setup of directional, point, hemispheric lights. But  unable to achieve so brightly lit scene and still without burnt areas. 

There are few things specifically which I would like some expert to throw some clue how to achieve : 


1. Soft shadow in corner lines formed at junction of ceiling and wall. 

2. Soft glow coming from sunlight passing from window. 

3. Soft shadow thrown on walls by objects which are closer to walls. 


img (1).jpg

Link to comment
Share on other sites

Wondering why I couldn't think of Occlusion this while looking at scene.  Have came across Ambient Occlusion property of 3D Graphic earlier too.

@Deltakosh   How to make scene as bright as that ? Looking at the scene, I can't find effect of point light or direction light. The scene is consistently lit up. Its consistent ambient light that's everywhere. 



Link to comment
Share on other sites


Check out the babylon Hemispheric Light for ambient lightning :), you can turn the intensity up and down as it pleases you with yourLightVariable.intensity = 1; (values range from 0.0 to 1.0+).

Think of the intensity range as a percentage, 0.01 = 1%, 0.1 = 10%, 1.0 = 100%, 1.5 = 150% :) 



Example code:

var light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 5, 0), scene);
    light.specular = new BABYLON.Color3(0, 0, 0);
    light.specularPower = 0;
    light.diffuse = new BABYLON.Color3(1, 1, 1);
    light.intensity = 0.75;


Link to comment
Share on other sites

Like Deltakosh already said. For static scenes a precomputed light map will give you the best result and the performance will be good.
For dynamic scenes it gets more difficult. I think you need to use a combination of different tricks to fake something.
- did you try the SSAO?
- for the furnitures you could precompute an ambient occlusion map
- you could try to add a point light to you camera, this way the walls in the back will be darker then the ones in the front


Link to comment
Share on other sites

I think SSAO , 2-3 Directional light, 1 Hemispheric light and 1 point light  as well as some fixed lightmaps should do it. Will try doing it. 

Camera is not moving . So attaching point light to camera won't help much. Point light will stay in center basically. 


Link to comment
Share on other sites

to achieve that kind of "shadows" / depth you could try one of the options kesshi mentioned,

but another. slightly simpler way could be to fix it with textures (mimic the shadows on wall textures), requiring the scene is completely static ofc and nothing else than the camera moves.

It also doesn't seem like you have shadow's applied. in your above screenshot^^ they might help slight aswell

Link to comment
Share on other sites

Well shadows has its own issues. It is not producing soft shadows. I will see if I can create PG for it and post it in other post .

How can static pre-computed Occlusion map be used? Same as light map ? Set on material.SpecularTexture ?

What if we use Babylon runtime SSAO rendering pipeline with 0 refreshrate ? Considering the scene will be static. And nothing will ever move. 

Link to comment
Share on other sites

  • 3 weeks later...

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.

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.


  • Recently Browsing   0 members

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