HDR color values

Aside from using the material inspector and the animation system, I’m not able to do much of anything with HDR color values (specifically, I’m trying to assign HDR emissive values to a material at runtime). Even using the ColorUsageAttribute, the color picker allows choosing HDR colors, but once you’re done and click on the color in the inspector again, you’ll find your color value has been clamped to 0-1 again.

Is there something I’m missing about handling HDR color values?

Are you using Color or Color32? Color32 is limited to 0.0-1.0, where Color is not. So if anything you’re doing uses a Color32 at some point the color will be clamped.

I’m using Color.

You said you’re using the animation system to drive the color? It’s possible they’re internally treating colors as Color32 rather than Color. You may have to set your shader parameter to be a Vector instead for it to work properly.

I’ve tried Vector4 and Color32 and those don’t work either. As I said, I’m only using the animation system as a work-around. I really need to be able to do it from script.

The fact the Vector4 isn’t working is bizarre to me.

To make sure I understand, you have a script with:

[ColorUsageAttribute(true,true)]
public Color colorValue;

And you’re seeing the color values reset to 0-1 ranges after setting it to >1 ranges? Have you double checked the stored values are being reset or just the representation in the picker? The color value doesn’t have any concept of exposure, it is just a Vector4, but the color picker does, so the picker might show different numbers each time as it tries to guess the exposure to use just just the HDR color values.

I would set the color, then have a Debug.Log(colorValue); print out the actual values.

Strange, I removed my code from before since it wasn’t working, and now I reproduced it and it seems to be preserving the values now. However, assigning these values to the emissive color of a material (even using DynamicGI.SetEmissive()) still results in the material just having a color value clamped to 0-1.