I think the description is quite understandable: The OP wants to change the alpha value of the whole material (to achieve a fading effect). Maybe using material colors and changing the alpha value of the material colors over time could do the trick?
Thanks a lot Ogli!
I followed your suggestion and got the effect I wanted.
Here are the codes
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
opacity -= 0.1f;
ColorRGBA color = new ColorRGBA(1f, 1f, 1f, opacity);
With the above method, one should not put the object into the transparent bucket. Otherwise the object will disappear completely.
Then something else is wrong… because if you leave it in the opaque bucket it won’t sort properly with the scene. The only difference between the opaque and transparent bucket is the order things are drawn.
Or do you mean disappear completely when opacity reaches 0? Then, yes, but in the opaque bucket that is also happening but you are just randomly having it sort properly to draw the background instead of the scene that’s behind it. And changing the opacity isn’t really what you want to be doing.
I will code a little example to test this case and report back the results.
If there is another bug then it will be detected via this.
Otherwise it will be a good example for you and you can simply copy the code.
Now is lunch time, so expect some delay until the code arrives.
Oh yes, that’s right.
The thing I want to code will contain several cubes with monkey textures which will fade from fully visible to fully invisible and back again in a 3D scene.
If that’s not what you want, then that code will not help.