Obj files in displaylist?


    Jul 01 2007 | 5:39 pm
    Dear all, I'm looking for a solution to load in a displaylist a series of hundreds obj files.
    I have to make an animation, and I already build all the obj files. I would like to show an obj each 40-50 milliseconds, as shown in the (wrong) patch below.
    Thank you very much

    • Jul 01 2007 | 5:51 pm
      well, you can load them all in to 100 obj files in a java script script and then cycle the 'enable' parameter for display.
      On Jul 1, 2007, at 1:39 PM, Bruno Zamborlin wrote:
      > > Dear all, > I'm looking for a solution to load in a displaylist a series of > hundreds obj files. > > I have to make an animation, and I already build all the obj files. > I would like to show an obj each 40-50 milliseconds, as shown in > the (wrong) patch below. > > Thank you very much > > > #P window setfont "Sans Serif" 9.; > #P window linecount 1; > #P message 237 169 120 196617 read mymodels-33.obj; > #P newex 237 147 62 196617 prepend set; > #P number 126 101 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 126 54 52 196617 metro 40; > #N counter 2 1 50; > #X flags 0 0; > #P newobj 126 78 77 196617 counter 2 1 50; > #P newex 126 123 148 196617 sprintf read mymodels-%s.obj; > #P newex 12 119 105 196617 jit.qball @mode usurp; > #P toggle 12 27 15 0; > #P newex 12 96 55 196617 metro 20; > #P newex 12 143 55 196617 t b b erase; > #P newex 126 147 78 196617 jit.gl.model mdl; > #B color 5; > #P newex 12 181 80 196617 jit.gl.render mdl; > #P newex 13 208 311 196617 jit.window mdl @depthbuffer 1 @rect 614 > 76 934 316 @floating 1; > #P connect 7 0 2 0; > #P fasten 7 0 11 0 131 142 242 142; > #P connect 5 0 4 0; > #P fasten 5 0 9 0 17 47 131 47; > #P connect 10 0 7 0; > #P connect 11 0 12 0; > #P connect 8 0 10 0; > #P connect 9 0 8 0; > #P fasten 2 0 1 0 131 172 17 172; > #P connect 6 0 3 0; > #P connect 4 0 6 0; > #P fasten 3 2 1 0 61 165 17 165; > #P fasten 3 0 1 0 17 163 17 163; > #P window clipboard copycount 13; > > -- > Bruno > > www.brunozamborlin.com > www.myspace.com/brunozamborlin
      v a d e //
      www.vade.info abstrakt.vade.info
    • Jul 01 2007 | 8:22 pm
      thank you vade. i'm using lua for this project, so i'll do the cycle there.
      the only issue i'm thinking about is that i will have 50 elements in the scene, and every element could be shown as one of four animations. each animation will be based by 50 obj files, and so at the start-up i will load something like 50*4*50 = 10000 obj. Each obj is 600kb, so it will be load something like 6 gb !!!
      uhm...
    • Jul 01 2007 | 10:43 pm
      You should look at the patches ive posted on using jit.xfade to morph between 'keyframes' of objects. I bet you can cut down on your filecount by an order of magnitude, assuming your objs meet certain criteria.
      On Jul 1, 2007, at 4:22 PM, Bruno Zamborlin wrote:
      > > thank you vade. > i'm using lua for this project, so i'll do the cycle there. > > the only issue i'm thinking about is that i will have 50 elements > in the scene, and every element could be shown as one of four > animations. > each animation will be based by 50 obj files, and so at the start- > up i will load something like 50*4*50 = 10000 obj. > Each obj is 600kb, so it will be load something like 6 gb !!! > > uhm... > -- > Bruno > > www.brunozamborlin.com > www.myspace.com/brunozamborlin
      v a d e //
      www.vade.info abstrakt.vade.info
    • Jul 01 2007 | 11:36 pm
      Perfect! Using jit.xfade the interpolation works perfectly just loading 5 obj instead of 50..... that means 600mb of memory instead of 6gb!!
      i copy here the patch for completeness, thank you vade
    • Jul 02 2007 | 12:14 am
      excellent. Im glad that worked out.
      Id check your models, as the limitation with this method is that each keyframe in your animation must not only have the same vertex count but the same vertex ordering. Its easy to mess that up, and makes modelling a bit of a pain in the ass.
      :)
      v a d e //
      www.vade.info abstrakt.vade.info
    • Jul 02 2007 | 11:40 am
      i used the same number of vertex, and everything seems work good. i uploaded for you two objs i'm using, you can download them here: http://www.brunozamborlin.com/temp/MTAnt.zip let me know if you think it's ok too... i'm using the "triangles" interpolation mode.
      by the way, i'm thinking now that the number of obj files i have to load is still too big. i have a matrix of 30x30 cells (i'd prefer 50x50...) and in every cell could be one of 3 different breeds of insects. each insect could be in one of these states: borning, dying, motionless or moving. each state is based by at least 3 keyframes. so, it will be something like 30x30x3x4x3=32400 obj of 600kb, so 19 gygabyte of memory used!!!
      is it possible to duplicate a 3d model? i mean, displaying it in two of more different positions... in this way, i could delete that "30x30" in the expression...
    • Jul 02 2007 | 12:42 pm
      The way to display the same geometry in several different positions is with vertex skinning (also known as matrix palette blending) (http://lynxengine.net/ati.htm). It requires some extra data such as vertex blending weights and the transformations of the geometry to be applied with each weight. The upside though is that you have really nice interpolation which is realistic as opposed to a simple crossfade which may move through undesirable states between keyframes. It's a bit tricky to do in jitter but it can be done using the mesh object and a vertex shader. I posted a half-working example a while ago called playdough mesh. It has some rough edges but is a good start.
      wes
      On 7/2/07, Bruno Zamborlin wrote: > > i used the same number of vertex, and everything seems work good. i uploaded for you two objs i'm using, you can download them here: http://www.brunozamborlin.com/temp/MTAnt.zip > let me know if you think it's ok too... > i'm using the "triangles" interpolation mode. > > > by the way, i'm thinking now that the number of obj files i have to load is still too big. > i have a matrix of 30x30 cells (i'd prefer 50x50...) and in every cell could be one of 3 different breeds of insects. each insect could be in one of these states: borning, dying, motionless or moving. > each state is based by at least 3 keyframes. > so, it will be something like 30x30x3x4x3=32400 obj of 600kb, so 19 gygabyte of memory used!!! > > is it possible to duplicate a 3d model? > i mean, displaying it in two of more different positions... in this way, i could delete that "30x30" in the expression... > -- > Bruno > > www.brunozamborlin.com > www.myspace.com/brunozamborlin >
    • Jul 02 2007 | 2:07 pm
      Ive been looking at skinning techniques and found some great example code as well to use. I must have missed your skinning post, so im very happy to wake up to this. Cant wait to check it out.
      btw, I got some really nice looking parallax shading going on now with height and normal maps. This shader shit is the bomb :)
      Thanks Wes. This is a huge help.
      On Jul 2, 2007, at 8:42 AM, Wesley Smith wrote:
      > The way to display the same geometry in several different positions is > with vertex skinning (also known as matrix palette blending) > (http://lynxengine.net/ati.htm). It requires some extra data such as > vertex blending weights and the transformations of the geometry to be > applied with each weight. The upside though is that you have really > nice interpolation which is realistic as opposed to a simple crossfade > which may move through undesirable states between keyframes. It's a > bit tricky to do in jitter but it can be done using the mesh object > and a vertex shader. I posted a half-working example a while ago > called playdough mesh. It has some rough edges but is a good start. > > wes____________________________________________
      v a d e //
      www.vade.info abstrakt.vade.info
    • Jul 02 2007 | 2:34 pm
      What do you mean by parallax shading?
      wes
      On 7/2/07, vade wrote: > Ive been looking at skinning techniques and found some great example code > as well to use. I must have missed your skinning post, so im very happy to > wake up to this. Cant wait to check it out. > > btw, I got some really nice looking parallax shading going on now with > height and normal maps. This shader shit is the bomb :) > > Thanks Wes. This is a huge help. > > > On Jul 2, 2007, at 8:42 AM, Wesley Smith wrote: > > > > The way to display the same geometry in several different positions is > with vertex skinning (also known as matrix palette blending) > (http://lynxengine.net/ati.htm). It requires some extra data such as > vertex blending weights and the transformations of the geometry to be > applied with each weight. The upside though is that you have really > nice interpolation which is realistic as opposed to a simple crossfade > which may move through undesirable states between keyframes. It's a > bit tricky to do in jitter but it can be done using the mesh object > and a vertex shader. I posted a half-working example a while ago > called playdough mesh. It has some rough edges but is a good start. > > wes____________________________________________ > > v a d e // > > www.vade.info > abstrakt.vade.info > > > > > >
    • Jul 02 2007 | 2:35 pm
      nevermind, I know what you mean now. wes
      On 7/2/07, Wesley Smith wrote: > What do you mean by parallax shading? > > wes > > On 7/2/07, vade wrote: > > Ive been looking at skinning techniques and found some great example code > > as well to use. I must have missed your skinning post, so im very happy to > > wake up to this. Cant wait to check it out. > > > > btw, I got some really nice looking parallax shading going on now with > > height and normal maps. This shader shit is the bomb :) > > > > Thanks Wes. This is a huge help. > > > > > > On Jul 2, 2007, at 8:42 AM, Wesley Smith wrote: > > > > > > > > The way to display the same geometry in several different positions is > > with vertex skinning (also known as matrix palette blending) > > (http://lynxengine.net/ati.htm). It requires some extra data such as > > vertex blending weights and the transformations of the geometry to be > > applied with each weight. The upside though is that you have really > > nice interpolation which is realistic as opposed to a simple crossfade > > which may move through undesirable states between keyframes. It's a > > bit tricky to do in jitter but it can be done using the mesh object > > and a vertex shader. I posted a half-working example a while ago > > called playdough mesh. It has some rough edges but is a good start. > > > > wes____________________________________________ > > > > v a d e // > > > > www.vade.info > > abstrakt.vade.info > > > > > > > > > > > > >
    • Jul 02 2007 | 2:39 pm
      BTW, You can use these techniques with video by taking the convolution of the video image to generate height and normal maps based on luminance (or an other metric). This can be done with slabs of course. Basically, you to edge detection in the x and y directions for ther x and y normal vectors and the luminance is z. Then take the luminance as the height as well.
      wes
    • Jul 02 2007 | 2:42 pm
      has parallax mapping code. Not sure if this is a commonly used term. My shader does do occlusion just yet, but it looks better than the normal map shader.
      On Jul 2, 2007, at 10:34 AM, Wesley Smith wrote:
      > What do you mean by parallax shading? > > wes > > On 7/2/07, vade wrote: >> Ive been looking at skinning techniques and found some great >> example code >> as well to use. I must have missed your skinning post, so im very >> happy to >> wake up to this. Cant wait to check it out. >> >> btw, I got some really nice looking parallax shading going on now >> with >> height and normal maps. This shader shit is the bomb :) >> >> Thanks Wes. This is a huge help. >> >> >> On Jul 2, 2007, at 8:42 AM, Wesley Smith wrote: >> >> >> >> The way to display the same geometry in several different >> positions is >> with vertex skinning (also known as matrix palette blending) >> (http://lynxengine.net/ati.htm). It requires some extra data such as >> vertex blending weights and the transformations of the geometry to be >> applied with each weight. The upside though is that you have really >> nice interpolation which is realistic as opposed to a simple >> crossfade >> which may move through undesirable states between keyframes. It's a >> bit tricky to do in jitter but it can be done using the mesh object >> and a vertex shader. I posted a half-working example a while ago >> called playdough mesh. It has some rough edges but is a good start. >> >> wes____________________________________________ >> >> v a d e // >> >> www.vade.info >> abstrakt.vade.info >> >> >> >> >> >>
      v a d e //
      www.vade.info abstrakt.vade.info
    • Jul 02 2007 | 4:01 pm
      Yup :)
      Realtime normal map generation is definitely on my list of to do's.
      On Jul 2, 2007, at 10:39 AM, Wesley Smith wrote:
      > BTW, > You can use these techniques with video by taking the convolution of > the video image to generate height and normal maps based on luminance > (or an other metric). This can be done with slabs of course. > Basically, you to edge detection in the x and y directions for ther x > and y normal vectors and the luminance is z. Then take the luminance > as the height as well. > > wes
      v a d e //
      www.vade.info abstrakt.vade.info
    • Jul 02 2007 | 4:19 pm
      Hi Wes, thank you very much for your tips! I tried your PlaydoughMesh patch (for other readers, the link is: http://www.mat.ucsb.edu/~whsmith/PlaydoughMesh.zip )
      It works properly, and I can control each object separately. However, the problem you explained about importing in Jitter bone indices, bone modelview matrices and weights seems to be no easy to solve soon, and I have to complete my works in a couple of weeks (sorry!! :)
      So, I was thinking about something else: if I have to represent 100 identical 3Dmodels, if I load only one obj file and then, in the cycle, I update one model at time reading informations from the same array? I mean, is it possible to draw "manually" a 3Dmodel, instead of linking it to a jit.gl.model ? Something like "gl.Begin - gl.Vertex - gl.End" ?
      Quote: wesley.hoke@gmail.com wrote on Mon, 02 July 2007 14:42 ---------------------------------------------------- > The way to display the same geometry in several different positions is > with vertex skinning (also known as matrix palette blending) > (http://lynxengine.net/ati.htm). It requires some extra data such as > vertex blending weights and the transformations of the geometry to be > applied with each weight. The upside though is that you have really > nice interpolation which is realistic as opposed to a simple crossfade > which may move through undesirable states between keyframes. It's a > bit tricky to do in jitter but it can be done using the mesh object > and a vertex shader. I posted a half-working example a while ago > called playdough mesh. It has some rough edges but is a good start. > > wes
    • Jul 02 2007 | 6:13 pm
      If I remember correctly, I believe I had posted an example of doing something like this in a shader somewhere in the forums in a thread about bump maps. I've attached the source patch and shader again here for convenience (and since shader code always gets mucked up in the forums).
      In the patch, the noise generation calculations can be replaced by jit.qt.movie or other matrix source.
      enjoy, Andrew B.
    • Jul 02 2007 | 6:51 pm
      I can't find the "ab.bmap.jxs" file, or the code I have to copy and paste. May somebody link it or send it to me?
      Thanks
    • Jul 02 2007 | 8:01 pm
      Sorry, I didn't realize my attachment wouldn't get posted to the forum. Here it is for all of you forum readers...
      AB
    • Jul 02 2007 | 8:29 pm
      Thank you Andrew. However, maybe I missed some step... how can I use this patch to achieve my goal?
      What I would like to to is to display more 3D identical objects loading only one OBJ file...
    • Jul 02 2007 | 10:04 pm
      Hi Bruno, I have no idea. I was responding to Vade's desire to do normal-mapping using a texture. This example doesn't address your interest in multiple objects with one OBJ file.
      AB
      Bruno Zamborlin wrote: > Thank you Andrew. > However, maybe I missed some step... how can I use this patch to achieve my goal?
    • Jul 02 2007 | 10:31 pm
    • Jul 02 2007 | 10:38 pm
      Oh - Andrew, I got that working a while ago, heres some new stuff:
      On Jul 2, 2007, at 6:04 PM, andrew benson wrote:
      > Hi Bruno, > I have no idea. I was responding to Vade's desire to do normal- > mapping > using a texture. This example doesn't address your interest in > multiple > objects with one OBJ file. > > AB > > Bruno Zamborlin wrote: >> Thank you Andrew. >> However, maybe I missed some step... how can I use this patch to >> achieve my goal?
      v a d e //
      www.vade.info abstrakt.vade.info
    • Jul 03 2007 | 8:37 am
      Oh ok Andrew, I didn't understand :)
      Anyway, is it possible for you to load a gl.Model file into a display list and then draw more instances simultaneusly?
      Because I'm reading something like that on this tutorial: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=12
      They use GL_QUADS and GL_POLYGONS instead of load an obj file, but the concept is identical... Well, I try