many objects


    Feb 23 2021 | 7:25 am
    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>

    • Feb 23 2021 | 10:34 am
      you can use poly~ to make multiple instances of jit.gl.model, i'm not sure how it reacts with 10000 instances though !
    • Feb 23 2021 | 2:38 pm
      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>
    • Feb 23 2021 | 3:36 pm
      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.
    • Feb 23 2021 | 4:04 pm
      I'm afraid poly~ is limited to 1024 voices.
    • Feb 23 2021 | 4:19 pm
      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 ?)
    • Feb 23 2021 | 6:36 pm
      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>
    • Feb 23 2021 | 6:41 pm
      BTW this thing of using poly~ is genius... G>
    • Feb 23 2021 | 10:16 pm
      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?
    • Feb 24 2021 | 1:36 am
      case close, used the physic engine. hey, but would be so nicer to have a simple and single way... G>