How to prepare free 3D assets to importing?

Hi everyone,

Unfortunately, provided advices didn’t help much. Some glTF-Blender-Exporter examples even failed to export. And it doesn’t explain all I need. With such simple examples without animation I hadn’t problems even on my own. I even mentioned about it here: How to attach physics to imported mesh?

What I really want to know is how to integrate blender models downloaded from free sites into Babylon projects. Especially interested in weapons for FPS games for now. Particularly texturing, firing and reloading animations are expected in those models. But Blender allows everything of it in different ways. Meshes might be animated in Object Mode or Posing Mode, might be integrated into .blender file or exist as separate files. Also there is a lot of options for textures. All of downloaded models didn’t work correctly right from the box. I tried to export it as .babylon, .gltf and .obj. Everything had different problems. Which format is preferable by the way?

I will be very grateful if someone will share a video with creating, texturing and animating of weapon and following exporting and importing of it into Babylon. Or at least a process of adaptation of 3rd party weapon model for Babylon. Or at very least if someone will share animated and textured weapon models for .blender that will work with Babylon (with 100% confidence). Blender 2.80 is preferable.

I understand that probably I am asking too much. I am not very familiar with Blender. Of course I’ve watched basic tutorial, but it doesn’t cover the whole process. It’s only about Blender itself. And I need particular practical examples specially for Babylon. I am a programmer, not an artist. I just need some working assets to train Babylon coding skills.

Thank you in advance.

2 Likes

@splash27 : I took a look in Blender 2.76 at the file in the link you posted above. Loads into Blender fine. Then I exported it to .babylon and tried to open it in the sandbox. I got this error message 6X :

BJS - [14:50:40]: Invalid magic number in DDS header.

I have no idea what that means - maybe @Deltakosh or one of the other Microsoft folks can tell us.

It turns out that there are 20 DDS textures exported and 2 of them are 10+MB in size and 2 are 5+MB in size. That is quite a load, but I have no idea which are the six that produce that produce those 6 errors.

The geometry looks OK but 75 bones is a lot of bones.

Given the issues with the textures, I just opened the exported the file from Blender with the Babylon Exporter and then opened the . babylon file in the sandbox - just by itself - no textures. See image below.

It loads with lots of checker textures substituted for the missing textures. With the panels open, I then went Select Skeletons->Metarig (A), then in the right panel select Animation Ranges->Click on an animation (B).

The animations play fine. So the issue seems to be with those DDS textures.

From the download site, I see some comments that it was ripped from a game - probably explains all those DDS textures. You could export them all from the Blender file as .png files. Then delete all the DDS files from the Blender file and replace them with those png files and try again. A lot of work I know.

There is also a TGA file. No idea if BJS can use those.

I’m not around a lot at the moment due to family medical problems

cheers, gryff :slight_smile:

1 Like

By my experience about 50% of free 3D models lack something or have some flaws in them (that is why they are free, sometimes). So, if you are unfamiliar to Blender, sometimes it is wiser to spend a bit and buy 100% working model than spend several days trying to repair a broken one.

Thanks a lot I will try to play around it also. But please share your progress if you’ll try to continue to dig into it later. Wishing well to your family.

It is acceptable in general, but how can I be sure that bought model will work fine in Babylon?
First I need to understand the whole process and repairing of broken model might be very good for training purposes. But for now I don’t know how to do this, that’s why I started this topic. :slightly_smiling_face:

1 Like

Hello there, I have run into the same problem. Actually I have not yet found even ONE free animated 3D model that would work out of the box. Only modelst that are used in BJS examples does work offcourse. This fact prvents me from buying paid models because I am afraid that they won´t work either :frowning: Usually no textures appears and animations do not work. As I am developer and not 3D modeller, this is sadly show stopper for me :-/ I could somehow edit these models in Blender, but I dont know where to start - it is everything as you said - many ways to have things done while some way work and other does not.

If someone can find simple tutorial how to implement texture and simple animation in blender that WILL work once imported into BJS - that would be massive :))

