Jit.boids3D


    Apr 04 2008 | 12:52 pm
    Hi,
    Am trying to get open gl models into Wesley Smiths jit boids 3d patch, so as the models are the boids elements in effect..... cant figure out how to get jit.gl.model to fit within the patch...anyone any ideas?
    I know you can use jit.gl.mesh, and jit.gridshape, but really need to get my own models in...presume it must be possible,
    Any help would be much appreciated....

    • Apr 04 2008 | 8:46 pm
      a couple of ways i've done something similar. one way involves sending the output of boids to a jit.scanwrap and sending that to the position input of a jit.gl.multiple, which is bound to whatever object you want as your boid. something like this:
      another method involves iterating the boids matrix each time step, and wrapping your gl object in a poly~. something like this:
      keep in mind, jit.gl.model does not do well for multiple instances of complex models. your better off using wes's lua gl model, or jit-ogre.
      -rob
    • Apr 04 2008 | 8:49 pm
      err, that second code snippet might seem a bit weird, because it was taken from a more complex patch, but hopefully you get the idea.
      AND, i should mention, the gl.multiple method will give you the best performance.
    • Dec 27 2008 | 7:31 pm
      I've been trying to do this as well, but with videos instead of gl models, similar to Andrew Benson's recipe Dancing Sprites.
      I've tried both of these methods, but neither compares to jit.boids3d help file, which uses xray.jit.boidsrender to jit.gl.mesh. However, if I use the video as a texture to jit.gl.mesh, I can't get the videos to always appear flat and rectangular in the window and just change size as they move in space, rather than distorting in 3d. Is there anyway to get around this? Please let me know if I'm not being clear.
      Thanks, Zach
    • Dec 27 2008 | 8:38 pm
      Here's an example patch doing screen-aligned billboarding using some jit.expr and shader voodoo. The cray.jit.boidsrender object was made when I was just learning 3D rotation transformations and uses some semi-hack techniques. This example does the billboarding in the shader and requires very specific matrices in the vertex and texcoord inputs. See if you can figure it out!
      And the shader:
      screen-aligned billboarding
    • Dec 27 2008 | 9:25 pm
      Thanks, Wesley, but indeed I cannot figure it out!
      First of all, I'm getting an error that jit.noise doesn't understand the int input from the counter.
      I do understand that the jit.op fancywork handles what was encapsulated in xray.jit.boidsrender, while the shader handles the billboarding I asked for. However, where does the input from jit.boids3d go? When I run your patch I don't get anything in my jit.window. Please explain?
    • Dec 27 2008 | 9:55 pm
      it would appear that the @carry flag output setting reverted to numeric, instead of bang, when you copy-compressed the patch.
      On Dec 27, 2008, at 3:38 PM, Wesley Smith wrote:
      > Here's an example patch doing screen-aligned billboarding using some > jit.expr and shader voodoo. The cray.jit.boidsrender object was made > when I was just learning 3D rotation transformations and uses some > semi-hack techniques. This example does the billboarding in the > shader and requires very specific matrices in the vertex and texcoord > inputs. See if you can figure it out! > > > > > > > > And the shader: > > > > > > > > screen-aligned billboarding > > > > > > > > > > > > > >
    • Dec 27 2008 | 10:00 pm
      > First of all, I'm getting an error that jit.noise doesn't understand the int input from the counter. > hmm. I thought counter was supposed to save it's state w/r/t the overflow flag. Just stick a [t b] there.
      > I do understand that the jit.op fancywork handles what was encapsulated in xray.jit.boidsrender, while the shader handles the billboarding I asked for. However, where does the input from jit.boids3d go? When I run your patch I don't get anything in my jit.window. Please explain?
      This is probably due to the error. Try this one:
    • Dec 27 2008 | 10:21 pm
      Not sure what you're talking about with counter, but it fixed the error.
      However, I'm still not getting anything on the screen. Maybe it has do with the way I implemented the shader?
    • Dec 27 2008 | 10:30 pm
      hmm ... it works when the patch loads up for me after fixing the counter thing. There are 2 matrices, the [2 float32 160 1] is both your texcoords and offsets in the shader. This is what the quads are built with. The other one with the noise and ops are just random 3d coordinates where you can plug your boids positions in to. The important point is to expand this matrix x4 such that each point is "quadruplicated". With these 2 matrices, the shader know the location of the quad and for each of the quadruplicated points, how much to offset it by.
      wes
    • Dec 27 2008 | 11:00 pm
      Well, I at least have the mesh working when I replace the noise with boids. However, I still can't get the shader to work as I have limited experience with glsl. Can you possibly post the shader file you used?
    • Dec 27 2008 | 11:21 pm
      On Sat, Dec 27, 2008 at 5:00 PM, Zach Gold wrote: > > Well, I at least have the mesh working when I replace the noise with boids. However, I still can't get the shader to work as I have limited experience with glsl. Can you possibly post the shader file you used? >
    • Dec 28 2008 | 12:17 am
      I see that Zachary Seldess has a complicated patching solution to the billboarding problem:
      Unfortunately, I can't get that to work either. It seems the shader would be much more elegant anyway.
    • Dec 29 2008 | 4:51 pm
      wes attached his shader to via email, so it didn't make it to the forum. you can access it through the archives here: https://cycling74.com/pipermail/jitter/attachments/20081227/fa6f5250/vd.billboard.obj
    • Dec 29 2008 | 11:35 pm
      Thanks, Rob. Unfortunately the shader is not working for me. It does scale the videos in response to my parameter, but does not billboard them. I'm not getting any errors in the Max window either. Any ideas?
    • Dec 31 2008 | 11:00 pm
      So much more elegant when done this way. Thanks Wes. You just instigated a new year's resolution.
      Zachary