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

Getting Transparency to work correctly with baked PNG and single mesh made from blender

Discussion in 'General Graphics' started by Pinkuboxu, May 27, 2018.

  1. Pinkuboxu

    Pinkuboxu

    Joined:
    Mar 20, 2014
    Posts:
    54
    I have joined all of my parts to a character into one mesh and baked one texture in blender. When I tick the alpha box to make the texture alpha appear it looks good in Blender and retains all of the gradient alpha for smooth and clean transparency.

    I export an FBX file, externalize the material for editing, and set the PNG texture to import the transparency. The preview shows transparency correctly on the checkered background. What I end up getting is where there should be transparency, there is a lot of mess like the UV is wonky. Cutout works but since it clamps/ignores the gradient of the alpha, it makes hard contrasting lines and I loose partial transparency. Am I SOL and need to make characters without transparency, or am I simply doing something wrong? I know this works in other games made with unity so maybe I need to write a new shader for it?

    There is this image just incase...
     

    Attached Files:

  2. Pinkuboxu

    Pinkuboxu

    Joined:
    Mar 20, 2014
    Posts:
    54
    Still not working. I may have to change my question to what commands do I use when writing a shader to get smooth alpha transparency?
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,022
    did you try rendering mode Transparent in the material? (screenshot shows only Cutout and Opaque modes used)
     
  4. Pinkuboxu

    Pinkuboxu

    Joined:
    Mar 20, 2014
    Posts:
    54
    Yes, dunno why I forgot to mention that, and it has a strange effect like the Z order gets inverted.
     

    Attached Files:

  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,022
    oh i see (looks like alpha sorting issues).
    but you want only the eyes to be transparent right? can use different 2 materials then.
     
    theANMATOR2b likes this.
  6. Pinkuboxu

    Pinkuboxu

    Joined:
    Mar 20, 2014
    Posts:
    54
    Ah, ok. Yes, eyes and eybrows and eventually clothing. That sounds familiar from reading about Unities draw cycle long ago, and I must have derped the memory. I tried making another Material for the things I need transparency for, one for each so they don't fight each other, I think this works but instead of using Transparent it seems I have to use the Fade mode instead or the outline of the mesh still faintly shows. I was kind of hoping to not have to use too many materials, but it's probably ok as long as they are all on the same mesh. Thanks for the help!
     
  7. kanikamas

    kanikamas

    Joined:
    Dec 28, 2018
    Posts:
    1
    I don't know if this can help you, but what works for me is this. I did 2 bake textures, 1 the regular bake texture, and the other is just a glossy bake type, only the color and that created a B&W image that then you can use as a mask in photoshop...
     

    Attached Files: