Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Using animated models from Blender 4 — Gideros Forum

Using animated models from Blender 4

If you're using Blender 4.x animated models in Gideros, what's your process for exporting/converting/importing them?

To use animated models in the past I've used an older version of Blender, exported them as FBX files, then used the command line tool fbx-conv from Autodesk to convert them to json files, then used buildGdx in Gideros to load the model. Now using Blender 4.3, the same steps produce a json file in which the material includes an opacity value of 0.0. The model still loads in the Gideros app, which is evident because it still occludes things behind it, but the model isn't visible. Manually editing that it in the json makes it render correctly. So somewhere in this process opacity is getting defaulted to zero. The fbx-conv tool hasn't been updated in 12 years, so I'm guessing that may be a factor. Or it could be some legacy value not used in the current version of Blender, leading the converter to default it to zero.

Can anyone suggest either a step necessary in Blender to prevent this, a different conversion tool, or just a different way of getting a model from Blender into Gideros?

Comments

  • hgy29hgy29 Maintainer
    Hi Paul,
    I find it easier to use glb/gltf format. It supports almost everything, including animations, and is rather well documented.
    You can use Glb/Gltf classes from Gideros 3D library to load them. There is an example of use in VR dungeon demo if I remember correctly.

    Likes: PaulH

    +1 -1 (+1 / -0 )Share on Facebook
  • PaulHPaulH Member
    I'll give that a try. Thanks!
  • MoKaLuxMoKaLux Member
    edited January 13
    I use the old fbx-conv.exe way and it seems to work as expected with fbx animation!?

    A fix was made some time ago to accomodate with new Blender breaking stuff:
    *3DObjLoader.lua: https://github.com/gideros/gideros/blob/f347f83e1a591c31bdc8f3934b42d1cf6cea695b/Library/3dbase/3DObjLoader.lua#L21
    -- bug new blender .obj format (not legacy), kd is no more!
    elseif fld[1]=="Kd" then mtl.kd={fld[2],fld[3],fld[4],1.0} -- support for blender < 3.4.0 (legacy .obj)
    elseif fld[1]=="d" then
    	if mtl.kd then mtl.kd[4]=fld[2] -- alpha XXX
    	else mtl.kd={1,1,1,fld[2]} -- rgba, support for blender >= 3.4.0 (new .obj format!), new 20230107 XXX
    	end
    *3DGdxLoader.lua: https://github.com/gideros/gideros/blob/f347f83e1a591c31bdc8f3934b42d1cf6cea695b/Library/3dbase/3DGdxLoader.lua#L150
    -- materials (texture id, tex path, color, ...)
    for _,mat in ipairs(gdx.materials or {}) do
    	local md=mtls[mat.id] or {}
    	md.kd=mat.diffuse -- json node "materials - diffuse"
    	md.kd[4]=mat.opacity -- json node "materials - opacity", fix missing alpha value for setColorTransform
    	md.modelpath = mtls.modelpath

    Likes: PaulH

    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
    +1 -1 (+1 / -0 )Share on Facebook
  • PaulHPaulH Member
    Ah. That could be my solution, too. The project I'm using to test this is probably using an older copy of the 3dbase library. I'll try with the current one.

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • one of my converted to json file:
    	"materials": [
    		{
    			"id": "SP_Prison_Tower_Mat", 
    			"ambient": [ 0.050876,  0.050876,  0.050876], 
    			"diffuse": [ 0.800000,  0.800000,  0.800000], 
    			"emissive": [ 0.000000,  0.000000,  0.000000], 
    			"opacity":  1.000000, 
    			"specular": [ 0.800000,  0.800000,  0.800000], 
    			"shininess":  25.000000, 
    			"textures": [
    				{
    					"id": "base_color_texture", 
    					"filename": "SP_Prison_Tower_Tex.jpg", 
    					"type": "DIFFUSE"
    				}, 
    				{
    					"id": "normalmap_texture", 
    					"filename": "SP_Prison_Tower_Normal.jpg", 
    					"type": "NORMAL"
    				}
    			]
    		}
    	],
    Blender 4.3.2
    blender4_3_2.png
    1920 x 1020 - 580K
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • PaulHPaulH Member
    In my case it may be specific to the model. I was using current 3dbase code, but mat.opacity was actually zero. If I just assign it to 1 in 3DGdxLoader.lua I see the model.

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.