How to handle the error when converting 3D to Points using Three.Points

Hi there,

When I convert some 3D objects to Points using Three.Points, a few objects cannot be successfully converted and the error message said that Maximum call stack size exceeded.

Is there any way to fix the error? Is the only way to lower the poly numbers of an 3D object? Looks like that Three.Points has its own limitation for 3D objects.

Thanks.

I don’t think so. It rather sounds like your code enters a recursion one way or the other. Please provide a working piece of code, like in a JSFiddle or CodePen.

Hi Vielzutun.ch

Thanks for your reply. I used the following code for conversion using Three.Points.

https://jsfiddle.net/89p3avkx/2/

The code above only works for a few 3D objects with lower numbers of Poly. For example, the attached 3D objects cannot be converted and will show error messages, like RangeError: Maximum call stack size exceeded.

If possible, please provide any solution to that. Thanks.

whale.obj (7.47 MB)

basicman.obj (1.39 MB)

Excellent!

When I click “Run” in your JSFiddle, I get this:

Please fix this, before we can proceed.

Seems

    const p = new THREE.Points(p_geom, p_material);
    p.scale.set(5, 5, 5);
    scene.add(p)

has to be

    particles = new THREE.Points(p_geom, p_material);
    particles.scale.set(5, 5, 5);
    scene.add(particles)

Sir, Thanks for your reply.

I deleted TweenMax animation. Now there should be no error message about particle.rotation.

Please try checking it out again.

Thanks.

Hi Sir,

Thanks for your input.

I removed the keyword, const, but the code still cannot convert some 3D objects with higher resolution into particles, using Three.Points.

Hi Sir,

The key part should be the following code. You may try using the code with other 3D obj files with higher file sizes (attached to the last email) and see if it works.

Hi Sir,

Please kindly refer to the updated link. Thanks.

https://jsfiddle.net/mv8uk36L/2/

Hi Sir,

I just updated the code as follows.

https://jsfiddle.net/mv8uk36L/2/

Hi Sir,

Can I ask if it’s true that OBJLoader.load and Three.Points cannot be used to convert 3D objects with high poly numbers to points?

https://jsfiddle.net/mv8uk36L/2/

Thanks.