jit.gl.model: several groups drawn at the same time

piet's icon

Hi,
I'm playing with a huge amount of 3d models.
Each .obj file, loaded in my jit.gl.models, is containing also several groups of object.
I wondered if it was possible to ask the jit.gl.model to display several groups at the same time without creating them previously in a 3d editing software. (where creating all the possibilities between my groups would be impossible or really burdensome)
So how to send a message like [drawgroup 1, 2, 6, 12, 20, 25] for example
thanks again.

Joshua Kit Clayton's icon

Use jit.gl.model @automatic 0, and manually send the drawgroup message for each group on each render bang.

piet's icon
Max Patch
Copy patch and select New From Clipboard in Max.

thanks Joshua but i'm not shure to understand:
Here is an example patch where I'm trying to send drawgroup 1 and 2 on each bang. Under the automatic 0 argument, nothing appears at all

Joshua Kit Clayton's icon

Your patch is 99% correct. You just need to change your message boxes "drawgroup N" to "drawgroup N, bang". The drawgroup message sets which group to draw, and the bang (or draw) message does the drawing.

piet's icon

HI.
Thanks, I got it.
I drawn several instances of 3 d models with different drawgroups orders. I used the poly solution because it does not seem to be possible with jit.gl.multiple.
The problem is that the framerate considerably drops
I have 25 models with a choice of nearly 30 groups inside. I'm using a MBP 2,26ghz with 4giga of RAM.
the framerate is allways under 20 fps..
Do you have any idea about how to improve this rendering?
thanks.

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

here is my poly content ( sorry I know it's not well made)

piet's icon

Today, I notice that even with 10 poly's loaded, the framerate is at 13 fps...
does it come from the big amount of bangs created in my subpatch?

piet's icon

I really don't know how to improve that.
my cpu is free at 90 %.....
please help....

Joshua Kit Clayton's icon

Please provide a complete example as a zip file with an example model and your master patch. This poly sub-patch is not enough for us to comment further.

piet's icon

ok, here are the patches and the .obj example.
thanks for your help once again

1395.files.zip
zip
Joshua Kit Clayton's icon

The biggest cost is that when changing drawgroups, we rebuild the displaylist, rather than having a separate displaylist for each group. This isn't avoidable at the moment, even with other @mode settings. We can look at making this better in the future, but for now, I would recommend you use an instance of jit.gl.model for each drawgroup without changing it and draw each one separately.

piet's icon

thanks joshua.
Sorry, I did not realy inderstand the solution you proposed..
You advice me to put in my poly, as many jit.gl.model as drawgroups I had previously and send a drawgroup for each?
I also thought using texmap to display parts or not. will it be the same problem?
the thing thtat i would need in this case would be to blacken the rest of the object that is not textured.....
is it possible?

piet's icon

Hello Joshua.
I come back to this topic, wondering if the new max 6 beta version proposed a better way to manage drawgroups messages in multiple jit.gl.model objects.
Are jit.gl.multiple or poly objects more flexible in the current beta?
It would be great to manage arrays of 3d objects without creating one intance of jit.gl.model for each drawn 3d model.
Thanks

Rob Ramirez's icon

i'm not entirely sure what you are trying to do, but the new jit.gl.model object now supports instancing. meaning you can share mesh data from a single buffer, to draw several instances of an object with individual transforms.

your modeler and exporter must handle the instancing export, and the file-type must support it.
maya and collada are one example of modeler and file-type that supports this.

you can control individual instances by binding jit.anim.nodes to them.
there will be examples on how to do this in the Max 6 release version.

piet's icon

Sorry, If I was not clear:
When creating this topic a few month ago, I wanted to multiply 30 times the content of a single jit.gl model.
In the meantime, I wanted to control each instance of this model independantly.
Moreover , each instance of my .obj file had many groups I would have controled with drawgroup messages.
Doing this with jit.gl.multiple was impossible and managing several instances via a poly object decreased the frame rate. So I had to manually create as many jit.gl.model as I desired, and sent them different drawgroup message.
My patch was really big and not very efficient.
The solution you gave seems interesting, I'm looking forward to get some examples.
Where can I check the supported files? I'm using C4D at the moment.
thanks Robert.