three.js - Grab objects near camera -
i looking @ http://threejs.org/examples/webgl_nearestneighbour.html
, had few questions come up. see use kdtree stick particles positions , have function determine nearest particle , color it. let's have canvas around 100 buffered geometries around 72000 vertices / geometry. way know positions of buffered geometries , put them kdtree determine nearest vertice , go there. sounds expensive.
what other way there return objects near camera. how three.lod it? http://threejs.org/examples/#webgl_lod has ability see how far object , render different levels depending on setting inputted.
define "expensive". point of kdtree find nearest neighbour elements quickly, primary focus not on saving memory (although inplace on typed array, it's quit cheap in terms of memory already). if need save memory maybe have find way. yet typed array length 21'600'000 indeed bit long. highly doubt have have every single vertex in there. why not have position reference point every geometry part? and, if need vertices associated point, dictionary. can call mygeometryvertices[ geometryreferencepoint ].
three.lod works raycasts. if have (few) hundred objects might work well. if have hundred thousands or millions of positions you'll troubles. if you're not using meshes; can't raytrace e.g. particle.
really build own logic them. none of 2 provide prebuilt perfect-for-all-cases solution.
Comments
Post a Comment