Realtime GI not working?

So I have Unity 5 Beta 13, and have a sphere with high emission. Color red, emission around 20 or so. When I set it to static and other objects around it to static, it gives a nice red glow as it should. But this is entirely baked… How can I make the emission pulse/change color, with the glow on the other objects changing with it?

It seems everything is baked, and not a single thing is realtime. Reflection probes don’t support dynamic objects from what I can tell, and emission is not realtime. Am I doing something wrong?
I watched a Unity 5 Lighting video, where it showed red lights in a very futuristic metal room, pulsing red light dynamically.

Here’s a picture with the sphere set to non-static as well as my lighting tab.

Here’s a picture with the sphere set to static:

The only things you can change in real time to affect the GI are the position, direction, colour and intensity of regular lights, as well as the intensity and colour of emissive materials on static objects.

If you want your dynamic sphere to emit light, try putting a regular light inside it.

Ok. So in the video unity showed, they were using point lights and not emissive materials?

I have tried changing the intensity and colour of emissive materials on static objects and it will not change the GI. So for this sphere, and it’s set to static, and the game is playing, if I change the color and intensity the bridge stays red.

I think there’s a function you need to call if you want it to update the emissive stuff. Unfortunately I don’t remember what it is off the top of my head. It was in one of the threads on the subject, you might be able to find it if you search for it.

Hmmmm. I searched for it, I don’t think I’ll be able to find it without reading through every single thread. I hope we get Unity 5 Docs up soon. If anyone else remembers the function please let me know.

Docs are already installed locally.

DynamicGI.UpdateMaterials?

1 Like

yes! thank you! it works perfectly now.

    // Update is called once per frame
    void Update () {
        DynamicGI.UpdateMaterials(gameObject.renderer);
    }
1 Like

Hi! I am going to add some performance details here, hope this helps.

SetEmissive is a fast path on the CPU and allows you to specify one emissive color to the GI system for the whole object.

You can change the material and then call DynamicGI.UpdateMaterials. Which reads back albedo & emissive textures from the GPU. Due to the readback it might be questionable for a 60 FPS game or on mobile, but if you want to have albedo / emissive updating with accurate texture information then you can use this function. For optimized games, always author geometry so that Dynamic.SetEmissive with a single color for the whole object can be used.

I’m just trying this - both with DynamicGI.UpdateMaterials(renderer) as well as DynamicGI.SetEmissive(...) but neither seems to work. When I make everything static, emissive lighting seems to work quite well - but with dynamic objects not at all.

I’ve also tried disabling Baked GI, and set DynamicGI.synchronousMode = true - but that also doesn’t seem to make a difference.

When I set the objects receiving the light to static, I do seem to get some white light - but the emissive color is a strong red. Only when the emissive objects are also set to static, it does work and results in the expected effect.

So are there any other things that need to be in place?

This is on Unity 5.0 beta 20, btw.

Hi jashan! Yes, the emitting object has be be lightmap static for this to work.

Are you using standart shader for your emmisive material?
Note: “currently using the Universal shader doesn’t allow to switch to dynamic emission. To try it out you can use surface shaders with legacy deferred rendering path”

I wrote a shader. Try this

Shader “SimgeSimulation/Self-Illumin/Transparent/Cutout/Diffuse” {
Properties {
_Color (“Main Color”, Color) = (1,1,1,1)
_MainTex (“Base (RGB) Trans (A)”, 2D) = “white” {}
_Cutoff (“Alpha cutoff”, Range(0,1)) = 0.5
_Illum (“Illumin (A)”, 2D) = “white” {}
_EmissionLM (“Emission (Lightmapper)”, Float) = 0
[Toggle] _DynamicEmissionLM (“Dynamic Emission (Lightmapper)”, Int) = 0
}

SubShader {
Tags {“Queue”=“AlphaTest” “IgnoreProjector”=“True” “RenderType”=“TransparentCutout”}
LOD 200

CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutoff

sampler2D _MainTex;
sampler2D _Illum;
fixed4 _Color;

struct Input {
float2 uv_MainTex;
float2 uv_Illum;
};

void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Emission = c.rgb * tex2D(_Illum, IN.uv_Illum).a;
o.Alpha = c.a;
}
ENDCG
}

Fallback “Transparent/Cutout/VertexLit”
}