Unshaded model without material

Is there a way i can take my j3o model and set it so that it does not require light like in the unshaded material. When in apply the unshaded material i no longer have my model texture/colors. Normally i understand that you should export a texture image or something but i’m not using any images i’m not completely sure how. I also tried setting multiple lights but I couldn’t get it to light towards the four corners of my chess board. I also tried creating a custom material file (extending/including) light.j3md and modifying it to not need light and unshaded.j3md to show the models texture/color, however i couldn’t get it to work either. Is it even possible to do this through a custom j3o material file?

When you setup the unshaded material then you also need to give it the same textures that the lighting material had.

This is the code i currently have for loading a model and by default it needs light. I didn’t use a texture file because the j3o already has it, that’s my problem.

Spatial board = assetManager.loadModel("Models/board/board.j3o"); rootNode.attachChild(board);

now how to i covert this into something that is unshaded (doesn’t need light). If i use unshaded it removes the texture in the j3o and i don’t have a texture file to upload.

The lighting material that is loaded by the j30 already has its setTexture() method called with the appropriate textures. To set a new material you will have to do the same thing.

You could traverse the whole model hierarchy and find any Geometry, replace their material with an unshaded material and copy the textures over. This is all pretty straight forward if you poke around in the javadoc.

Could you be more specific i’m not sure if i understand. So how would i create a new material to do this because i’m not actually calling a method to set a texture, its just there?

By the way:
Originally i had a board.obj and board.mtl (the mtl did not link to any other files), I then converted this obj to a j3o.

Do the tutorials. They will tell you how to setup a material, set its textures, etc… The rest is just basic Java programming.

But my texture is just whats in the mtl file? I don’t actually have a uv mapped image?


I don’t really have time to write your code for you, unfortunately. You will have to do some of the legwork yourself.

You can also open the j3o-model in the SDK and change the material and textures, that is also covered somewhere in the docs.

I think I understand those two methods but how do I get the material the j3o/Spatial is using to call them?.


…though I’m starting to think this task may be beyond your current coding abilities.

Okay, so i understand how to get the material with the Geometry object but how can I cast and convert my Spatial into Geometry or should I be loading the model as Geometry in the first place?

You will have to traverse the hierarchy of the model as I mentioned before.

How did you make the model that you import? Using Blender?

When I tried to do this I found it much easier to add materials and textures in Blender because that interface is friendlier and it is far easier to learn using Blender thanks to all the video guides online.

If you are using Blender, I suggest adding the textures there and when importing the model to JME, the textures will hang on.

If you don’t use Blender, what are you using? If your editor doesn’t support it, perhaps it’s easier to remake your chessboard in Blender and add the texture there.

I still don’t know how to do lots of those things in JME, perhaps I’ll learn one day but I’m still happy if I can just get it working, any way, and Blender was easier to start with.

Oh, and there’s an option for “unshaded” in Blender, so you won’t have to do any coding in JME. Just import it.

(wow, I just said the Blender interface is friendly… never thought I would oO )

I can’t really agree with you there ettavsdro. The material settings from blender do not map directly to settings in game engines as it is a modelling program not designed for real time rendering.

Setting the textures and flat/smooth shading will work but anything after that may well not.