Adding colour to a Node


I'm loading a Collada model using the ColladaImporter class, with its getModel() function that returns a Node.

As I'm now trying to add colour to this Node, I'm running into serious problems with this.

When I use a Box (the standard jME Box) for testing, my colouring code works fine… But then, Box is TriMesh. The Node doesn't really seem to work that way. Looking at its structure it's a tree of more Nodes. Perhaps the colouring isn't propagated properly? I am really running out of ideas after having tried to get this to work for a few hours now… Any help would be greatly appreciated.

Thanks in advance


Nodes are structural only, they do not have an appearance of their own. Attached to a node can be any spatial, which may or may not be one with an appearence (eg. could be another node, or could be a Trimesh).

If you have a Trimesh attached to a node, then you can get it with getChild and cast it to Trimesh, then do whatever with that.

when you apply a Materialstate to the Node, the children of this node will inherit this state when you do a node.updateRenderstate().

How do you apply the colour to the node?

I'm doing this to my anemone (this.anemone is the Node of my loaded model):

final MaterialState materialState = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();

this.anemone.setModelBound(new BoundingBox());


It comes out in plain grey, even though this.colour is ColorRGBA.magenta (for testing ;)).
If any of you have an idea, please (PLEASE!) let me know :P


Call updaterRenderState after attaching to the rootNode.

If anemone is a node, maybe its children already have a gray materialstate set.

If thats the case maybe you need to iterate over the nodes childern and get the materialstate of the kid and alter it.

Yep, that was it… I opened up the .dae file in a text editor and found that there was indeed a material set in there. When I removed its section from the file, and tried again, it worked (after a few trial-and-error attempts).

The colours look fairly dull though, which is realistic I suppose… But for our project we'd really like to have very very bright colours. Any ideas on how we can achieve this easily? Or will we have to go the pixel shading route if we want to do this?

Did you play with the other material settings?

you can get brighter colours if you add additional lights, or if you set a bright emmisive colour on the material state.