logo
logo
AI Products 

What is Emissive Map?

avatar
Ishaan Chaudhary
What is Emissive Map?

A simple emissive map may make a 3D object seem brighter and more lifelike by simulating the light emission from an internal light source. It adds to the asset's lustre. You may make anything that you want to be lighted up or have a glow by using an emissive map, and you should always make any areas that should not be generating light dark.

 

Game programming is a lucrative career.

 

PREPARING THE EMISSIONS MAP

Not all materials provide an emission map since they can only be rendered with the appropriate shaders. The shader for a material may be selected in the menu to the right of the Rendering Mode option.

The Unity Standard Shader that comes pre configured will have its emissives adjusted. If you're using a different shader, the script in this post may not function properly.


Emissive maps are often quite dark in color. It's only appropriate for colored light to come from the source of the light. You may adjust the color of the light emitted from the material by utilizing a black-and-white emission map if your item only emits one color. In addition to changing the hue of the emission map, you can also modify the brightness of the emitted radiation.

 


SETTING STATIC FLAGS AND ENABLING GI


  1. When the material is added to a GameObject, it will lead to the development of light; however, this light won't appear to have any effect on the surrounding environment.
  2. Make sure the emissive GameObject and any others you wish to be illuminated are also marked as Static for the emissive light to affect the rest of the scene. For guidance on this process, see this article.
  3. Additionally, in the Lighting box, you must ensure that the following global illumination flags are selected:
  4. Baked Global Illumination must be verified for baked emissives.
  5. In order to use emissives in real time, Realtime Global Illumination must be enabled. A lack of control causes real-time emissives to act similarly to baked emissives.
  6. Consider switching to Enlighten as the Lightmapper if your light probes aren't picking up on real-time emissives.
  7. The next step is to Generate Lighting for the scene, sometimes known as baking the lighting.

 


Game design courses will enhance your skills.

 


REALTIME VS. BAKED EMISSION

  • The Global Illumination option may be found in the emission settings for the material. The drop-down menu offers two choices: Realtime and Baked. The created emissive lighting will seem somewhat different depending on the choice you choose.
  • When compared to the real-time version, the baked emissive lighting will have a more nuanced and realistic appearance.
  • Realtime emissive lighting can be toggled on and off at runtime with little code, but it has a less realistic appearance.
  • Emissive lighting is enabled and disabled using the script provided below. More specifically, the sections in bold indicate those that are used to turn on and off the emissive lights.

 

using System.Collections;

using UnityEngine;

[RequireComponent(typeof(Renderer))]

public class DynamicEmissive : MonoBehaviour {

new Renderer renderer; // new hides the parent <renderer> property.

Material material;

Color emissionColor;

void Start()

// Gets access to the renderer and material components as we need to

// modify them during runtime.

renderer = GetComponent<Renderer>();

material = renderer.material

// Gets the initial emission colour of the material, as we have to store

// the information before turning off the light.

emissionColor = material.GetColor("_EmissionColor");

// Start a coroutine to toggle the light on / off.

StartCoroutine(Toggle());

}

IEnumerator Toggle() {

bool toggle = false;

while(true) {

yield return new WaitForSeconds(1f);

Activate(toggle, Random.Range(0.5f,2f));

toggle = !

toggle;

}

}

// Call this method to turn on or turn off emissive light.

public void Activate(bool on, float intensity = 1f) {

if(on) {

// Enables emission for the material, and make the material use

// realtime emission.

material.EnableKeyword("_EMISSION");

material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.RealtimeEmissive;

// Update the emission color and intensity of the material.

material.SetColor("_EmissionColor", emissionColor * intensity);

// Makes the renderer update the emission and albedo maps of our material.

RendererExtensions.UpdateGIMaterials(renderer);

// Inform Unity's GI system to recalculate GI based on the new emission map.

DynamicGI.SetEmissive(renderer, emissionColor * intensity);

DynamicGI.UpdateEnvironment();

} else {

material.DisableKeyword("_EMISSION");

material.globalIlluminationFlags = MaterialGlobalIlluminationFlags.EmissiveIsBlack;

material.SetColor("_EmissionColor", Color.black);

RendererExtensions.UpdateGIMaterials(renderer);

DynamicGI.SetEmissive(renderer, Color.black);

DynamicGI.UpdateEnvironment();

}

}

}

 

 

AFFECTING DYNAMIC (I.E. NON-STATIC) OBJECTS

By default, emissive lighting will only have an effect on static objects regardless of the emission setting you are employing. If you want dynamic objects to be impacted by emissive lighting, you'll need to place them in a light probe group that includes those places.

 

DYNAMIC OBJECTS UNLIT BY EMISSIVES

As Unity employs precomputed realtime global lighting, even realtime emissive lights must be baked and use light probe groups to impact moving objects. This seems contradictory, but it implies that Unity doesn't truly implement real-time global lighting (because doing so is prohibitively costly), but instead employs a large amount of complex mathematics to create the illusion of it.

 

Reputed institutes offer comprehensive game development courses.

collect
0
avatar
Ishaan Chaudhary
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more