How to modify the alpha value of a model

Right so now I am trying to have a “ghost” of a model that can move around the screen which looked REALLY cool in my head, but is proving slightly more troublesome to get on-screen.



In order for me to do this, I need to make the spatial partially transparent (so that it looks like a ghost) which, as far as I can imagine, would involve reducing the alpha of the material that the spatial is using. The most helpful topic I could find about this was this one:

http://hub.jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/translucency/



The problem with that is that it still requires you to be able to directly access the material, so how might I gain access to the material of a loaded model? For example if I want to use the Oto example model, how would I go about getting it’s material and then making it partially transparent?

You can convert the model to j3o, open the j3o file and then select a geometry and in the properties select “create j3m file”. This will create a j3m file that you can edit. By editing that and the model texture you should be able to get a transparency effect.

Many thanks for the exceptional speed of reply. However I must apologise for not explaining properly.



The effect required is that a ghost of an existing model must be created. So if at all possible I would like to be able to modify the transparency of the object at runtime.



Is such a thing possible? Or would I need 2 instances of each model? :confused: (And then more if I wanted to tint it a specific color).

Hm, you could use the unshaded material and then set a color and modify the alpha value. Can also be done via the material editor, either the same way or by creating a new material and setting it to the geometry via the properties. Or try the Lighting material the same way, setting the diffuse color.







Edit: And yes, you need two models for two visuals. You can load the model twice via the asset manager and then set the j3m material to one instance, the mesh will be reused.

1 Like