I’m creating some simple boxes and would like them to have a slightly transparent color.
The color gets rendered fine, but the alpha value isn’t used, it’s just always rendered as being 1.
This is the code that I use:
[java]
Box ownBox = new Box(Vector3f.ZERO, 0.5f, 0, 0.5f);
Spatial ownSpatial = new Geometry(“gridSquareHighlight_” + location.getX() + “_” + location.getZ(), ownBox);
Material ownMaterial = new Material(AssetManagerSingleton.get(), “Common/MatDefs/Misc/Unshaded.j3md”);
ownMaterial.setColor(“Color”, ColorRGBA255.createColor(0, 0, 255, 127));
ownSpatial.setLocalTranslation(0, 0.1f, 0);
ownSpatial.setMaterial(ownMaterial);
node.attachChild(ownSpatial);
[/java]
Am I using the wrong material perhaps, which should I use?
Wow thanks for the fast response!
Also, damnit, I knew I should’ve continued reading the FAQ…it’s just so long:P
Thanks again!
Don’t forget your browser has a search function too (normally ctrl f). It’s very useful for finding keywords on a page.
Yeah I should have thought about that.
The problem is though, it’s still not working.
It does sort of apply alpha, but its rendering transparency as black, instead of rendering what’s behind it.
Any idea what could cause that?
Its probably not in the transparent bucket, but I think thats mentioned in the faq too, isn’t it? ;p
I’ll go through the whole FAQ again then…it’s just so fucking huge and it has no ordering at all:P
To be honest you would be better off going through the tutorials. Transparency is definitely covered in some of the materials/etc tutorials although I’m not sure which ones off the top of my head.
@weeknie said:
I'll go through the whole FAQ again then...it's just so fucking huge and it has no ordering at all:P
Then fork the wiki page and edit it with a new, better ordering. Propose the new changes and see how that goes.
Being huge doesn’t mean being bad, specially for FAQs.They don’t need any order, as the concept of it doesn’t need it. But the tutorials are well organized.
@weeknie said:
I'll go through the whole FAQ again then...it's just so fucking huge and it has no ordering at all:P
If you think the FAQ is huge, then I've got bad and sad news for you: Game development is 100x that. Except it's fun. Most of the time.