jit.gl.model and group rendering order

May 3, 2010 at 5:02am

jit.gl.model and group rendering order


I want to read a model file with multiple groups, and apply different alpha textures to each of these groups. I don’t want to have multiple instances of this model, because my computer is already demanded. Is it possible to choose the rendering order of different groups within a single [jit.gl.model] instance?

Thanks in advance.

May 3, 2010 at 1:33pm

Hmm I’ve never heard of that before. Maybe splitting up the model is a decent alternative? Or matrixoutputting all the groups in the model into jit.gl.mesh objects once when loading the model? That gives you some flexibility…

May 3, 2010 at 6:43pm

can’t you achieve what you want with the texgroup message?

– Pasted Max Patch, click to expand. –
May 3, 2010 at 10:57pm

Thanks rob, but I’ve already been playing with texgroup.

It works well if you’re facing the model from a certain perspective, even better if you leave depth_enable on.

However, if you swing 180 degrees around the Y axis from that point, alpha stops working. I guess it’s because of group commanded by the .OBJ file.

The only workaround I’ve managed so far is rather crude way: Load 2 differently ordered .OBJ models depending on your “standing point”, with “alpha” and “depth” enabled.

Am I missing something, perhaps?

May 5, 2010 at 7:43pm

this is just the nature of opengl.
when you render objects with transparency, you must disable depth testing (@depth_enable 0).
however, this requires you to simulate depth by explicitly specifying draw order based on distance from the camera (@automatic 0).
the problem is, there is no way to do this with multiple drawgroups in a single gl.model.

perhaps something we can think about for future versions, but for now, you may have to abandon your drawgroups, and load multiple obj’s with single drawgroups.

you will still be required to do your own depth distance calculations and draw sorting.


You must be logged in to reply to this topic.