NodeMaterial Self Lighting

Hi there,
I’m wondering if I can make NodeMaterial self-lighting?
Something like this…


Thanks!

https://doc.babylonjs.com/how_to/glow_layer

Hi, if i understand correctly, the glow layer requires to set emissive texture. I don’t know how to set it for NodeMaterial :thinking:

Invoking @sebavan

It needs a property called emissiveTexture or emissiveColor but the easiest is to supply through the custom callbacks as explained in the doc (on my phone can not remember the callback name).

The main limitation is that vertex displacements would not be supported.

Hey, thank you for replying. Could you be more specific? :thinking: I can’t find relative documents :face_with_head_bandage:

More specifically, I’m trying to make my NodeMaterial glowing like this…:sweat: Is that possible?:face_with_raised_eyebrow:
https://www.babylonjs-playground.com/#MCJYB5#13

Here is the related part of the doc Make Mesh Glow - Babylon.js Documentation

The main issue is you would need a custom shader shader to render the glow as well which is not supported so far.

:thinking: I’ll try an alternative way. Thank you!

I ll take a look in the evening how hard it would be to replace the generation shader by a custom one .

1 Like

:smile: Thank you so much

I am still looking into it I hope to have a solution by Friday but it is way more complex that I thought at first :slight_smile:

1 Like

Thank you so so much :rofl: Take your time

Sorry for the delay, it is incoming:

Should be in by tomorrow :wink:

1 Like

PR is up: Supports custom glow materials. by sebavan · Pull Request #6974 · BabylonJS/Babylon.js · GitHub

The only change you ll need in your code is :

const gl = new BABYLON.GlowLayer(“gl”, scene);
gl.referenceMeshToUseItsOwnMaterial(mesh);

to ensure the mesh uses its own material to generate the glow.

3 Likes

Wow! Fantastic! Thank you so much! :laughing:
https://www.babylonjs-playground.com/#MCJYB5#15

1 Like