Light emitting objects

I want to achieve similar stuff: Shader - Glow (Three.js)
But I want the object to glow and emit light, in Mr.Stemkoski’s example he adds another object around the original objects, I do not wish to take that path as I intend to place my objects randomly. I want THE object to emit light, literally - not something around it.

Any ideas?
Thanks in advance, anything could be helpful.

Could be faked with Material.emissive and a PointLight (also Bloom postprocessing if you want the bloom to be visible as if the environment was a bit humid.)

If you’d like actual light emission from a 3D object - you’d probably need some kind of path/ray tracing :thinking: (thread.)

1 Like

Thanks for the reply.

Unfortunately, bloom is blacklisted for me, since I do not favor the effect at all, same goes for Material.emissive, as it doesn’t actually glow around and PointLight can not be an option, firstly, it doesn’t actually emit light even if you attach an object directly to it, secondly, I need hundreds of objects to have and that many pointlights aren’t really good for performance.

Is it possible to achieve it through the fragment shader?

Well, you do kinda cross out most of your options right away :sweat_smile:

Technically, but only in a way that you already mentioned you do not want. If (hundreds of) point lights glued to glowing objects are ok - you can follow the steps of @Usnul and create either a deferred or magical renderer, that will allow you to render 1000s of lights with a good performance. Then mix with with emissive to create emission effect.

Keep in mind - unless you brute-force raytracing and demand every app user to run tripple RTX 3080 SLI, most of effects (especially in WebGL) are created by making close-enough fakes (ex. look at the normal maps - they are basically faking surface light scattering.)

(As for bloom - yep, it’s quite a cheap way of faking light emission and not very realistic in most cases :sweat_smile: )

4 Likes

You know what I think? A combination of OutLinePass and Material.emissive, but without hovering over or any interaction, would it work?

It should work (and give a cartoon-y kind of glow.) :grin:

The objects won’t affect the world around them though (emissive doesn’t really make them glow, it’s just making the surface of the object lighter) - that’s the only disadvantage I can imagine.

2 Likes

Yeah, that’s not a problem, in fact, I do not need them to cast shadows at all.

1 Like

This is very interesting. These two thoughts in a row:

and then

Why not to use bloom/selective bloom then?

OutlinePass/Material.emissive is already out of my list now, I just checked it more closely, doesn’t give a desired effect.

What’s the desired effect :eyes:

1 Like

Objects emitting light (with glow).

To emit light, you don’t have many other choices - either a PointLight or raytracing (these options are able to create actual light sources within the scene, not only casting shadows.) Material.emissive, shaders, and postprocessing can’t really do that - since they work either on single objects, or entire rendered scenes, at least in the default WebGLRenderer.)

If there’s some specific style - a video / screenshot of what you have in mind - it might be a bit easier to help.

Something like this:

If it’s not dynamic, then just create a texture with brighter/lighter parts on the spots where these “lights” must be placed.
Or welcome to the world of shaders.

2 Likes

Do you happen to have any reference for it? (other than stemkoski’s).

Stemkoski’s example is nice, but I would use (selective) bloom for glowing objects.

No, it’s not nice, it’s okay, but far from nice, though I respect his work a lot and am thankful.
When you have (say spheres) objects and you have an object inside that needs to receive shadows and you also have a glowing material outside and you orbit around, the objects that are placed above have the glow displaced. And selective bloom is a big no no for me. His examples are great for a single object with a fixed position.

What reason of that “no no”?

It’s kinda ugly, as simple as that.

And you already have tried it?