Hi,
I export my 3D models from Blender to three.js via glTF files
I didn’t find how to export billboard sprites (face always points to the camera)
Is it possible with glTF ?
If yes, how to do it in Blender ?
glTF has not concept of billboards. Hence, GLTFLoader
does not create objects of type THREE.Sprite
.
Oh, It’s a lack, we have to add it to glTF
I think it’s usefull and common to have billboards with 3D models, for example to put info text or for vegetation
Thank you for your answer
You able to create you own solution quite easily.
In your model that you export as gltlf/glb, you can add custom properties
to the model.
In my screen grab, I added an empty, which I named Annotation.Physics
. I could have named it anything
It has custom properties, see bottom right of screen grab, being description
and title
that I put into a div that I hide/show later on.
When I exported from blender, I included custom properties
,
When I load the model, I traverse it, and if one of the scene meshes matches what I am looking for, eg, things starting with the name Annotation
in my case, I add a sprite to the scene at the position of the empty
, create a css2dObject, add a div with all the text in it, etc, lots of things,
Many things happen in this demo, dynamically created sprites (billboards) is one.
You can see the JavaScript source by pressing the <> button on the working demo at the link Glasses - Three.js Tutorials (sbcode.net)
I know the custom properties trick but I was looking for a more standardized solution for models exchange.
Now I know I have no choice.
Thank you for your very helpful explanations and the example.