Home Technical Talk

I can't make transparency work in both unity and unreal.

interpolator
Offline / Send Message
Udjani interpolator
I read on unity manual that you could store information on the alpha channel to set the transparency value of a texture so you can have both opaque an transparency in one texture, but i am not able to make it work. 

This one is from unity, the left side is using transparency, and the right is using cutout. I don't get why the transparency is messing up all the mesh instead of just applying it like the cutout is doing


This one is from unreal.


And this one is from marmoset, that is somewhat of what i was expecting, is using the same textures as in unity.

I am guessing that the problem is not with the mesh or the texture because is working on marmoset, maybe i should just have the transparency and opaque in different texture sets?

I attached the fbx with the unreal and unity textures if you want to take a look. 

Replies

  • Mink
    Offline / Send Message
    Mink polycounter lvl 6
    The only poblem with unreal is you don't have any scene lighting captures set up, so you only have screen space reflections. For the unreal texture you should have the non transparent part of the mesh and the transparent part seperate material slots with seperate materials.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Try "masked" blend mode in Unreal, instead of translucent.
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    The alpha blended materials aren't properly sorted - you can probably get around it by splitting the model up into parts but unless you need partially transparent surfaces you should stick to the cutout/clip/alpha test version



  • Farfarer
    When you draw a mesh using "alpha blend" (what we usually think of as transparent - with the ability to have partially transparent surfaces) it's not usually written to the depth buffer.

    That means that there's no way to tell which parts of the mesh is in front of the others.

    In this case you're drawing your entire mesh as transparent and it can't tell which polygons should draw on top of the others.

    Usually the way around this is to split the mesh up into two materials - one that uses an opaque material and one that's got the transparent parts in it and uses a transparent material.

    Thatstops the opaque material from drawing over the transparent material. Note this doesn't stop the transparent parts from drawing over themselves.

    The other common (and often cheaper) option is to use "alpha test" (also commonly referred to as "cutout"). This has a disadvantage in that there is no partial transparency
     - the surface is always fully opaque or fully transparent. However it does mean it can write to the depth buffer safely and so can be done in one material in one pass.

    Judging by your use case, the cutout option might be best for you.
  • monster
    Offline / Send Message
    monster polycounter
    Another method, and least performance friendly, is to detach / separate the star, then attach / combine the star back to the shield. Because the star vertices are now ordered last it will render on top of the shield. 

    The two two problems with this method are 1) the star will render on top from behind as well. But there will probably be a character there. 2) Alpha blending is typically more expensive than alpha test and should only be applied to the faces that need it.

    Like the other I suggest Cutout. Even better would be to create the asset so it does require any type of transparency.
  • RacePeaceDay
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    No,  don't do that 
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    No,  don't do that 
    Why? That actually sounds like the proper way to approach something like this. At least way better than transparency.
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    Sorry  Looks like  I've misunderstood the structure of the asset.

    The red bits yes, definitely. 


Sign In or Register to comment.