May
25
2019

Enable HDR Color picker for Shader or Script

I needed HDR color for some old Unlit/Color-shader, and for c# script also, found out that you can add this attribute for the shader:

// BEFORE (no hdr color picker)
_Color ("Main Color", Color) = (1,1,1,1)
// AFTER (hdr color picker)
[HDR]_Color ("Main Color", Color) = (1,1,1,1)

And for the script:

// BEFORE
public Color shouldbeHDR = Color.white;
// AFTER
[ColorUsage(true, true)]
public Color shouldbeHDR = Color.white;

More info:
https://docs.unity3d.com/ScriptReference/ColorUsageAttribute.html
https://docs.unity3d.com/Manual/SL-Properties.html

Also make sure your Camera has [x] HDR enabled

Left: No HDR | Right: HDR enabled

5 Comments + Add Comment

Leave a comment

Connect

Twitter View LinkedIn profile Youtube Github Join Discord Twitch Instagram BlueSky

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.