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.
  2. Dismiss Notice

Why do cookies ruin my gradients?

Discussion in 'General Graphics' started by misterlee, Jun 1, 2016.

  1. misterlee

    misterlee

    Joined:
    Sep 19, 2014
    Posts:
    54
    As the title says - why does making a texture into a cookie texture effectively ruin it?



    The image shows the original texture on the left, and after changing the texture type to cookie on the right. The gradient is almost gone, it's no use like that. It's also a larger file size so it's not as if it was lost due to some kind of optimisation.

    Why is this happening and does anyone know how to fix it?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,209
    Most of the time RGB colors in a texture are going to be in sRGB, often called gamma space. Alpha is always linear, and light cookies only use the alpha of the texture. An Alpha 8 texture is the same size as a DXT5 texture, but is uncompressed, so it uses that format.

    If you want to get it to look more like the image when it's in gamma space you can get close by duplicating your image and setting the top layer to multiply. That'll approximate a gamma of 2.0, where sRGB is closer to gamma 2.2 or 2.3. Linear is a gamma of 1.0 btw.
     
    misterlee likes this.
  3. misterlee

    misterlee

    Joined:
    Sep 19, 2014
    Posts:
    54
    Thanks for the explanation, that's a good work around. It's closer to the original gradient now. It started getting banding in the gradient though, which is unfortunate. I tried adding a tiny bit of noise but it just gets blown out in the cookie and picks up grey dots in the black area. /sigh
    It's definitely better though! :)