This is for those that wished they had a document for the many font ways with Three.js.
Maybe you know of another way please participate to this listing if you can think of another way.
My journey on fonts in Three.js to create 3D text at runtime without having to load a typeface.json. CSS3DRenderer looked promising though NOT allowed in generating a mesh ONLY the WebGLRenderer allows this to happen.
Do you know of another way to load a font into Three.js?
Wow! Some good options there, thanks for the write up.
I would say that, for your purpose of writing on old bottles, a displacement map would give the best and easiest result.
You could use a 2D canvas, write the text there and use that to generate a texture for the displacement map.
Quite a few of the official examples use this technique. I’m on mobile now, and the only one I can remember is Canvas Sprites although there are probably better ones.
If you do a text search through all the examples for places where CanvasTexture is used you’ll probably find better ones.
Basically it works like this:
const canvas = document.createElement( 'canvas' );
canvas.width = 1024;
canvas.height = 1024;
var context = canvas.getContext( '2d' );
// Draw stuff such as text on the canvas
// Use canvas as a texture
const texture = new THREE.CanvasTexture( canvas );
Which uses an image and i’m able to generate quickly, more interested in editing with text which sounds like the CanvasSprite/CanvasTexture can provide - YAY!!!
@prisoner849 at first I was so focused on how to Create 3D text at runtime when you had mentioned I played with the displacement slider in the example and saw the height change on the spikes, which then I understood displacement = height map.
Are there more displacement examples you could share?
Missed an important thought need the text to be 3D geometry to 3D print. Back to using TTF-JSON - bummer Thinking if I use a displacement map then I’d need to create a modifier for the 3D object(bottle) to change the topology?
Why not?
In the user interface you work with displacement map for better performance. Then, before you want to send it to a 3D-printer, use a modifier for your geometry.
The font can be edited easily. It is in a simple text file.
This allows you to design your own characters.
You can use other objects instead of the three.js-spheres. For example, hexagons of lines.
@prisoner849sweet, have never seen a modifier of this caliber in three.js before, at least not realizing what I was looking at was modifying topology. This is great news hearing this is possible for 3D printing.
Indexing my brain for the past 10 minutes, I have seen this concept before. Just need to remember where the example is, I have it somewhere
Always thought when hearing of any kind of map: normal, bump, displacement and other related maps = gift wrapping or pho 3D = giving the illusion of 3D
Thank you for pushing me in this direction to use the displacement map!