Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

HDR - Color vs Color32

Discussion in 'Scripting' started by Yavvn, Jun 30, 2019.

  1. Yavvn

    Yavvn

    Joined:
    May 8, 2019
    Posts:
    18
    It's been stated multiple times that Color32 should be used as it's much faster and uses four times less memory than Color. Color and Color32 can be implicitly converted to each other according to the docs.

    It's also been stated that Color32 is Color that is directly interpolated from a 0-1 range to a 0-255 range. However, I've also read that HDR is not possible with Color32 because the values are clamped. This suggests that the idea of 'Color is always converted to Color32' is false, unless there is more to it.

    Is there a misunderstanding here? We must support HDR for our procedurally generated mesh. Color32 would seem to be a great option for speed, however multiple posts (that seem to contradict each other) suggest that HDR is not possible without using Color itself. I think this issue is largely due to outdated information from before Unity supported HDR and linear color spaces, but I wanted to get the community's feedback first.
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    "Four times more memory" is scary but in reality it's 16 bytes instead of 4, so 62,500 Color instances would use a whopping 1 megabyte of memory. I think you'll be fine to use it.
     
    Yavvn likes this.