Buy and import assets from the Unity Store
Import process is similar for importing any asset
Most meshes as stored as .fbx format (Maya/Autodesk) or .glb/.gtlf - but you will also find some
.obj (wavefront) and a few other formats. Try to purchase assets created and/or updated in the last
year or two - they tend to have lower poly counts and perform much better in general.
Download and import assets using Unity
Once Imported textures and meshes can be inspected
Right clicking an element allows you to "Show in Explorer"
To convert meshes to babylon format - we'll use Blender
and the Blender plugin for Babylon - Babylonjs Blender Plugin
- make sure to check the box after importing to enable the plugin.
If the textures are not already baked, consider using Ian Dean's Mesh Baker plugin for Unity - costs about 30 bucks
In Blender you can delete objects by clicking on them and pressing the [del] key.
Clean the hierarchy down to only the mesh you want to export - the export tool exports a scene
of which the first mesh in the scene is loaded into babylonjs
Remove materials from mesh to export successfully
Import the mesh into scene builder to adjust the scale - sometimes things are very small (when in meters)
or very large when in mm or inches.
Import the material
First we need to convert the images to either png (if transparency is needed, or is small anyways) or jpg
for large images where we need lossy compression to save space.
is recommended but use your favorite editor. In the picture
below when you see a 4 color channel called alpha, it's probably best to export to png if it's the base texture - transparency
only applies to the base (or albedo texture) - otherwise jpg is almost always better - these texture files tend to be
very large and reducing their size is critical to fast download performance. If a file is small save it as a png so there
is no loss - but anything over 100kb will be greatly reduced (usually) in jpg vs png.
Material Import - texture raw images
Final Result in webGL
The diffuse texture is used for spectral also to brighten up the model - as the spectral texture is very very
large in these models and the emissive does "good enough" without the huge size.
The addon wizard can now be used to create the rows
To get things to work switch around the emissive, spectral, ambient and diffuse textures - at times you'll get
a result that is better after conversion - and try to eliminate large files that are for spectral or emissive only
and use the diffuse or the smaller of the s/e for both. Keeping the size small is very important in imported
assets, and they usually contain 5 or 6 texture files at time - which can all be used but keep each item
2-5mb max size - think of 10 objects at 2M or 5M = 20-50mb. That's a chunky download. 10mb is a strong target
for a quick experience, 30 mb for a longer experience. Above this and they need wifi and a bigger screen
to really see things.
Usually assets in one package are very similar, once you decide which images and textures to use, formats,
scaling and front direction - it's the same for all the assets in the package.
Internal: Map to meshes autofill
To get a list of items, split the mesh files (.babylon, .glb or .gltf) into one directory,
and the texture files into a different directory.
Then use cmd.exe (not powershell) and run dir -b > meshlist.txt
Upload meshes to /meshes (to use sb:) - also use a subdirectory per package, such as divebar
Upload textures to /textures (to use sb:) - ditto ~ subdirectory
Add meshes to suggestion list in spreadhseet and export the json list to copy into source control.
When importing assets try to find a decently quick and simple way to do each one, and
be prepared to repeat the process to fix small details like locating the object at 0,0,0
or removing a glass material that doesn't convert well, etc