Author Topic: Unity and alpha/transparency problem  (Read 6748 times)

Hello!

I'm new to texturing, and I've made a couple of assets that need transparency. I've used the Substance Painter with the alpha blending setting in the Viewer, and used the transparent setting for the Unity Material, but I'm getting some weird results.

In Substance Painter, it looks fine. In Unity, the area of the chrome looks like it is partially transparent.

Any help would be greatly appreciated. I've got these as a single mesh and a single material, with color maps for the different textures. Could this be causing some alpha issues? Should I just use a separate mesh and apply a different shader in the engine for transparent textures?

I had a similar problem with the coffee pot, where the plastic seems to be clipping (no matter what the camera distance). I also had an issue with the coffee pot where the handle would render in front of the transparent coffee (there is a mesh inside for the coffee--not shown in the attached pic).

Are there any good tutorials on transparency workflows? The one that Wes did pointed me in the right direction, but that doesn't seem to be working with this asset. :(

Thanks in advance!

P.S.--I'm a huge fan of Painter! :D




Last Edit: November 30, 2017, 11:05:21 pm

I think you're going to want to put the transparent elements on a separate material.

Thanks, jdouglass. I figured that would be the easiest way, but was hoping to keep it one material to save draw calls. If that’s not feasible, I’ll just use two materials. :P

Have you ever combined transparency on the same texture map? Is this something that just isn’t done? Still new to the whole process. I thought the alpha transparency would be localized to the UVs that needed transparency with the material ID (and it almost seemed to work).

Thanks again!

Transparency in games or realtime render engines for that matter is a difficult thing to implement.
Basically your material is using a shader that looks at what pixels have already been drawn and blends the pixels of your transparent material with what is already there.
However these shaders usually don't write to the z-buffer - they don't prime the pixels of your transparent mesh for proper z-sorting. That is why some parts of your transparent mesh stick through and get overlaid by itself.
Often engines simply decide what transparent mesh to draw first based on its position to the camera - which is happening way before any pixel shader has run and z-writes may have occured.
So it is best to separate meshes into parts that can be drawn fully opaque (non-transparent) and transparent to minimize these artifacts.