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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

White as Alpha

Discussion in 'Scripting' started by sherlockturtle, Jul 7, 2014.

  1. sherlockturtle

    sherlockturtle

    Joined:
    Jan 23, 2012
    Posts:
    592
    So currently, if you have alpha as grayscale it uses black to be alpha, is there a way to change this white? So white turns transparent instead of black?
     
    sean244 likes this.
  2. sherlockturtle

    sherlockturtle

    Joined:
    Jan 23, 2012
    Posts:
    592
    So essentially, right now white is opaque and black is transparent. Can I flip that? So the shader reads black as opaque or white as transparent?
     
  3. HenryStrattonFW

    HenryStrattonFW

    Joined:
    Jul 27, 2012
    Posts:
    18
    If this is just in the alpha channel, then the easiest way is to open the texture in a program that can edit channels and then invert the alpha channel.

    Or you could modify the shader to invert the value (1-value) before pushing it into the alpha result. This would depend on the shader you are using though, If its a unity builtin shader then you can download the shader source (I believe there is a sticky post in the shader lab forums here for that) and then just modify it there.
     
  4. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    What @HenryStrattonFW said. Unity has no built-in support for inverting the alpha channel once you've generated it; you either have to modify the shaders you're using so that they invert it when they use it, or you need to create the alpha channel in another program and invert it there. (I know that this can be done in GIMP in about 20 seconds).