Loaded Spatial (gtfl) remains lost

Load a fir tree and try to add it. Vain.

It loads something, because first I loaded * .bled and got errors. Then I found here ([Solved] Import Blender File (int64_t)) that I should use * .gltf. No more exception.

Code (Exporting Models as GlTF meshes from Blender :: jMonkeyEngine Docs):

final ModelKey key = new ModelKey ("media / model / bio / tannenbaum.gltf");
final Node scene = (Node) assetManager.loadModel (key);
final List <Spatial> tmp = scene.getChildren ();
rootNode.attachChild (scene);

tmp contains a camera and a light that I don’t need. The two geometries are there too.

Even if I try to hit the tree (over rootNode) with Colision (red ball example) I don’t hit anything. So it’s not there at all.

Counter test: I can import the * gltf, everything including the texture is back.

Counter test:
rootNode.attachChild(tmp.get(2));
or
rootNode.attachChild(tmp.get(3));
didn’t help.

GLTF exporter, export models with PBR material(Principled BSDF material in blender).

And this means that Model will be black until you will add Light Probe, or Directional light will lit it in some direction. Also Ambient light can affect metalness in it.

You can add custom material that is not PBR. but you need do it via code or SDK.

About physics, looks like you added Control, but you forgot add it into physicsSpace. You need both.
PhysicsSpace Object + Physics Control in Geom
to make physics work correctly.

Thank you very much. For other readers:
Test 1 (Everything is white, but it’s there):

final ModelKey key = new ModelKey("media/model/bio/tannenbaum.gltf");
final Node scene = (Node)assetManager.loadModel(key);
final List<Spatial> tmp = scene.getChildren(); 
tmp.get(2).setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
tmp.get(3).setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
rootNode.attachChild(scene);

Probably you could have just added a directional light to your scene rather than blowing away the whole existing material.

I use SimpleApplication from the examples, there already seems to be a light in it.

For other readers:
Test 2 (as I actually wanted it without phisics - no extra light, no frills):

	final ModelKey key = new ModelKey("media/model/bio/tannenbaum.gltf");
	final Node scene = (Node)assetManager.loadModel(key);
	final List<Spatial> tmp = scene.getChildren(); 
	final Material tmp_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
	tmp_mat.setTexture("ColorMap", assetManager.loadTexture("media/model/bio/tanne.jpg"));
	tmp.get(2).setMaterial(tmp_mat);
	tmp.get(3).setMaterial(tmp_mat);
	rootNode.attachChild(scene); 

I will need that with phisics and light later for minerals (coal, iron) …

Only if the examples added one. It does not include a light by default.

The material you are using to blow away the existing one doesn’t require lighting because it’s “unshaded”, ie: no light will ever affect it. Colors are solid and are always solid.

Okay, understood. question:

Can I somehow import “Common / MatDefs / Misc / Unshaded.j3md” into the Blender. Restoring texture is of course stupid.

Or: Inadequacy becomes virtue. So I can build the same tree in several texture variations.

For other readers:
Test 3 (Or simply copy the sun into it from jMonkeyEngine 3 Tutorial (3) - Hello Assets :: jMonkeyEngine Docs, then at least one side is visible):

	final ModelKey key = new ModelKey("media/model/bio/tannenbaum.gltf");
	final Node scene = (Node)assetManager.loadModel(key);
	rootNode .attachChild(scene); 
	
    // You must add a light to make the model visible
    final DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
    rootNode.addLight(sun);

I do that with other elements.

By the way: With two suns, Blender surface “Background” pretty much delivers the result of “Common / MatDefs / Misc / Unshaded.j3md” (so without gloss and fancy), only that it is already a bit shaded.

Thanks for all pointers.

My real problem, however, was that the tree was floating unexpectedly high in the air … I guess I positioned something wrong in Blender.

So, to avoid repeating this in multiple posts, I’m just going to repeat this here:

You need a light probe with PBR materials (GLTF) or you won’t have ambient light and things will look dark.

You need a light probe with PBR materials (GLTF) or you won’t have ambient light and things will look dark.
You need a light probe with PBR materials (GLTF) or you won’t have ambient light and things will look dark.
You need a light probe with PBR materials (GLTF) or you won’t have ambient light and things will look dark.
You need a light probe with PBR materials (GLTF) or you won’t have ambient light and things will look dark.
You need a light probe with PBR materials (GLTF) or you won’t have ambient light and things will look dark.

Essentially, your issues were answered in the first response but you ignored them and kept randomly trying things.

i think we just need good references, since many people dont even know what light probe is and just skip this knowledge.

one of good reference is:

thanks to @grizeldi

we could have wiki images that would present it too.

It’s all true… but there are two different ways a conversation can go:

P1: "I have a problem "
P2: “You need a directional light and probably light probes”
P1: “No, that’s not it, I’m going to keep running in the wrong direction.”
P1: “Tried this other thing that almost works but made it worse in some way.”
P1: “Tried this other thing that almost works but made it worse in a different way.”
…etc.
P1: “Hahah! It turns out I needed a direction light… but things still aren’t working 100%, suggestions?”

Or:
P1: “I have a problem.”
P2: “You need a directional light and probably light probes”
P1: “What are light probes?”
…useful conversation proceeds.

One of those is frustrating for everyone one involved and one of them is productive.

2 Likes

First of all, I would like to say that I think your work is absolutely brilliant. I love jMonkey Engine. In the hub: Your answers are quick, no matter whether on weekdays, on weekends or on public holidays.

I don’t want to upset you guys.

As a defendant, however, I would like to express myself.

I understand the process like this:
P1: “I have a problem”
P2: “You need a directional light and probably light probes and physicsSpace. You need both. "
P1: “Can I somehow use the material Unshaded.j3md?”
P2: “You need a directional light and probably light probes”
P1: “Can I somehow work in Blender without light probes?”
P2: “You need a directional light and probably light probes”

Maybe, a bit frustrating to be forced into the next lesson.
I have now understood that about light, but not about physics.

yes, but all your questions were answered in my first reply.

P1: “Can I somehow use the material Unshaded.j3md?”

my first post:

You can add custom material that is not PBR. but you need do it via code or SDK.

P1: “Can I somehow work in Blender without light probes?”

as i understand its about:

it wasnt question, you just said what you did, you even started with “For other readers:” and it wasnt declared as question and there even wasnt any “?” or “how solve it” or anything other.
So how could i answer if you dont needed answer?

The only thing i seen was:

My real problem, however, was that the tree was floating unexpectedly high in the air … I guess I positioned something wrong in Blender.

that is not really same as question you asked now.

Answer to your new question:

  • Blender use light probe source itself using Eevee rendering(2.8+ version).
    So generally yes, you work in blender without Custom light probes, you just use predefined ones, unless you want custom ones. see:

1 Like

This is a pretty gross mischaracterization of what happened.

I will keep this in mind when seeing your questions in the future. Thanks for the heads up.