Making Camera adjust to indoor/outdoor lighting

Hey all,

I’m pretty new to scripting and I have a question. I’ve searched some for the answer but really am not even sure what terminology I should use to search for the answer. :slight_smile: Anyway, my question is: is there a script I can use that will allow my camera (first person) adapt to lighting when moving from outdoors to indoors and vice versa - much like a video camera set to automatic does in real life. So, to be more specific, when I’m outside there’d be a normal level of exposure and inside would be darker but when I move inside the camera would adjust automatically making indoors a normal light exposure and outdoors much brighter (since sun light is brighter than indoor lighting naturally.)

Forgive me if this is confusing - I know how to explain it in film terminology but not so well in computer coding language :slight_smile: Thanks in advance for any help.

It’s called Tone Mapping.

Add the script by clicking the ‘Add component’ button in the inspector window for the camera or selecting the camera and using ‘Component’ in the menu bar: you want ‘Image Effects → Color Adjustments → Tone Mapping’ and this will try to change your colour balance to make darker areas darker and lighter areas darker by changing the overall light level of the screen. You also need to tick the “HDR” checkbox at the bottom.

After this, you can make you sunlight brighter and your indoor lighting darker and the script will adjust. Just be warned that you can end up with a washed out look if you are not careful.

See: High Dynamic Range Rendering in the Unity manual for more information.