# Light mesh up from the inside

**URL:** <https://forum.babylonjs.com/t/light-mesh-up-from-the-inside/38303>\
**Category:** Questions\
**Created:** [February 17, 2023, 9:48am UTC](https://forum.babylonjs.com/t/light-mesh-up-from-the-inside/38303 "2023-02-17T09:48:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![aWeirdo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/aweirdo/32/52_2.png) [@aWeirdo](https://forum.babylonjs.com/u/aWeirdo)\
**Post date:** [February 17, 2023, 9:48am UTC](https://forum.babylonjs.com/t/light-mesh-up-from-the-inside/38303/1 "2023-02-17T09:48:07Z")

</div>

Hi team,  
I’m currently working on a torch mesh with a pointLight light source attached near the top…  
Is there any setting / possible to light up a mesh from the inside? (mesh using PBR material)

Do i have to use the unlit setting?  
While this would be possible, it will not look good when taking into consideration:  
Changes in PointLight intensity and color (flickering),  
and especially external light sources that should also be able to affect the mesh.

> **[Babylon.js Playground](https://playground.babylonjs.com/#IIAE32%232)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [February 17, 2023, 1:00pm UTC](https://forum.babylonjs.com/t/light-mesh-up-from-the-inside/38303/2 "2023-02-17T13:00:13Z")

</div>

Hello,

Is the effect you want to achieve something like this torch? A central emissive area (highlighted in red) that affects the rest of the mesh?

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/b/ab46002bd2e97f0b7ef2d134327bd2b8e8ce560c.jpeg)

This effect would be more directly translated into an area light

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/9/b981d9624b5220b564f5b4320a6616bba233cf14.png)

which is not available in Babylon as of now. But you could try a variety of methods to “emulate” this area light effect, like baking lightmaps into the torch mesh, and maybe some volumetric light? [Volumetric Light Scattering Post Process | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/features/featuresDeepDive/lights/volumetricLightScattering)

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [February 17, 2023, 1:00pm UTC](https://forum.babylonjs.com/t/light-mesh-up-from-the-inside/38303/3 "2023-02-17T13:00:29Z")

</div>

@PatrickRyan might also have some good tips

---

<div class="post-metadata">

**Author:** ![aWeirdo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/aweirdo/32/52_2.png) [@aWeirdo](https://forum.babylonjs.com/u/aWeirdo)\
**Post date:** [February 17, 2023, 1:20pm UTC](https://forum.babylonjs.com/t/light-mesh-up-from-the-inside/38303/4 "2023-02-17T13:20:29Z")

</div>

Hi @carolhmj !  
Apologies, I just realized i should have specified that it’s a medieval style torch 😃  
It has to be dynamic lighting, it can move around and the plan is to also cast shadows.

This is the progress right now (turning on & off the light) with unlit material while animating the intensity of the light together with material albedoColor (white to black)…  
but it’s not very good 😃  
About (slightly before) 4/5 into the video you can clearly see the torch go completely black as it’s turned off before the unlit property is set to false and then the external light is applied

[https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/6/465173d78a4dd5165aa203ee694aaf8bc0d9fbe9.mp4](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/6/465173d78a4dd5165aa203ee694aaf8bc0d9fbe9.mp4)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [February 17, 2023, 1:42pm UTC](https://forum.babylonjs.com/t/light-mesh-up-from-the-inside/38303/5 "2023-02-17T13:42:36Z")

</div>

Maybe you can use an emissive texture and use the emissive color to simulate the flickering?

---

<div class="post-metadata">

**Author:** ![aWeirdo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/aweirdo/32/52_2.png) [@aWeirdo](https://forum.babylonjs.com/u/aWeirdo)\
**Post date:** [February 17, 2023, 2:29pm UTC](https://forum.babylonjs.com/t/light-mesh-up-from-the-inside/38303/6 "2023-02-17T14:29:46Z")

</div>

@Evgeni_Popov  
Emissive looked promising, but unfortunately it won’t recieve light from external sources very well when turned off, and it’ll be too dark.

~~Do you recall if there is a list/array of lights currently affecting a mesh?~~  
_Edit; i found it mesh.lightSources;_

I’m thinking if i could, by some kind of magic, work out a limit for the turn-off animation on the albedoColor, so if within range of an external light source, it won’t go completely black

---

<div class="post-metadata">

**Author:** ![PatrickRyan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/patrickryan/32/3417_2.png) [@PatrickRyan](https://forum.babylonjs.com/u/PatrickRyan)\
**Post date:** [February 17, 2023, 4:30pm UTC](https://forum.babylonjs.com/t/light-mesh-up-from-the-inside/38303/7 "2023-02-17T16:30:54Z")

</div>

@aWeirdo, if you want to simulate the torch always being lit, you would want to be using emissive texture and emissive color like @Evgeni_Popov mentioned. While this isn’t a torch, [this demo shows blending both lit and emissive color in the same material](https://playground.babylonjs.com/#7QCYPB). When the emissive strength is set to 0, it still receives light from the rest of the scene, but when the emissive is set above 0, the emissive color renders as unaffected by the scene light. Using emissive also unlocks the potential to use the glow post process which is driven by emissive color. This example uses a node material, but you can get the same effect with `StandardMaterial` or `PBRMaterial`.

The thing to remember is that `albedoColor` should not change based on the level of emission on your torch. Leave `albedoColor` alone as it will render any light which hits it normally and your torch won’t disappear. Emissive color will be a separate texture with just the light that should be mixed in with the albedo to imply the light source is coming from the flame. If you are ramping value, do it with your emissive color, not albedo.

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [February 17, 2023, 4:49pm UTC](https://forum.babylonjs.com/t/light-mesh-up-from-the-inside/38303/8 "2023-02-17T16:49:22Z")

</div>

To extend on @PatrickRyan reply, with regards to

> [@PatrickRyan](#):
>
> This example uses a node material, but you can get the same effect with `StandardMaterial` or `PBRMaterial`.

I believe this is what I did for the rear and front lights of my [motorcycle demo.](https://media-geneva.ch/demos/bjs/motorcycle/motorcycle-cdn-preview.html)  
Press kb 1 to 4 to change the light state (from off to full on, park or dip).  
Search for node ‘lamp\_f0’ and children to see the assembly (with a reflector, a bulb and a glass)  
As guru 😉 patrick says, **emissive is key** and I’m actually ‘exploding’ the texture with a level of 2 for full lights. However, since this is a PBR (metallic) material, I’m also adding directIntensity, also going way above the value of 1 (30 on full lights if I remember correctly). Finally, to complete the effect on park or dip (half lights) I also pushed the albedo level a little (1.3 or 1.4).

 ![Capture d’écran 2023-02-17 à 17.39.00](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/c/b/cbd8225c2b716bc9bcf592b54d5ba58cd10ce192.jpeg)  
 ![Capture d’écran 2023-02-17 à 17.38.45](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/1/91f6a1e4a6d500700bd04914c55e90dbd3612998.jpeg)

---

<div class="post-metadata">

**Author:** ![aWeirdo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/aweirdo/32/52_2.png) [@aWeirdo](https://forum.babylonjs.com/u/aWeirdo)\
**Post date:** [February 17, 2023, 5:07pm UTC](https://forum.babylonjs.com/t/light-mesh-up-from-the-inside/38303/9 "2023-02-17T17:07:54Z")

</div>

@PatrickRyan I appreciate the advice!  
So far it looks like **emissiveIntensity** (i assume it’s the same as **emissiveStrength** ) was the link i was missing before

The “Flickering” i mentioned earlier would more be something like this; first draft at least,

> **[Babylon.js Playground](https://playground.babylonjs.com/#IIAE32%235)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

Apologies for the slow updates, been battling light settings trying to get a decent area of good light without having a too large falloff area, while also not creating a sun in the center 😂

_Update;_  
Let there be light 🙂  
Pretty happy with the result so far, could use a little bit of tweaking still.

[https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/7/677ccc0a244fea84b54dc033bb7b50d440e9e0dc.mp4](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/7/677ccc0a244fea84b54dc033bb7b50d440e9e0dc.mp4)
