Transparency Materials

Hi there,

I have been working with some different materials in Unity trying to get something to look good with alpha maps. In the attached image it shows the results. I’m not very happy with any of them and am wondering if anyone knows why they are turning out this way and what good materials to use for the iPhone would be?

  1. The first image is using Transparent/Cut-out/Vertex-Lit and everything shows up very harsh. It doesn’t look natural at all. At least this one I understand.

  2. The next one is using a Transparent/Diffuse which for some reason makes everything somewhat opaque. There is nothing wrong with my alpha maps because as you can see in the maya screenshot it shows up perfectly fine in Maya. Does anyone know why the transparent/diffuse does this or how to change it?

  3. The transparent/vertex-lit example also has some major problems as you can see! I haven’t worked with vertex-lit materials very much so maybe I’m missing something fundamental about them. I have no idea why it’s missing so many polygons and rendering them improperly. Any tips on how to fix this? It looks like this material is the best to use as it’s the cheapest and still looks pretty nice.

  4. The last image is a maya screenshot. It’s slightly different than the others because the mutants are arranged differently and the sandbag base doesn’t have those wierd shadows around it. Otherwise it should look the same as the others. This is what I’m aiming for… not sure how to get it in Unity to look closer to this.

Any tips to make this look closer to number four or insight on these materials would be greatly appreciated!

Thanks,

Valri[/img]

I’m not sure I have a direct answer, but am I correct that you’re using the transparent shader on everything? I think you’d get better results if you used a non-transparent shader for everything except the tree branches and plant objects. Also that should be faster, since the iPhone graphics chip, unlike most, doesn’t draw pixels that are hidden behind obstructing objects, but it can only do so if the material is non-transparent. (A transparent material using 100% opaque alpha doesn’t count.)

–Eric

another thing is that you might want to turn up the editor quality to fantastic. Thats for example a potential reason behind the “washed out textures” you are seeing there.

Thanks for the tip on turning everything up to fantastic, looks way better now.

The thing about giving the poly’s with alpha a different material is just that I created the whole level as one poly with everything on one texture sheet. It seems like that is the best way to create it to save memory, something to do with draw calls so the less objects and textures the better. If there isn’t another solution then I will have to just seperate the objects into transparent and non-transparent.

Also I didn’t know that about not drawing pixels if they are obstructed by another object. Thanks for the help.

I’ve had the same problem, not gotten around to posting about it yet. Look at the trees in the screenshot to see what I’m talking about.

What I want, and what I think valriviala wants too, is a shader that will render with alpha channel (transparency) on the texture. Where solid parts of the image are solid, transparent pars are transparent, and semi-opaque parts appropriately; like it would in photoshop.

Cutout comes close; transparent parts of the texture appear transparent and solid parts are solid, but the semi-opaque pixels are rendered either on or off, so we lose anti-aliasing.

Transparent defuse renders with alpha correctly but behaves really weirdly Z-depth wise. It’s like it sorts depth on the object only, but also renders on top of other things; I don’t know why you’d ever use this shader.

What I’m looking for is something very straightforward: render the alpha accurately.

Any suggestions?

As for the final iphone quality, there are some things to take into account:

  1. Set graphics emulation to iphone. The editor does nowhere resemble what you will see on the iphone otherwise. Fantastic will only help you to see it the same way as in Maya (should have mentioned that above, sorry :sweat_smile:).
    The quality you see on the remote by the way has nothing to do with the iphone quality :slight_smile:

  2. As important as it is to have as few materials as possible, as elemental it is to seperate the transparent from the non transparent materials. You otherwise waste performance for all the non transparent textures and risk some interesting fighting issues at worst.

I’m going to try seperating the objects right away and then perhaps the transparent/vertex-lit material will behave properly. That makes sense about seperating the objects, I was thinking of it before but just went with one solid because I heard that the draw calls are the most important issue with memory. But of course it will take more memory if the whole level is using an alpha map when only parts need to. Having one extra object and material in there shouldn’t be a big deal.

I have set the graphics emulation to iPhone. I’ll have to check it on the actual iPhone soon to get a good idea of what it’s going to look like.

It is too bad there isn’t a good solution for these alphas, but I’ll wait until I seperate them, then I might not have a problem.

Hanford - Do you have your transparent objects separate from your non-transparent?