Geometry simpilifer

Hello,
Can someone explain what condition for geometry to apply Simpififer?
I often get the error: THREE.SimplifyModifier: No next vertex

I’m not sure what it means when this message is logged. Can you please provide a live example that reproduces the issue?

I’ve ran into the same issue.
Fixed it by reducing the count factor from:

var count = Math.floor( simplified.geometry.attributes.position.count * 0.875 );
// number of vertices to remove

to

var count = Math.floor( simplified.geometry.attributes.position.count * 0.1);
// number of vertices to remove

I do believe that issue to be a bug though.

@ranbuch can you share some more details on how to reproduce the bug, or a live code example?

Sure,

Just run the SimplifyModifier on this model:
//cdn.creators3d.com/models/tmp.glb
with

var count = Math.floor( simplified.geometry.attributes.position.count * 0.875 );

the model is disappearing and THREE.SimplifyModifier: No next vertex is being console.loged.

Also, the textures are turning black after using the modifier. I was expecting them to indent or something but not to change their color completely.

1 Like

@ranbuch Unfortunately, I’m not able to load your model with THREE.GLTFLoader. Besides, the glTF viewer of BabylonJS is not able to load your file, too. Please share a model that does work with the following two viewers.

https://gltf-viewer.donmccurdy.com/
https://sandbox.babylonjs.com/

You’re trying to run simplify modifier on a BufferGeometry but it should be first converted to Geometry. Current version of SimplifyModifier doesn’t support textures and it turns geometries black. I’m working on this and you can try using my version which supports UVs and normals, available here https://codesandbox.io/s/2o51o1q27p

Sorry about that, please try again. I’ve replaced the last model with the correct one. Just download again from the same link.

Looks good! I’ve given it a try:


I’m not sure the optimization level though, looks like it’s making a small effect.

It does work but at 60% the model still looks intact, which is good. Use wireframe mode to see that the most optimisation was applied to legs. Look in the console to see the gains in numbers.
You have to click optimizeModel after dragging the slider to see the change of optimisation level applied.

It looks like your mesh consists of 7 elements. I think you should do some merging to save on draw calls.

1 Like

Will your modifier be included in the three-js github repository?

I’ll make a PR soon. Next year though. Unfortunately I have to stop coding today and go to a party.

1 Like