nod. i guess around 10% of our Q&A posts… involve SOME problem with a model-import… in a myriad of different ways. Sometimes I think we need a stand-alone “Model Massager” … it attempts to make ANY model… BJS-ready, and if it can’t, it explains why.

Model-massaging should be one of our highest priorities, but it’s not. The model-massager should probably be part of the BJS Sandbox.

It’s easy for me to TALK ABOUT model-converting and model-massaging, but to actually build it/them… is probably a miserable task. Still, bad model-importing REALLY hurts BJS reputation… so the quicker/better we can make that happen, the quicker/better BJS reputation… skyrockets.

Thanks for the topic, Splash. Even though it hurts, it’s still the truth. It isn’t really anyone’s “fault”… it’s just that there’s lots of model formats happening, and we haven’t found/built great tools to deal with that, yet.

I suppose that 90% model-import questions are about Blender, other DCC tools have much less problems. Also, most of the solutions of these questions should be implemented in Blender before exporting to Babylon… so they are more Blender-side questions…
Anyway I suppose we need a kind of separate tutorial for Blender users with a lot of screenshots and 2 main topics (at least):

  1. How to correctly export static 3D model with all textures.
  2. How to correctly export animated/rigged 3D model with all textures and animations.
  3. How to understand that model which you’ve downloaded is bad or broken and don’t waste time trying to work with it :slight_smile:
1 Like

Plenty of SketchUp and SketchFab questions, as well. Unity, Maya, 3dsMax, others, too.

(Some-) People want plug’n’play models to populate their scenes. They want to drive “this” and fly “that” and throw “the other”. These people are not modellers, they are scene-layout and game-logic folk. They want physics and collisions possible on everything they import, and they often want to change the colors and textures… in-scene (without even SEEING the inside of a modeller program).

They HATE root nodes. :smiley: They don’t want to drill-into the hierachy of the model or its subMesh… in the inspector. They JUST want it to work, and be properly lit/shadow-casting, and have ONE gizmo/parent to position/rotate/scale. They want it easy, and it’s easy to understand why.

Math/BJS-built models are cool, too - no import needed… just a code paste. All too rare.

Plug’n’play game/sim-making… I want it myself. Learning a modeller package… WHILE learning BabylonJS and geometry and all their terms… makes the game-making task just “too much”. Advanced modelling comes later… after the mock-up and proof-of-concept is tested. If the user’s dream/vision… is too big for mock-up performance, then there’s no reason to spend a half-year learning to drive a modeller and making dream-specific models. That’s my take. :slight_smile:

I suppose the best solution would be to create DCC modeller on the basis of Babylon engine. Since Babylon goes Native soon there could be online and offline versions. I hope we shall see Babylon modeller in not very distant future…

Why not a “convert ANYTHING to BJS-plug’n’play” stand-alone program? Making a modeller is a massive task… me suspects.

Back in the old days, we had a “make a .babylon file from other formats” thing… if I rem right. Long ago… probably outdated and recycled by now. :slight_smile:

Does anyone want to venture a guess… of how many stand-alone 3D model formats… exist across the planet, at this time? Let’s hear it. :slight_smile: Don’t forget JSON, Collada, Renderman, Lightwave, and X3d. (vacuum tube model formats) heh

