See the test-multi.js for a full example.
Specify a multipage
option when updating your text geometry.
var geom = createText({ multipage: true, ... })
geom.update('foobar')
You also need to make sure your BMFont tool is exporting the pages
field correctly.
This module exports shaders/multipage
for convenience. Options:
textures
an array of textures parallel to thepages
specified in your BMFont file(s)opacity
the opacity, default 1.0color
the color to tint the text, default 0xffffffalphaTest
the alpha test value, defaults to 0.0001precision
the fragment shader precision, default'highp'
This will generate a new shader with N number of texture samplers. Some devices may not support 8 or more active textures.
Note: RawShaderMaterial
is required in order to support a wide range of ThreeJS versions.
var Shader = require('three-bmfont-text/shaders/multipage')
var material = new THREE.RawShaderMaterial(Shader({
textures: fontAtlasPages,
opacity: 0.25,
color: 0xff0000
}))