Jump to content

Need Help with BABYLON Lighting


Nakul SOlanki
 Share

Recommended Posts

Hi,

I am trying to create a new interface for my home automation project. The Idea is to have a 3d model of the house and show the status of the actual lights by highlighting virtual lights in the 3d house. Later this can be used to highlight floors whenever a motion sensor for a room is triggered.

For this I created a scene in blender. The scene has two point lights and one hemi light and i use the BABYLON.ScreenLoader to load the entire scene.

It looks like this when the lights are on

Lights On.png

And like this when the lights are off.

Lights Off.png

The problem is that even though the walls are opaque, when the light is on it passes through the walls. I have highlighted the area with Red rectangles.

Any idea, why this is happening? or what should i do differently to avoid this?

Link to comment
Share on other sites

@Nakul SOlanki Hi - and welcome to the forum :)

Here is a solution that I use - see image below. The scene as you see it shows a house layout which has multiple rooms - in fact in the complete model 9 rooms and 10 lights but for ease of explanation I have hidden some of the interior.

So an explanation. the layout has an outside wall (red) in its own layer. The inside wall for each room each have their own layer (Room1-Room8 in the Layer manager) . You can add any furniture for each room into the appropriate layer. Now each room has a light in the same layer (Room 8 is chosen and its light in the image). Now for each light before export I check the box "This Layer Only" .

Each light then only illuminates the meshes in its layer - the inside wall and furniture. The "Range" of the light can also limit illumination.

It works quite well. If you need more info just ask. It is better than baking out lightmaps as you might change a room's content which would involve baking a new lightmap.

cheers, gryff :)

 

house1.png

Link to comment
Share on other sites

Thanks for the response gryff. I link this approach better as I will not have to regenerate light maps if i add new furniture to any room. I tried the "This Layer Only" approach but I was not able to make it work. Reducing the distance and marking the Sphere checkbox seems to reduce the effect of light but it still treats walls as transparent.  If i render the scene in Blender it renders as expected i.e. light from one layer doesn't cross over to the other layer, but when i export the whole scene to BABYLON the light crosses layers.

In your example above do you export each item individually or do you export the whole scene?

Blender:

Seperate Layers Blender.png

BABYLON:

Seperate Layers Babylon.png

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...