Ravi Posted July 5, 2018 Share Posted July 5, 2018 Is there any way to convert .fbx/.dae/.stl like 3D formats to .babylon grammatically. I am using Angular 4 and NodeJS as programming languages. I want to remove the dependancy of 3D software like 3D Max/Blender for exporting 3D model to .babylon format. Appreciate your help! Quote Link to comment Share on other sites More sharing options...
RaananW Posted July 5, 2018 Share Posted July 5, 2018 no converter is implemented, as far as I know. But we are always open for new extensions BTW - Babylon has an STL loader, you can export a scene directly from babylon. the rest - you will need to implement it yourself. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 5, 2018 Share Posted July 5, 2018 We also load gltf and there are some fbx to gltf converters out there: https://github.com/KhronosGroup/gltf#converters-and-exporters Quote Link to comment Share on other sites More sharing options...
sable Posted July 6, 2018 Share Posted July 6, 2018 I've just done something similar for 3ds files, which while not removing a dependency on blender, makes it really easy to batch convert models using the babylonjs blender exporter. I'm sure other formats could be converted using a similar method. import os import bpy import sys # see https://blender.stackexchange.com/questions/46990/how-to-completely-remove-all-loaded-data-from-blender?noredirect=1&lq=1 # make sure scene is empty bpy.ops.wm.read_homefile(use_empty=True) path_to_3ds = sys.argv[5] file_list = sorted(os.listdir(path_to_3ds)) autodesk_list = [item for item in file_list if item.endswith('.3ds')] for item in autodesk_list: bpy.ops.wm.addon_enable(module="babylon-js") path_to_files = os.path.join(path_to_3ds, item) bpy.ops.import_scene.autodesk_3ds(filepath = path_to_files) bpy.ops.bjs.main(filepath= os.path.join(path_to_3ds, item.replace("3ds", "babylon"))) # bpy.ops.export_scene.obj(filepath= os.path.join(path_to_3ds, item.replace("3ds", "obj"))) bpy.ops.wm.read_homefile(use_empty=True) And then call this using: "$BLENDER_LOCATION" --background --python ./convert.py -- "$PATH_TO_MODELS" Some fixing up afterwards (due to 3ds models not having a diffuse colour, and a few other things) is done using sed on the .babylon files after this, but what (if anything) needs fixing would depend on the input format. For the models I've been converting, it's been taking less than a second for each one. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.