Jump to content

Showing lights physically


oschakravarthi
 Share

Recommended Posts

Hi,

When we place lights in our scene, the lights are not visible but their lighting is visible. I want to show light the light also and write code in such a way that when the user clicks on the light, the light should be switched off. Is there any built-in functionality sometjing like,

myLight.renderAsMesh=true or mYLight.mesh=someLightMesh;

 

Thanks in advance.

Link to comment
Share on other sites

There isn't a shortcut option that I'm aware of to physically render the lights.  As @trevordev says, you would have to create a mesh/meshes manually to represent the light source.  The Highlight Layer is an excellent addition to this.

With regards to user interactions, the built in Action Manager can provide you with the functions you need.  It has a whole host of options to choose from; from simple on/off switching and interpolation to the execution of custom code.  It's proven invaluable to me so far.  Another thing worth checking out could be the Animations Manager.  It's similar to the actions manager but can allow you to create things such as flickering lights etc with relative ease.

A simple Google search of the Highlight Layer, Action Manager and Animations Manager will give you no shortage of inspiration.  Hope this helps ?

Link to comment
Share on other sites

  • 1 month later...

Hi,

How to build a tube light?

I am trying to create a mesh (may be a box) which emits light exactly like a tube light.

I am trying to edit the PG which @trevordev created for me. But the light's reflection is still like a spotlight.

https://playground.babylonjs.com/#Z4ZGAY

 

Do I need to do something with GlowLayer? 

 

Thanks in advance.

Link to comment
Share on other sites

Babylon's standard materials only support cheaper lighting such as point or directional lights, achieving accurate area lighting is much more expensive to do in real time but using a pbr material with an environment map works well as long as you don't want to move the light source eg. https://www.babylonjs-playground.com/#8MGKWK#0, to do this in realtime you could try using a reflection probe but this would get expensive . Or you can use glow layer to simulate it aswell but if you put a light on it it will still behave as a pointlight, the glow only effects screen space.

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