Using a normal diffuse and a opacity texture on the model

I have a 3D model that takes 2 textures, but I can’t figure out what kind of shader to use on the material.

The first texture is a normal RGB that paints the model.

The second is a black and white texture, the black things are the portions of the texture that should be invisible and the white is what should be shown.

I can’t figure out how to implement these textures in unity so that the proper portions are invisible.

Do I enable alpha from greyscale? What shader do I set the material to?

I’ve been frustrated for hours, so any help would be awesome. If you need the textures I can share them also.

Put the greyscale texture into the alpha channel; there’s no use wasting an entire 8-bit texture on it unless compression artifacts are unacceptable. There are plenty of built-in transparent shaders to use for the material.

I might be understanding you wrong, but I think I tried that. The result was that the black portions of the texture faded away. It can definitely work that way, but up close it doesn’t look great.

What I think you mean is only using the RGB texture, check the “Build Alpha From Grayscale” and set it to drop the dark portions.

If I’m wrong and you mean something else, can you explain in more detail?

It’s not. The RGB texture doesn’t even come into play with that. But I’m telling you specifically to not do that, for the greyscale texture, for two reasons:

  1. It’s a waste of memory, like I said.
  2. The builtin shaders won’t do what you want if you do that.

You’re telling me you have an RGB texture and a grayscale texture. Right? If so, just copy the grayscale one and paste it into the other one’s alpha channel. You can’t do that in Unity, but presumably, if you already have these textures, then you have some knowledge about image editors, no? I use Photoshop, but you can do this with GIMP if you need a free tool.

I have the textures, but didn’t make them.

I understand what you’re suggesting now and will attempt to do it in Gimp.

Is there anyway to do the same thing in Unity though?

Just right click on layer and choose “Add Alpha Mask” and then paste your black&white texture into alpha and then save it with format which supports alpha channels (like png).

Well…yes you could write some script, but no, you don’t want to do that - it is 100x times faster doing it in Gimp.
On the other hand you could write custom shader which uses two textures, but that is a waste of memory and time too :slight_smile:

Thanks for the help and information as always. The problem is solved, and I’ll work with my texture artist to get the images combined before they reach us programmers.