i'm working on voxel game three.js. this, need generate many chunk required fill screen. currently, i'm loading circle of radius 20 around player.
what simplest way compute exact range of chunks required fill camera frustrum , avoid computing invisible chunks ?
every chunk has exact same size (let's have vector size
correct value), , @ y=0 (x , z varying).
var frustum = new three.frustum(); frustum.setfrommatrix( new three.matrix4().multiply( camera.projectionmatrix, camera.matrixworldinverse ) ); (var i=0; i<objects.length; i++) { objects[i].visible = frustum.intersectsobject( objects[i] ); }
only objects within camera frustum rendered
documented here
hope helps you?
Comments
Post a Comment