oschakravarthi Posted October 9, 2018 Share Posted October 9, 2018 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. Quote Link to comment Share on other sites More sharing options...
trevordev Posted October 9, 2018 Share Posted October 9, 2018 I'm not sure this is built in but here's a playground that does this http://playground.babylonjs.com/#Z4ZGAY. I created a mesh and made the light a child of it, then created a pointer event such that when its clicked it changes the intensity. inteja and Sebavan 2 Quote Link to comment Share on other sites More sharing options...
oschakravarthi Posted October 10, 2018 Author Share Posted October 10, 2018 Excellent. Thank you @trevordev Quote Link to comment Share on other sites More sharing options...
Mark Bufton Posted October 10, 2018 Share Posted October 10, 2018 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 ? hcmetal and GameMonetize 1 1 Quote Link to comment Share on other sites More sharing options...
oschakravarthi Posted December 1, 2018 Author Share Posted December 1, 2018 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. Quote Link to comment Share on other sites More sharing options...
trevordev Posted December 3, 2018 Share Posted December 3, 2018 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.