jit.gl.model and group rendering order

    May 03 2010 | 5:02 am
    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 03 2010 | 1:33 pm
      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 03 2010 | 6:43 pm
      can't you achieve what you want with the texgroup message?
    • May 03 2010 | 10:57 pm
      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 05 2010 | 7:43 pm
      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.