Open jayfield1979 opened 12 years ago
A simpler example:
http://frontier.lincoln.ac.uk/3d/development/Stage2/vehicles/simpleCarScene/lod.html
var world = tQuery.createWorld().boilerplate().start();
var material = new THREE.MeshLambertMaterial( { color: 0xffffff, wireframe: true } );
var geometry = [
[ new THREE.SphereGeometry( 1, 64, 32 ), 5 ],
[ new THREE.SphereGeometry( 1, 32, 16 ), 10 ],
[ new THREE.SphereGeometry( 1, 16, 8 ), 15 ],
[ new THREE.SphereGeometry( 1, 8, 4 ), 20 ]
];
var i, j, mesh, lod;
for ( j = 0; j < 1; j ++ ) {
lod = new THREE.LOD();
for ( i = 0; i < geometry.length; i ++ ) {
mesh = new THREE.Mesh( geometry[ i ][ 0 ], material );
mesh.updateMatrix();
mesh.matrixAutoUpdate = false;
lod.addLevel( mesh, geometry[ i ][ 1 ] );
}
lod.updateMatrix();
lod.matrixAutoUpdate = false;
world.add( lod );
}
https://github.com/mrdoob/three.js/blob/master/src/objects/LOD.js
I think it would be simpler to hook. A function to the rendering loop
Worl.oop().hook(function(){ lod.update( camera ) });
Maybe a good idea to put that in a plugins
Hi @jeromeetienne
Is the tQuery render "loop" set up for LOD i.e. includes the following:
THREE.SceneUtils.traverseHierarchy( scene, function ( node ) { if ( node instanceof THREE.LOD ) node.update( camera ) } );
As you can see here:
http://frontier.lincoln.ac.uk/3d/development/Stage2/vehicles/simpleCarScene/
I have recreated the THREE LOD example documented here:
http://threejsdoc.appspot.com/doc/index.html#LOD
Example: (http://threejsdoc.appspot.com/doc/three.js/examples/webgl_lod.html)
And (after you've found it :)) all 4 instances of the sphere mesh are drawn on top of each other and are not reacting to LOD sorting.
Any ideas?
Obviously i'm using the tQuery car plug-in too :) and i'm working at quite a small scale but I have scaled down the LOD distances.