I have been working my way through the tutorials and got to HelloMaterial. I’m using the May 26 nightly build of jME3. It all works beautifully, except that the cube with base color “leaking” through leaks wrong. The screen shot on the tutorial wiki page shows a white cube with a magenta monkey graphic. The tutorial as posted produces a magenta cube with a gray/black monkey.
After scratching my head, spending several hours playing around with variations on the code, I found the source history on code.google.com. It seems that r9192 changed line 83 from a material based on ColoredTextured.j3md to one based on Unshaded.j3md. I changed my code to use ColoredTextured.j3md and lo, I now see the white cube with the magenta monkey.
I don’t know why that line was changed (way back in Feb 2012), but I respectfully suggest it be reverted.
I think you’re correct about ColoredTextured being deprecated. That’s what the commit comment says, anyway. I’m new here, so I don’t have the historical memory.
I don’t believe, though, that the fault lies in the tutorial. For example, in the advanced documentation there is a page about How to Use Material Definitions (.j3md). Its advice is consistent with the tutorial, i.e. set the ColorMap and the Color and the leak-through will just happen. But the problem is that when Unshaded is used in that manner, the leak-through happens in the white, not the black. In other words, and this may be just me jumping to conclusions, it would appear that Unshaded is interpreting the alpha in the inverse, or at least in the inverse of what ColoredTextured does.
In any case, I’m really enjoying learning about jME3. Thanks for the extensive documentation. I’ve now made it through the entire tutorial series with only one other major problem, and the forum already had a post about it.
It could also be that the tutorials results are what was given at the time and not actually what the expected behavior is… or anyway not desirable for some other reason.
I think with Unshaded, Color will tint the non-alpha portions of the texture. It is mutiplied by the texture values.
…so, I looked at the source image and the one in question has alpha where the monkey is. I guess this used to bleed through the color but not the colors are simply multiplied together.
There is no supported shader that does the old bleed-through effect and I’m not sure it’s entirely necessary. Someone else closer to the shaders would have to say whether maybe this mode should be added. It would be a simple change.
Guess the tutorial grew more and more outdated. This ColoredTextured used to be a feature (as described), and it changed many times (was depricated, and later possibly black and white swapped). I’ll rewrite it…
Yeah, the multiply is more useful in most cases (I use it myself in several places) but I can see use cases for the other behaviour too. The thing is the other behaviour is still possible, just not using the unshaded shader.
Really this is a case for shader nodes, when they come in fully you would be able to have a “color mix” node and use that instead of the “color multiply” node and get the old behaviour.