[x3d-public] Preparing for Blender importer/exporter work

Joe D Williams joedwil at earthlink.net
Tue Mar 5 10:55:19 PST 2024


The makehuman is a great thing to work on. We just need to connect it up with an loa4 skeleton if not already done). Seems like the number of points and order of points and texture points stay consistent with changes to the mesh taller/shorter and thinner/wider dimensions, so that is fine. However, best would be some consistent versions of skin and skeleton with reduced number of points and lower LOAs.

Good Going,
Joe


. 
-----Original Message-----
From: GPU Group <gpugroup at gmail.com>
Sent: Mar 1, 2024 6:28 AM
To: John Carlson <yottzumm at gmail.com>
Cc: Joe D Williams <joedwil at earthlink.net>
Subject: Re: Preparing for Blender importer/exporter work

> If you could make your PBR models accessible in a blender compatible format, that would be great.
Even better: re-install the MakeHuman MPFB2 in blender, and set its Library Settings > materials to PBR. Then you can generate something like 2^128 different permutations of humanoids thanks to several analog slidebars and discrete checkbox options in MPFB. Let's say 100M permutations. And you --as the last person to touch the slidebars -- will have the copyright on the character. 
And MPFB / Makehuman already has a system for clothing. That would be a great starting point for garment industry efforts. 
> The x3dv exporter currently exports motion as OrientationInterpolators and ROUTEs
In theory x3dv exporter could have another option on the export panel under export animations: [  ] interpolators  [x] HAnimMotion
-Doug
Attached: screenshot of gltf2 exported MPFB2 character with MPFB2 > library settings > materials set to PBR, exported to gltf + images + glb, images exported which include skin and clothing images, and 'apply modifiers' set on gltf2 export panel.
 
 



On Thu, Feb 29, 2024 at 5:03 PM John Carlson <yottzumm at gmail.com (mailto:yottzumm at gmail.com)> wrote:
Notes,
 
I will look into the gltf2 stuff, and perhaps do a pull request, but remember we need to include this in x3dv.py, perhaps as an external file to the .x3d scene, and/or change x3dv.py to include glTF2.  Provide export options, etc.
 
I have found that the quality of glTF2 suffers, especially because the a the gramps glTF model I used doesn’t support normals like we do in io_scene_x3dv.  So perhaps that’s something that the glTF2 exporter could learn from X3DV exporter.  Try comparing a gramps blender x3dv export vs a blender gramps gltf export.  Try both view3dscene vs sunrize.  Probably you saw similar in FreeWRL.  I’m guessing things have improved.
 
I do call image.save for the ImageTexture, but perhaps you don’t have my copy/an exception is thrown which I silence.  See:
 
image.save(), img.save() or something like that in current code.  It could be improved, like you say, include a folder.
 
I daresay we could do some kind of shader translation to Vulkan, I’m not sure of Vulkan support in X3D.
 
I have checked in gramps*blend files into X3DJSONLD/blend/ but I’m not sure about distribution.  Use with care.  I just wanted to make sure in case my system died that we had an accessible backup.  There’s other perl code I’ll probably be checking in over the next few weeks.  I know FreeWRL used to be Perl.  This is external scripting to manipulate VRML, I am moving towards external scripting with GraalJS/X3DJSAIL, along with XML conversion to JS.
 
The x3dv exporter currently exports motion as OrientationInterpolators and ROUTEs in separate files under blender/exp.  I believe this is Vertex Groups in action.  This appears to work well, but there are also PositionInterpolators to deal with (I’m not sure when).  This will probably be required for an entire scene.
 
I don’t have any experience exporting PBR, that would be valuable to export with X3D4.  Perhaps that’s what’s next on the agenda.
 
If you could make your PBR models accessible in a blender compatible format, that would be great.

On Thu, Feb 29, 2024 at 4:39 PM GPU Group <gpugroup at gmail.com (mailto:gpugroup at gmail.com)> wrote:
> Doug, where are you at for Blender and BVH? 
John, Joe,
Working on my other lives and hobbies these days, but a few weeks ago I looked again at exporting the Makehuman / MPFB2 from blender and learned a few things needed for exporting gltf2
1. in the MPFB2 menu that slides out from right edge of the main blender viewport > Library Settings > Materials > Skin, Clothing, Eyes - pick one of the PBR types from the drop-down lists for each of those materials because gltf2 exporter can't handle the more complex shader nodes MPFB2 uses for raytracing (if things export as white/gray its because the shader nodes in blender were too complex)
2. on the gltf2 export panel, find 'apply modifiers' and check it. That's because in the scenegrpah under Human.rig > Human > Modifiers and Vertex Groups - various clothing articles are Vertex Groups in the humanoid, and which ones get applied during rendering in blender are set in the Modifiers list, with unused garments being set to ignore. If you don't apply modifiers on export, ALL the clothing vertex groups get exported and it's a mess. I suspect other modifiers that change the shape of the human slightly if not applied will result in the rig not matching the skin very well after export.
3. on the gltf2 export export panel, check export textures - this will export the MPFB skin and clothing textures (set a folder during export so you can find the image files in the file system after exporting)
When I do these 3 things I can display the .gltf2 character in freewrl and view3dscene and it looks good.
 
But how to apply all this with x3dv exporter?
I read through the gltf2 code wondering if there was a way to paste your x3dv and b2x functions somewhere, to get the benefits of all the work khronos volunteers did on the gltf2 exporter. It has Apache 2 license, so we can copy and say 'derived from' and add to their copyright statement. 
But I didn't finish that analysis. I did make a python program to copy io_scene_gltf2 and change file names and license statement to /io_scene_x3dv (attached). So ready to hack. And there are 3 modules of interest, one that's gltf2 export specific, and would map to your x3dv.py. And a few with names like gltf2_export.py that traverse the node list
So what's missing from your x3dv exporter from gltf2 is the image export, the material shader-node 'gathering' and the apply_modifiers. Whether to copy and paste / combine with gltf2 code or do from scratch I can't say and didn't get far enough with specifics to say what 'gotchas' there are to combining code.
I didn't study gltf2 motion data, but gltf has options to export that, but might not be the way we would do it.
 
I looked at 2 versions of io_scene_gltf2 -- the one in Blender 4, and one on what seems to be the github project for it. The latter didn't export gltf2 properly - something wrong with the normal vectors for a simple cube. And most of the changes were for weird edge cases we wouldn't need. So I recommend the blender 4 version if code is going to be borrowed.
 
Good luck.
-Doug
 


On Thu, Feb 29, 2024 at 12:09 PM John Carlson <yottzumm at gmail.com (mailto:yottzumm at gmail.com)> wrote:
Since AFAlK, we do not have a X3D JSON or VRML Blender importer for python, I am casting around for solutions.  I have a sample VRML language syntax written for ANTLR, which might target Python.  I guess converting from VRML and X3D JSON to XML might be the most expedient solution. 
Further work on the Blender io_scene_x3dv exporter for BVH imports may be warranted, but I have one example BVH file converted, including OrientationInterpolators.  More interpolators may be indicated.  Perhaps doing a batch conversion of CMU mocap files to X3D would be warranted.  I have not looked at the X3d-Edit importer recently, I’m guessing it’s ahead of the Blender exporter.
 
At this point, I’m worried about demand.  It seems like a batch BVH to X3D converter might have some demand.
 
Doug, where are you at for Blender and BVH?






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20240305/72ab540e/attachment.html>


More information about the x3d-public mailing list