I was curious to see how Assimp handled FBX files.
Thanks
I was curious to see how Assimp handled FBX files.
Thanks
In my experience it handles them better than jme3-plugins does, but thatās a very low bar!
Yeah, I know, thatās why I wanted to give it a try
I loaded āRPM_RandomAvatar.glbā using jme3-plugins-3.6.1-stable and got garbage meshes:
As you reported, jme3-plugins created both an AnimComposer
and a SkinningController
. However the AnimComposer
didnāt contain any animation clips.
When I disabled GPU skinning, the SkinningControl
threw an ArrayIndexOutOfBoundsException
. I plan to file an issue for that crash later today.
When I loaded the same model using MonkeyWrench-0.6.0, it created a MorphControl
and a SkinningControl
but no AnimComposer
, as you reported. The lack of an AnimComposer
is reasonable because the file doesnāt contain any animations.
Correct, āRPM_xxx.glbā files themselves typically donāt contain animations.
The missing AnimComposer
when using MonkeyWrench
can be a hurdle if you wanted to add animations from external glTF files. Is there any way to solve this problem?
Oh no you didnāt
Is there any way to solve this problem?
If you want your model to include an AnimComposer
with no clips, you could instantiate one and add it to the model.
Itās no secret that JMEās FBX support is minimal. We donāt āofficiallyā support it, in my opinion.
If you want your model to include an
AnimComposer
with no clips, you could instantiate one and add it to the model.
I just remembered something ⦠for best results, the AnimComposer
should precede the SkinningControl
, so:
SkinningControl sc = (SkinningControl) RagUtils.findSControl(modelRoot);
Spatial controlledNode = sc.getSpatial();
AnimComposer composer = new AnimComposer();
controlledNode.addControlAt(0, composer);
Kim integrated the fix for issue 5461 today, so I imagine it has a good chance of being included in LWJGL v3.3.4 .
Hi @sgold ,
I hope this message finds you well.
Iām considering using MonkeyWrench
as an alternative to the GltfLoader
.
Specifically, Iād like to know if MonkeyWrench
currently supports loading custom properties from glTF files.
If not, would it be possible to integrate an external component like GltfExtrasLoader
alongside MonkeyWrench
to achieve this functionality?
Thanks for your time and insights!
Here are some examples I am referring to:
.gltf
"nodes" : [
{
"mesh" : 0,
"extras" : {
"testString" : "I am string",
"testFloat" : 1,
"testBoolean" : "true"
},
"name" : "Cube"
}
],
public class GltfUserDataLoader implements ExtrasLoader {
@Override
public Object handleExtras(GltfLoader loader, String parentName, JsonElement parent, JsonElement extras, Object input) {
// if its a geometry, we want to add all the geometry userdata
if (input instanceof Spatial) {
if (extras.isJsonObject()) {
JsonObject ext = extras.getAsJsonObject();
for(Entry<String, JsonElement> element : ext.entrySet()) {
Spatial spatial = (Spatial) input;
if (element.getKey().equals("open")) {
spatial.setUserData(element.getKey(), element.getValue().getAsBoolean());
}
}
}
}
return input;
}
}
Usage example:
public void setupScene() {
GltfModelKey key = new GltfModelKey("MyScene.gltf");
key.setExtrasLoader(new GltfUserDataLoader());
Spatial scene = assetManager.loadModel(key);
...
}
Specifically, Iād like to know if
MonkeyWrench
currently supports loading custom properties from glTF files.
MonkeyWrench relies on the Open Asset Importer Library to load asset files. Assimp parses āextraā properties in glTF files as long as the properties do not have array values. (I filed a GitHub issue regarding this in October.) Assimp records non-array āextraā properties in its node metadata.
MonkeyWrench logs node metadata (if the isVerboseLogging
parameter is set in the AssetKey
) but it currently doesnāt do anything else with them:
Node metadata:
testBoolean: "true"
testFloat: 1
testString: "I am string"
Converting node metadata to JME user data would entail a minor enhancement to MonkeyWrench.
Would string, float, and boolean extras be sufficient for your use case, or are there other types you require?
Thanks again for your assistance regarding MonkeyWrench and custom properties.
Iāve compiled a list of potential value types assignable via Blender:
Excluding array types, I believe these should cover most use cases I can foresee.
It would be great if you could update MonkeyWrench to convert this metadata to JME UserData.
If I release now, would you rather target
?
The first one: jme3-lwjgl3-3.6.1-stable and LWJGL v3.3.2
Please try MonkeyWrench v0.6.1.
@sgold Thanks so much for your help! The new feature is working great!
// Usage example:
String[] extensions = { "3ds", "3mf", "blend", "bvh", "dae", "fbx", "glb", "gltf",
"lwo", "meshxml", "mesh.xml", "obj", "ply", "stl" };
assetManager.registerLoader(LwjglAssetLoader.class, extensions);
LwjglAssetKey key = new LwjglAssetKey("Models/TestCube.gltf");
key.setVerboseLogging(true);
Spatial model = assetManager.loadModel(key);
rootNode.attachChild(model);
Dumper dumper = new Dumper();
dumper.setDumpMatParam(true);
dumper.setDumpUser(true);
dumper.dump(model);
Output:
Building "Material" material for the "CubeMesh" mesh...
Node metadata:
pBool: true
pFloat: 1.0
pInteger: 1
pString: "CubeNode"
...
n[12] "Scene" (has parent)
n[12] "Cube" pBool=true pString="CubeNode" pFloat=1.0 pInteger=1
g[12] "CubeMesh"
mat"Material" def"PBR Lighting" dTest,dWrite,NOwireframe,faceCull=Off,blend=Off with 11 parms:
BackfaceShadows: false
BaseColor: r=0.8 g=0.042 b=0.04
Emissive: rgb=0
EmissiveIntensity: 1
EmissivePower: 3
Glossiness: 1
Metallic: 0
NormalType: -1
ParallaxHeight: 0.05
Roughness: 0.5
Specular: rgb=1
Mesh mode=Triangles numV=24 bufs[Position%3f Normal%3f TexCoord%2f Tangent%4f Binormal%3f Index%3ubyte]
Iām confident sharing this detailed information will lead others to your valuable library. Thanks again for your help!
Today I uploaded a new version of the Erika character model to the characters-for-jme repo.
The characters-for-jme models are probably not useful for serious games, but they serve as a proof-of-concept for MonkeyWrench and ImportMixamo and could be used in demos and tests.
Today a new version of MonkeyWrench was released: version 0.6.2.
The new release is something of a trade-off: it benefits from various improvements made to Assimp during April-September 2023, but it also requires JME 3.7. Due to the a serialization format change (PR #2093), models saved using JME 3.7+ cannot be loaded using JME 3.6.1 or earlier.