many objects

geotrupede's icon

Hi,
small project,
Helping a colleague, she would like to be able to click on 3d objects in openGL, get names and then play a sound based on which name clicked. So the sound will be a midi note from a long coll, index will correspond to the object name. To import that I have a javascript box which reads a csv file.
The same can be used for other data import.

But here is it the problem.
First challenge: jit.gl.picker uses bounding box, is it possible to select based on the actual shape?

Second challenge: we have 10,000 objects, all different, how can I import them without using 10,000 jit.gl.model ?
I was thinking of loading with a string format but once I load the next there is just one on the scene.

And, usual problem, how do I locate them in the correct place, they always go to the origin... Do I need to import another dataset with the coordinate of the origin, save in coll and apply a shift for each object after import?

I have started a little patch, but of course the above needs resolving, any suggestions?
I am not looking cor copy paste, but for some fundamental guidance, just to di this in the most efficient way.
Thank you in advance
G>

Max Patch
Copy patch and select New From Clipboard in Max.


vichug's icon

you can use poly~ to make multiple instances of jit.gl.model, i'm not sure how it reacts with 10000 instances though !

geotrupede's icon

Thank you! I would try with the mograph approach, but my challenge here is that each object uses a different mesh, so not instancing. Each object as one, in the right place and with a colour defined by a the coll data
any idea how to approach this?
maybe obj groups instead of single meshes?
G>

vichug's icon

yes, that's precisely my point : poly~ will create as many instances of jit.model as you want, and for each one you can load a different gl model, set different placement and color etc.

pdelges's icon

I'm afraid poly~ is limited to 1024 voices.

vichug's icon

oh. (that said, wouldn't it be better to not load more than 1024 gl models at a time, for example calculating those that are too far away to be rendered, and reusing instances to load those at a later time, when the user gets closer ?)

geotrupede's icon

super! I think I can optimise and keep number low, so poly~ is
THANK YOU!
incidentally, to get a mouse ckick on an object, without the limitation of bounding box, what should be used?
G>

geotrupede's icon

BTW this thing of using poly~ is genius...
G>

geotrupede's icon

Hi there, so here is a working patch that does almost all I need.
I will ask other questions in the main forum but basically, how to correct the jit.gl.picker to follow actual irregular shapes instead of bounding boxes?

test.zip
zip 21.55 KB
start with Main_patch.maxpat

geotrupede's icon

case close, used the physic engine.
hey, but would be so nicer to have a simple and single way...
G>