GLTF Materials?

Is it possible to export materials from blender using GLTF as is possible with Ogre3D?

I saw that GLTF has an option to export materials in the export window in blender, but it didn’t seem to change the appearance of the model in the SceneComposer.

You may have to explain what you mean.

When I export GLTF from blender and import it into JME, I have textures, PBR material, etc…

1 Like

Ok, so I colored my model in blender using a number of different materials, each with a color I need. Exported with GLTF and converted to J3O.

The model appears completely gray in the SceneComposer (even though I didn’t use gray, and yes, there was light). In the program, the model is completely black (even though there is light).

Plus, I wasn’t really sure if GLTF was supposed to be able to export materials anyway. :face_with_diagonal_mouth:

If you are using flat colors to cover the surfaces don’t create multiple materials. Make a single image with the palette you need, then when uv unwrapping split all the faces of your model and collapse all vertices into a single color. This way you end up with a single material (you can reuse the same texture for many models).

This video explains the technique: https://www.youtube.com/watch?v=8NEmx0cHwoI

1 Like

GLTF export PBR materials, but we do not have your model in Blender, so hard to tell how you made it there. In Blender it should be “Principled BSDF” material as i remember. There is GLTF Khronos Blender plugin wiki there too that explains what is needed.

1 Like

What type of light(s) ?

If it appears black and gray, that’s a big indicator that the scene still needs a LightProbe in addition to a DierctionalLight.

Even tough this SDK’s scene composer has a button to enable a light probe for viewing a model, it seems to have a small default radius and will not always light up the model you are viewing depending on its scale and position in the scene.

Ok, thanks. :+1:

Hi,

As mentioned you need to add a light probe to the scene.

Related topics:

1 Like

Saw this and I wanted to note that it can be desirable to use different materials for different parts of an object, and that objects that do so will still all follow the same armature if they’re animated. If you do this, though, I’d recommend adding an additional root empty to the model in the JME editor to better keep track of it and pass it around - the Armature technically handles this, but I remember having a little trouble trying to get the animations to play nice when I applied spatial functions directly to it in code, and a unified root also lets you put your other object nodes (any lighting, colliders, etc) adjacent to the armature which, IMO, is a bit more organized.
Just keep in mind that while multiple objects can share one material, a single object that uses multiple materials will break into that many objects on import (or is it technically on export? I can’t remember if that was a JME limitation or a GLTF limitation now that I think about it). So creating good UVs and texture images is pretty much always worthwhile overall.

It also lets you rescale the real model to a standard size while still having a scale=1 spatial to pass around to other things… which can be convenient if you really do want to scale things for different reasons.

1 Like

Saw this and I wanted to note that it can be desirable to use different materials for different parts of an object, and that objects that do so will still all follow the same armature if they’re animated.

but it works like that… You can have armature that have multiple Geoms with different multiple materials on them.
Even more, Blender GLTF Export/JME Import different materials as different Geoms into JME, so it works perfectly in JME.

So lets say you have 3 Geoms where each of them have per 3 materials, then after JME import, you will have 9 Geoms and each of them animated properly (since armature just need verts coords)

Just keep in mind that while multiple objects can share one material, a single object that uses multiple materials will break into that many objects on import (or is it technically on export? I can’t remember if that was a JME limitation or a GLTF limitation now that I think about it). So creating good UVs and texture images is pretty much always worthwhile overall.

I were using multiple materials on same Object in Blender, and it export well with animations.
Maybe its issue in some new Blender version / GLTF exporter or something?

but it works like that… You can have armature that have multiple Geoms with different multiple materials on them.

Yes, this is what I am saying. We are in agreement.

I were using multiple materials on same Object in Blender, and it export well with animations.
Maybe its issue in some new Blender version / GLTF exporter or something?

The issues that may arise don’t have to do with animations looking right or not in JME, that usually ends up fine. In this particular case, the specific thing to note is that a single object with multiple materials in Blender will export to multiple Spatial objects. If you’re using an armature, this rarely causes issues, as the multiple new Spatials will be parented to the same root node and thus easily handled together in code, but if you aren’t using an Armature then it can occasionally make things more complicated.

Best practice, in my opinion, is to always add a root node (like Blender’s Empty, equivalent in the JME scene graph editor) to complex objects such as characters in order to ensure that they are handled cleanly and simply in code. Even if you’re using an armature, the additional root node can be useful for reasons I believe have been well discussed above.