If we speak about exchange formats - their number is very small.
Below is the list of supported 3D File Formats from Sketchfab
Only FOUR formats (marked bold) are recommended…

  • 3DC point cloud (.3dc, .asc)
  • 3DS (.3ds)
  • ac3d (.ac)
  • Alembic (.abc)
  • Alias Wavefront (.obj)
  • Biovision Hierarchy (.bvh)
  • Blender (.blend)
  • Carbon Graphics Inc (.geo)
  • Collada (.dae, .zae)
  • Design Web Format (.dwf)*
  • Designer Workbench (.dw)
  • DirectX (.x)
  • Drawing eXchange Format (.dxf)*
  • Autodesk Filmbox, FBX (.fbx)
  • GDAL vector format (.ogr)
  • Generic Tagged Arrays (.gta)
  • GL Transmission Format (.gltf, .glb)
  • Initial Graphics Exchange Specification, IGES (.igs, .iges)
  • Kerbal Space Program (.mu, .craft)
  • Google Earth, Keyhole Markup Language (.kmz)
  • LIDAR point clouds (.las)
  • Lightwave (.lwo, .lws)
  • MagicaVoxel (.vox)
  • Mimesys Q3D (.q3d)
  • Minecraft (.mc2obj, .dat)
  • Open Flight (.flt)
  • Open Inventor (.iv)
  • OpenSceneGraph (.osg, .osgt, .osgb, .osgterrain, .osgtgz, .osgx, .ive)
  • Polygon File Format (.ply)
  • Quake (.bsp)
  • Quake / Valve source engine (.md2, .mdl)
  • Shape (.shp)
  • Stereolithography, Standard Tessellation Language (.stl, .sta)*
  • Terrapage format database (.txp)
  • Valve source engine (.vpk)
  • Virtual Reality Modeling Language, VRML (.wrl, .wrz)
1 Like

Nice list, L! THANKS! Well done.

“Kerbal” hahaha… I’d love their models… being easy-BJS-able.

Mizewell bring-in the Kerbal body models/armatures/anims themselves, too. FUN! I suppose that copyright thing would get in the way, somehow.

1 Like

@splash27 : Well, I had a couple of hours yesterday to poke around with your file. I created all the texture files as .png (both the .dds and .tga) files. Then replaced them all as textures in the Blender file. (I removed those textures that were assigned as normal textures - just left them blank.) Image 1 shows the result.

I also tested out the animations - the “add silencer” is weird. From the starting camera position the silencer is invisible - you see just an empty hand. If you move the camera to a side view - then it works fine :thinking: No idea what is going on but see Image2 below

Anyway here is a zip file contains the exported .babylon file and all the new textures (no normal textures). Try it yourself in the sandbox - select the metarig skeleton and play the anims as I said above.

gun1.zip

There is also a .log file included from the .babylon export. It shows 20 + warnings most of which are the lack of normal textures. A couple refer to the geometry - vertices with no faces and bone influence exceeding the standard. Let me know if you would like the .blender file - I can zip that up too.

No feedback from the Microsoft guys about what those .dds errors I mentioned above are … :frowning:

cheers, gryff :slight_smile:

gun2

gun

2 Likes

Thanks a lot, @gryff!

Could you also share edited .blend file?

I will try to integrate it into my code later.

Some other thoughts. For weapons alongside with first person view we also typically need to add pickable instances. I mean rifles just laying on the floor that we can grab. I suppose that in real life artists create separate low polygon models for this purpose, without any animations included (because it’s not needed). Just wondering if it’s possible to do this from the same loaded file in Babylon? We can, for example, clone every mesh of the rifle (except hands) and merge them to simplify positioning and scaling of the whole rifle. Then we can clone this merged rifle as much times as we need (I think it will be even better to create instances here instead of cloning).

However there are some things that worries me here:

  1. I am not sure that merging of meshes will work correctly here for such complex structure. But instead we can parent all child components to invisible box, for example.
  2. I want to be sure that cloned components will forget everything about metarig and animations (to save memory). And playback of rifle’s animations in hands will not touch these cloned instances.

Just thoughts. I will try it later and will respond here. But please share your thoughts about this if you know something. :slightly_smiling_face:

@splash27 : Ok, here is the .blend file :slight_smile:

gun2.zip

A couple of comments about it :

  1. I tried to pack all the textures for you - so you should not need to go looking for them.
  2. When you export the file to .babylon make sure the “add silencer” animation is showing in Dopesheet panel .
  3. When you load it you should now see all the bones . You don’t need all of them. Take a look at this video about creating this type of rig :

FPS Created in Blender

