- Home /
How do you go about making a dynamic object emit light in Unity 5?
I've spent the last day googleing to try and find out how you can make an object emit light, I found that the standard shader is capable of that but only when the object is static.
Lets say I want to make a long tube, and I want it to emit light evenly across it's entire body (like an overhead fluorescent light). How would I go about doing this in such a way that the glowing object can freely move around the scene? I do not want to use point lights, since those would not provide a uniform amount of light over the length of said tube.
I apologize if this is a "stupid" question, I'm burnt out on searches and am hoping one of you can point me in the right direction. Does this require custom shaders, or can it be done with the capabilities Unity provides?
Answer by apple92 · May 29, 2015 at 08:38 PM
There are actually a few ways to do it, but none of them is a perfect solution.
I'll just start with what I can think of right now:
Use the Emission Map and Value in Combination with a Bloom Image Effect (a very good package can be found in the Asset Store, but to test it, the Unity Bloom effect is enough). This will let the moving mesh look like it emits real light. Bad thing about it? There is no GI. So Other Objects won't get lit by it. But if it just navigates through space it's fine. If it navigates along a road or ground, you could make use of Projector to project the same Color with a texture onto the ground.
Create a reflection Probe as Child of this moving Object and let it update frequently. Set it to an really low size so it gets captured fast and is really blurry (also deactivate/set to 0) all the performance eaters like ShadowDistance, etc.). If an Object gets within the Distance of the Reflection Probe it should (depends on the settings) become colored. This actually works better if you'd want to Bleed color from the environment onto the moving object, but should work the other way around too.
Or just use Projectors in all directions. Don't know how well this would work as I didn't test it. See here for Projector
If nothing works let me know, I'll try to figure out something else.
Regards Michael
Answer by Cherno · May 15, 2015 at 03:50 PM
I had the same problem, I wanted to make the surface of a lava mesh that is procedurally generated emit light. It seems like this is not possible with the so-called "real-time" global illumination :(
That doesn't sound good. But that then brings up the question of how people have dynamically moving objects emit light from their surface. How would you have an RPG character carry a glowing staff that casts some light on him, or a "beam" that casts light on the ground as it passes over it.
Curious what solutions they use for this if dynamic objects cannot emit light without using the pre-made untiy lights. Especially in 2D, where you don;t have a 3D object to contain a light source.