Breaking Changes between r132 vs r133?

So… I’m deploying r133 when I get errors in BufferGeometry and Three.Font. In r132 I was just using TTFLoader, calling a .ttf file and then setting it as:

import { TTFLoader } from 'three/examples/jsm/loaders/TTFLoader.js';
const fLoader = new TTFLoader( manager);

var font1 = '';
var textMeshArray = [];
var textInstances = [];
var text = "some text";

    fLoader.load( '/node_modules/fonts/ttf/arial.ttf', function ( json ) { font1 = json  });


var textGeo = new THREE.TextBufferGeometry( text, {
font: font1,
size: size,
height: height,
curveSegments: curveSeg,
bevelEnabled: false

var textsBufferInstance = new THREE.InstancedBufferGeometry( textGeo );
textsBufferInstance.setAttribute( 'position', textGeo.getAttribute( 'position' ));
textsBufferInstance.setAttribute( 'normal',   textGeo.getAttribute( 'normal' ));   
textInstances.push( textsBufferInstance );

... more texts...

var mergedText = mergeBufferGeometries( textInstances );
var setI = setInstance( mergedText, i );

undefined === textMeshArray [ i ] ? ( textMeshArray.push( setInstance( mergedText, i )),
     m2.userData.instanceMatrices.value.push( new THREE.Matrix4() )) : null;

} // end loop

Then I merge all the text “groups” with:

var textMeshes = mergeBufferGeometries( textMeshArray );

This is now a batchedMesh of a bunch of text that gets converted into an InstancedMesh cache later where I can swap the text based on user input. The segments are kept low, the bevel is turned off, the height is used for extrude depth. This is a very performance solution for text. The vertices are controllable. In no way do I want to use extrudeGeometry which instantly kills performance when a bunch of text is present. I like this solution for the text, personally.

This was working in r132. In r133 this changed somehow. I played with it for a while, nothing worked. So I went back to r132, installing as "npm install three@0.132.2".

Getting exact same errors. However, if I dont install r132 from scratch and use the ZIP I previously downloaded this works fine. I’m getting errors not only on the TTFLoader and Font, but I’m also getting errors from BufferGeometryUtils complaining about:

if ( attribute.isInterleavedBufferAttribute ) {

console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported.' );
return null;

What’s the give? If I dont like the new implementation I can’t go back to the previous? The diffs between the versions Cores look the same to me. I mean, I’ll be glad to fix it if someone can point the error but this is a breaking change as far as I can tell that persists to the previous version now too? Am I wrong? What’s the correct method? I looked inside the new files and in Font. I tried going back to FontLoader too but regardless I couldn’t get this to work. YES, I saw the change notes and applied them. I saw how the new GeometryUtils is supposed to be applied. Though I didn’t put all that in my example I did test it. I couldn’t get it to work. Help?

r133 looks like it takes care of creating the Text as BufferGeometry so I would love to be able to use it and skip the extra step I’m performing here with new THREE.TextBufferGeometry() but I can’t get it to work right. I’m also concerned that using extrudeGeometry is going to increase the vertice count on the text but I haven’t seen it work yet so I’m not sure.

As mentioned in the migration guide, TextGeometry, Font and FontLoader are not in the core anymore. You have to import them from the examples directory. The paths are listed in the below guide.

Thanks Mugen, I do resolve those files. It sounds like you are abstracting that it “should” work. If that’s the case let me retry some more things. In my deployment I put the dependencies for my “.ttf” files, images, and “svg” icons, into a static folder at the root level of “node_modules” folder. I notice that when the geometry tries to build them that its showing a cross-origin of “anonymous”. Could this be the issue?

Got it. Thank you. Silence is the slap we all need. I appreciate the fact the you dont try to answer the insanity @Mugen87. It is easy to be introspective about an issue and create even more confusion in the process. It is harder to simply trust your own logic and force the other person back into reason. Working perfectly. TTFLoader is still the way to go for me.

MergeBufferGeometry was complaining because the TextGeometry was failing. Though I could argue that the error handling is vague I would also have to admit that the error handling isnt intended to handle my usecase but simply to handle what the module needs to complete its function. Thanks again!

1 Like