Threejs includes a nice fbx – and other formats – converter script to Threejs’s JSON format, but there was some issues and improvements i felt the need for, so i’ve created a modified version of it.
This modified version includes the following changes:
- Map AmbientColor texture slot to Three.js LightMap
- Material map filenames only, full path removed
- New console arg “-b” used to override MeshLambertMaterial by MeshBasicMaterial
- Creates a local “/maps” folder next to .js file and save all textures to it
First thing i’ve noticed was there in no way to get lightmaps to work when using Maya, so i had to have a slot that did just that. Also when adding textures to materials the script would always fail when attempting to copy textures, because the source would try to copy into itself. Not sure why it was made like that, but it didn’t work for me. Copying the textures into a local folder was a need as i want things relative to my project root.
You can find the modified script here: GIST