- Home /
Set emission for Realtime GI separately from rendered material
Hi guys and girls!
I have indoor scene with baked Realtime GI. Also there is lightmapped emissive object(TV Screen) with "Prioritize Illumination" enabled. VideoPlayer component sets Emissive chanel of Standard Shader material from the source video. Every frame renderer updated with next line:
RendererExtensions.UpdateGIMaterials(MyRenderer);
So everything around starts blinking like it's real TV screen. Also it matters what on the pixels of screen. So if I fill left side of screen with green and right with red, object at left side will be lighten with green and on the right with red color. Realtime area light from texture!!! Ambilight! Just look how it works:
So what is the trouble? As for me the light is too dark:
I want to make light brighter and add brightness to HDR emissive color picker. But it makes screen overbrighten:
I know that middle value could be suitable in this situation, but I have also other scenes, where it does not. Anyway I have goal now! So I tried to search for some workarounds. At first I've tried next method:
MyRenderer.material.SetColor("_EmissionColor", brightHDRColor);
RendererExtensions.UpdateGIMaterials(MyRenderer);
MyRenderer.material.SetColor("_EmissionColor", defaultHDRColor);
A made that in Update(), LateUpdate() and in Coroutine but that doesn't worked. Color applied only from default color. Then I've found a way to set emissive for a renderer:
DynamicGI.SetEmissive(MyRenderer, brightHDRColor);
Look! This way closer than anything, but there is one issue..
This operation statically sets GI emissive color for Renderer instead of material and shader outputs. Should work for static light sources. But I have a dynamic video with a complex realtime baked emission map:
I'm lost and out of ideas. Does anyone know how Unity Engine works internally and is there any way to set emissive brightness for GI separately from rendering surface?
Answer by Vestergaard · Sep 06, 2017 at 07:09 PM
Create a new layer called "Culled Lighting"
Create a new copy of your emissive screen with a new material that you can control brightness on separately, flag this new object with the culled lighting layer and nothing else.
On your game camera disable the "Culled Lighting" layer in your culling mask drop down.
The game camera will now cull your new lighting proxy object, but it should still contribute to real-time GI.
Yeah, nice way. Also, Valentin Simonov gave advice to add a meta pass to shader where indirect emissive will be overbrighten
Your answer
Follow this Question
Related Questions
Updating Global Illumination at Runtime 2 Answers
GrabPass and Transparent geometry 0 Answers
Miss calculations of lightmaps 0 Answers
Skybox material not working 1 Answer