Adding Emissions to Custom Textures
Continuing on from yesterday’s article about manipulating textures — read more here — we can also create what’s known as Emissions. Emissions are added to a material to make all or selected parts of it appear as a light source of a selected color and intensity from the defined surface. This can be a great way to add light to a scene without having to use resource intensive light sources. Check out my Lighting article here.
If you have read the lighting article, you may have noticed the emissive objects in the scene already. Let’s take a step back and look at how to create these textures on the central test tubes in the scene.
We want to make these test tubes have a neon green glow, like they’re filled with some sort of scientific radioactive material. Many pre-built assets we find may already have an emissive texture that we can simply alter the color and intensity of, but sometimes we need to create these from scratch.
With this texture, we can quite easily determine which parts are the glass-like faces of the tube. Being a different color to everything else will allow us to isolate these faces, but sometimes we may need to dig a little deeper and use 3D modelling software to find exactly what we want.
If we open this texture with GIMP, we can use the Select By Color tool, to capture the bits we want to add emission to. Non-Emissive areas are defined by black space, with the emissive areas being what remains, whether it be an image such as a computer screen, or a simple white area. Making this texture black and white, will allow us to change color easier in Unity.
To do this, we want to make a copy of our selection to another layer.
Let’s now change our selection to white using the Fill tool.
Now, we can Invert our selection, and fill it with black.
Recreating this example, actually lead to a bunch of artifacts as seen above, so we can simply cover them up. Now we can export this image as a png file. If we export it to the same location as the other textures, we can easily access it in Unity.
With our created Emission Texture now in Unity, we can go back to our material, enable Emission, and drag and drop our texture.