stemkoski.github.com
stemkoski.github.com copied to clipboard
Subdivision Modifier appears to be not working (?)
FYI: Last week the subdivision modifier example worked fine. Now in both Mozilla and Chrome, the examples all look like porcupines - spikes pointing everywhere.
Humm, it seems that this is using Three.js r60, which no longer has face4: https://github.com/mrdoob/three.js/issues/3663
I had a similar issue, but it was obj related: https://github.com/mrdoob/three.js/issues/3835
Yikes -- I'm going to have to push this example back to Three.js v59 until SubdivisionModifer is fixed...
I'm new to Three.js, but your examples page is really helpful. I'm working on quite an extensive project, and building on several examples from your page.
For instance, I am working right now on the ability to add new object3D's to a scene that has an existing shape (let's say it's a smooth terrain-like shape), then the new object will 'snap' to the terrain, and as you drag the new object, it will stay on the terrain, as well as rotate to match the face it's currently sitting on.
That's one small part, but there is no example for anything like that out there.
What's fun, is most of the examples I've found online for copying matrices from one object to another don't work anymore because of upgrades to Three.js.
fun. On Sep 9, 2013, at 6:35 AM, stemkoski [email protected] wrote:
Yikes -- I'm going to have to push this example back to Three.js v59 until SubdivisionModifer is fixed...
— Reply to this email directly or view it on GitHub.
Hi Professor Stemkoski,
The Topology Data2 example appears broken as well because of this same issue. In the console window it says 'cannot read property 'face' of undefined'. Just wanted to give you a heads-up about that one also.
Thanks so much for the examples - they have really helped me grasp the fundamentals of Three.js! -Erich
I am using r60 and I have subdivision modifier working. Not sure exactly why yours isn't but I have it up and running, thanks for the example!
I'm using slightly different code, but not much compared with yours...
// CYLINDER
var faceMaterial = new THREE.MeshBasicMaterial( { color: 0xffffff, vertexColors: THREE.FaceColors } );
var cylinderGeometry = new THREE.CylinderGeometry(100, 100, 200, 12, 12, false);
///
///subdivision modifier
var smooth = cylinderGeometry ;
smooth.mergeVertices();
var modifier = new THREE.SubdivisionModifier(1);
modifier.modify(smooth);
///
///define different color for each face
for ( var i = 0; i < cylinderGeometry.faces.length; i++ ) {
face = cylinderGeometry.faces[ i ];
face.color.setRGB( 0, 0, 0.8 * Math.random() + 0.2 );
}
///
var cylinder = new THREE.Mesh( smooth, faceMaterial );
cylinder.overdraw = true;
cylinder.name='Cylinder';
cylinder.position.set(400,100,100);
scene.add(cylinder);
// ( object, size, hex, linewidth )
//scene.add( new THREE.FaceNormalsHelper( cylinder, 10 ) );
objects.push(cylinder);
This is still broken, just wanted to ping this again to find out if there's any known workarounds.