How to: material with png alpha

28 January 2015 22:38
I must admit it was hard to make it work. And the giant tutorials demonstrating the wonders of blend4web does not really explain the basics. So, now that I managed to apply a simple alpha png texture I post how I managed to.

Hoping it can be useful to others and maybe to receive some hints back.

Result on blend4web:

Node map:

Blender Render engine.
29 January 2015 11:08
Well, those are Blender basics However, BI nodes functional is pretty underused, so yeah.. It's hard to understand it "as it is" without tutorials. In free time I'm working exactly on this tutorial (the idea is people rarely use BI node setups, so it's hard to learn without tutorials).

In your example you're just multiplying your texture and material by alpha value. That works as color mask, not as transparency mask. For it to work as transp. mask you need to put it in "Alpha" in output.

So here are basic steps to set up alpha:

1. Node tree

It's a simple node tree with transparent texture

However, it won't work yet. To do it, we need to:

2. Tell Blender that it is actually transparent. It's also blender options, so in Blender Game options we must find tab "Game Settings" and set it to, let's say, Alpha Sort. Better turn off backface culling. And that's all!



Hope it helped
30 January 2015 19:30
Hey thanks, that's great.
I use a lot nodes, but i cycle environment that is quite different.

1:Are "blender render" and "blender game" mutually working? I just switch to it "Alpha sort" and get back to Blender render ??

2: If I connect alpha in the last output node, how I can superimpose an alpha texture on another diffuse shader? A logo on a can for example
30 January 2015 21:06
Yep, they are pretty different :(

1 - Well, we trying to use Blender native functionality at maximum to make it more user-friendly, adding our buttons and things only where it is needed - like "do not render", "apply modifiers" and many others. So Blender contains options which are responsible for alpha parameters in openGL only in game mode/engine. And switching between BI and BG is just needed to find those options The engine just takes all of them, no matter where they are

2 - Alpha is just a black-white mask, so you can use color mix and just put this alpha value as a Factor (fac) - and it will add a color only where the mask is white, so actually the transparency won't be needed :)
03 February 2015 20:49
Ok. I used your node suggestion and now this is my node setup.
It's a can: there's the base metal material with a logo with alpha channel printed (mixed) on it.
It works perfectly except that it does not project shadows. (and it seems to me that also reflections does not work on it).

May you help me?

04 February 2015 10:47
The shadows must be turned on in object settings, so the objects that will receive that shadows must be specified too.

Dynamical reflections works only on flat surfaces like water or mirror, and how to fake it I wrote here :) Read through that topic, there are examples and explanation.

P.S. - I recommend to mix all the diffuse colors before material node, because, for example, the lower texture in your example will be shadeless (shading, emission, specular and such things are calculated in material node)
04 February 2015 16:30
>The shadows must be turned on in object settings, so the objects that will receive that shadows must be specified too.
Did it! But looks like a material issue: one project shadows the other does not; on the same object.
See screen

>Dynamical reflections works only on flat surfaces like water or mirror
I know, I used the flat plane selector in the object tab; and works great.

04 February 2015 17:05
Oh, yeah. Transparent materials don't cast shadows (except alpha clip), so the best decision is to add another object without material on the place of this transparent with "cast only" function (shadows -> cast -> cast only)
04 February 2015 17:54
but it's not transparent… it's a rgb blu color with an alpha texture on it…
I'm getting crazy, I dont know why it's not projecting shadow and not getting reflections. Its a material issue because same object with onether material works
04 February 2015 18:05
oK. Solved. Dont know why.
I tried to open a clean new file and appending things back.
Now it works.
Please register or log in to leave a reply.