At about 7 minutes in, he deletes all these extra bones.

  1. There are other bones in the gun eg. “bullet”. I checked the animations and it does not seem to do anything. Is it needed? You might want to check all those bones in the gun - are they needed?

  2. If you examine the meshes in the Edit Mode, you will find that you can “remove doubles” but it screws up the animations. You might want to consider creating your meshes and rig as described in the above video. (A quick test let me remove 5K+ vets)

  3. If you are looking for pre-modeled low poly guns, this link might help : Ultimate Gun Pack by Quaternius.zip 7 MB. They are free to download - but make a donation if you can. All kinds of weapons.

  4. The exporter will throw errors due to the lack of Nornal textures. You can either add those normal textures in a .png format, or go through the all the materials and delete references to normal textures.

Hope that helps.

cheers, gryff :slight_smile:

@gryff,
Thank you a lot. I was trying to integrate it into my engine and it works. :slightly_smiling_face:

However I tried to edit your .blend file. Removed unnecessary bones and animations (that I don’t need). I also removed all channels in all animations that was related to removed bones. And also added one new necessary for me animation (hide_unsil, just reversed version of draw_unsil actually).
Now I can’t export it correctly:


Hands are disappeared and there is no references to textures for some reason. What may I do wrong?
There are .blend, .babylon and .log inside.
https://1drv.ms/u/s!Ar9xb-_eK-ligYcEhU5IZ8wPe_BYcQ

@splash27: I get the same result - but I see you have converted it to Blender 2.80. I’m having some trouble with Bender 2.8 so I will see if I can fix that. Will also try to look with more detail at your files.

It does seem that the .babylon file when loaded into the sandbox tells me that the mesh is there and its material - but is not showing up. Right now, I have no idea why!

cheers, gryff :slight_smile:

@splash27 : Well I had some more time to look at your Blender 2.80 file and the disappearing “hands” mesh. I don’t have an answer but found a few things that seem strange.

there is no references to textures for some reason

I’ve no idea how you got from the 2.7x file to 2.80 file but first thing I noticed was opening the “shading panels” then looking at all the mesh materials (see image 1). No cycles or evee materials, and note the box “Use Nodes” is unchecked for any mesh, although something gets exported. Probably explains the lack of textures.

Now as for the missing “hands” mesh, I did the following things:

  1. Opened your .babylon file in the sandbox and the “hands” mesh is there (left panel, Image 2), so in the right paneI I activated “wireframe” - the “hands” show up! I then selected the metarig as before and brought up the animations - the animation plays BUT the “hands” mesh does not move. (see image 3)

  2. So I looked into the .babylon file at “hands” and I see this :

a. for the original .babylon file I sent you:

{“name”:“hands”,“id”:“hands”,“materialId”:“HK416_1c.v_hands.vtf”,“billboardMode”:0,“position”:[0,0,0],“rotation”:[0,0,0],“scaling [1,1,1],“isVisible”:true,“freezeWorldMatrix”:false,
“isEnabled”:true,“checkCollisions”:false,“receiveShadows”:false,“tags”:”",“skeletonId”:0,
"numBoneInfluencers":8

b. but for your latest 2.80 export:

{“name”:“hands”,“id”:“hands”,“materialId”:“v_hands.vtf”,“billboardMode”:0,“position”:
[0,0,0],“rotation”:[0,0,0],“scaling”:[1,1,1],“isVisible”:true,“freezeWorldMatrix”:false,
“isEnabled”:true,“checkCollisions”:false,“receiveShadows”:false,“pickable”:true,“tags”:"",“skeletonId”:0
,“numBoneInfluencers”:0

So that mesh coming from Blender 2.80 has no bone influencers. No idea why this is happening as both the exporters are set to a max of 8 influencers .

I don’t know how you created this file - but there do seem to be issues (certainly with the materials).

I might also note that when you deleted those unused bones - a lot of empty vertex groups got left behind. Impact of all this … ?

cheers, gryff :slight_smile:

screen280x2

screen280x3

@gryff, I just opened your .blend file in Blender 2.80, removed unused bones, animations and also silencer mesh, added hide_unsill animation and saved it. Then I exported it with babylon exporter 6.2.1.

So, all my 2.7-2.8 conversion is just opening your file and saving it in Blender 2.80.