THREE.Geometry will be removed from core with r125

I wont be using it since r125.

But I will be curious of its usefulness in the raycaster after r125 is released. I will give it a try when it happens.

Out of curiosity, how will the SubdivisionModifier work after Geometry is removed? I’m using it right now, and it shows that it needs to convert to Geometry to work

@marquizzo

Looks like the solution has been to remove it from the examples. Maybe they’d consider readding it if a proper subdivision modifier class can be provided for BufferGeometry?

1 Like

I think it’s better when a new modifier is added to a separate repository. Related: Examples: Remove SubdivisionModifier. by Mugen87 · Pull Request #21072 · mrdoob/three.js · GitHub

3 Likes

Perhaps someone could finish the work described by Porting a minimalist OpenSubDiv to JavaScript? · Issue #247 · PixarAnimationStudios/OpenSubdiv · GitHub and get OpenSubdiv compiled to WASM. That’s a robust subdivision implementation, and would be valuable to have available in the web ecosystem.

2 Likes

It’s guaranteed not to be done by the time THREE.Geometry shuts down, but I already have a concept and a start. Everything is not final yet and can be changed at any time.

There the draft: * discourse.threejs.hofk.de
see BeginnerExample

Does the concept make sense? What should be changed? :thinking:


It should remain as manageable as possible. The 20 steps are no standard and easily adaptable.

What else should be included? I thought of

textures
light
modified standard geometry
dynamic geometry
raycaster
text / canvas text
calculation uv coordinates
lines
shapes
sprites
camera movement
instanced mesh
video texture
simple shader

Suggestions are welcome.

2 Likes

not sure if this is a bug or not

my BufferGeometry does not have a clone() function i generate the input BufferGeometry for the
SimplifyModifier with:

const geometry = new THREE.BufferGeometry()
geometry.setAttribute( ‘position’, new THREE.BufferAttribute( result, 3 ) );
geometry.setAttribute( ‘uv’, geo.getAttribute( “uv” ) );
geometry.setIndex( indices );
geometry.computeBoundingBox();
geometry.computeVertexNormals()

removing the geometry.clone() from the SimplifyModifier.js#L404 do the trick

But a clone() method does exists for BufferGeometry:

Can you please demonstrate the issue with a live example?

1 Like

copy looks like there error comes from three.js/BufferGeometry.js at bd095516a119979c9e3684e9f577028506240136 · mrdoob/three.js · GitHub

It’s possible that the BufferGeometry contains interleaved attributes, and some old code is present in that demo from prior to our adding support for cloning interleaved attributes? This should probably be debugged in a new thread I think.

4 Likes

you are right the BufferGeometry have interleaved attributes from glb Model with meshopt

update:
no the problem was undefined uv attribute, all works fine

I’m drawing lines and using TypeScript. Geometry was removed from the Three namespace so I can’t use the static methods on the class as you suggest in the migration section @Mugen87. Is this a bug in the type definitions or am I missing something?

Both methods were added to the d.ts file here:

Probably related to this, but can anyone point me in the right direction in how to achieve Geometry.mergeVertices() for the BufferGeometry?

I am doing it using BufferGeometryUtils.mergeVertices() but the result is very different.

I have

const hull = new ConvexGeometry(vertices) // this is a BufferGeometry

console.log(hull.attributes.position.count) // --> 558

// Geometry mergeVertices
const hullGeometry = new Geometry().fromBufferGeometry(hull)
hullGeometry.mergeVertices()
console.log(hullGeometry.vertices.length) // --> 95

// BufferGeometry mergeVertices
const hullBufferGeometry = BufferGeometryUtils.mergeVertices(hull)
console.log(hullBufferGeometry.attributes.position.count) // --> 556 but it should be 95

jsfiddle here

I am doing this for a physics engine, and the result that works is the one with 95 vertices.

1 Like

You have to delete the normal attribute. Geometry data can only be merged if all vertex data (position, normal, uv etc.) are equal.

https://jsfiddle.net/dvmx9rq3/

4 Likes

All good man, I got it all sorted (literally sorted, had to do materialIndex sorting in BufferGeometry groups to prevent an insane amount of excessive draw calls when using merged BufferGeometry and multiple materials) and am now THREE.Geometry free! Thank you =]

4 Likes

From what I have found CSG works with the geometry objects not the new buffer geometry. I see in the source that it explicitly converts it to THREE.Geometry. Will you have support in the future for subtracting / intersecting / union object?

The official repository does not maintain a CSG library. You have to ask the respective maintainers for buffer geometry support.

2 Likes

The following entry for r126 can be found in https://github.com/mrdoob/three.js/releases.



It is no longer required for intersection as it used to be for BufferGeometry.
But you can still use Face3 if you add examples/jsm/deprecated/Geometry.js.

Do I understand it correctly that now instead of Face3 these lines of code are used?

/build/three.js
lines
9321
9457
9535

1 Like

Is there any solution at the moment for the Subdivision Modifier? Now that Face3 is deprecated along with Geometry, existing example of the modifier does not work.