Forums > Jitter

Obj files in displaylist?

July 1, 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

#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;


July 1, 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
>
> http://www.brunozamborlin.com
> http://www.myspace.com/brunozamborlin

v a d e //

http://www.vade.info
abstrakt.vade.info


July 1, 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…


July 1, 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
>
> http://www.brunozamborlin.com
> http://www.myspace.com/brunozamborlin

v a d e //

http://www.vade.info
abstrakt.vade.info


July 1, 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

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 522 44 50 196617 reset;
#P newex 522 64 167 196617 jit.gl.handle morph @auto_rotate 1;
#P button 349 278 15 0;
#P newex 369 301 105 196617 jit.qball @mode usurp;
#P number 414 252 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 369 251 15 0;
#P newex 369 278 55 196617 metro 20;
#P newex 369 325 55 196617 t b b erase;
#P newex 35 396 323 196617 jit.window morph @depthbuffer 1 @rect 614 76 934 316 @floating 1;
#P newex 34 373 96 196617 jit.gl.render morph;
#P message 201 131 26 196617 read;
#P newex 201 169 433 196617 jit.gl.model morph @depth_enable 1 @smooth_shading 1 @lighting_enable 1 matrixoutput $1;
#B color 5;
#P window setfont "Proportional Serif" 10.;
#P comment 259 120 107 131727370 end;
#P window setfont "Fixedwidth Serif" 10.;
#P message 239 140 94 1441802 matrixoutput 1;
#P window setfont "Sans Serif" 9.;
#P message 34 54 26 196617 read;
#P newex 34 93 433 196617 jit.gl.model morph @depth_enable 1 @smooth_shading 1 @lighting_enable 1 matrixoutput $1;
#B color 5;
#P newex 262 315 60 196617 prepend set;
#P window setfont "Proportional Serif" 10.;
#P comment 231 275 95 131727370 Drawing Primitive;
#P window setfont "Sans Serif" 9.;
#P user ubumenu 233 292 68 196617 0 1 1 0;
#X add points;
#X add lines;
#X add line_strip;
#X add line_loop;
#X add triangles;
#X add tri_strip;
#X add tri_fan;
#X add quads;
#X add quad_strip;
#X add polygon;
#X add tri_grid;
#X add quad_grid;
#X prefix_set 0 0 0;
#P newex 34 340 85 196617 append quad_grid;
#P window setfont "Proportional Serif" 10.;
#P comment 105 238 95 131727370 Crossfade Value;
#P comment 93 44 107 131727370 start;
#P window setfont "Sans Serif" 9.;
#P flonum 107 254 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Fixedwidth Serif" 10.;
#P message 106 274 55 1441802 xfade $1;
#P message 72 63 94 1441802 matrixoutput 1;
#P newex 34 300 177 1441802 jit.xfade;
#P fasten 24 0 10 0 527 88 39 88;
#P connect 11 0 10 0;
#P fasten 1 0 10 0 77 86 39 86;
#P fasten 2 0 0 0 111 294 39 294;
#P connect 10 0 0 0;
#P fasten 9 0 6 0 267 338 39 338;
#P connect 0 0 6 0;
#P connect 6 0 16 0;
#P fasten 18 2 16 0 418 360 39 360;
#P fasten 18 0 16 0 374 360 39 360;
#P connect 3 0 2 0;
#P fasten 24 0 14 0 527 165 206 165;
#P connect 15 0 14 0;
#P fasten 12 0 14 0 244 162 206 162;
#P connect 14 0 0 1;
#P connect 7 1 9 0;
#P connect 25 0 24 0;
#P connect 20 0 19 0;
#P connect 19 0 22 0;
#P connect 23 0 22 0;
#P connect 22 0 18 0;
#P connect 21 0 19 1;
#P window clipboard copycount 26;


July 2, 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 //

http://www.vade.info
abstrakt.vade.info


July 2, 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 30×30 cells (i’d prefer 50×50…) 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 "30×30" in the expression…


July 2, 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 30×30 cells (i’d prefer 50×50…) 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 "30×30" in the expression…
> –
> Bruno
>
> http://www.brunozamborlin.com
> http://www.myspace.com/brunozamborlin
>


July 2, 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 //

http://www.vade.info
abstrakt.vade.info


July 2, 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 //
>
> http://www.vade.info
> abstrakt.vade.info
>
>
>
>
>
>


July 2, 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 //
> >
> > http://www.vade.info
> > abstrakt.vade.info
> >
> >
> >
> >
> >
> >
>


July 2, 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


July 2, 2007 | 2:42 pm

http://scottdouglas.net/projects/glsl/

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.

http://cowboyprogramming.com/?p=34

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 //
>>
>> http://www.vade.info
>> abstrakt.vade.info
>>
>>
>>
>>
>>
>>

v a d e //

http://www.vade.info
abstrakt.vade.info


July 2, 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 //

http://www.vade.info
abstrakt.vade.info


July 2, 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


July 2, 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.


July 2, 2007 | 6:51 pm

Thank you Andrew.
I think the thread you mean is http://www.cycling74.com/forums/index.php?t=msg&goto=88022&rid=2862&S=df46c3a1c0c0b9ee6ea84d65fba5dd9b&srch=shader+bump#msg_88022

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


July 2, 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


July 2, 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…


July 2, 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?


July 2, 2007 | 10:31 pm


July 2, 2007 | 10:38 pm

Oh – Andrew, I got that working a while ago, heres some new stuff:

http://abstrakt.vade.info/?p=128 :D

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 //

http://www.vade.info
abstrakt.vade.info


July 3, 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


Viewing 23 posts - 1 through 23 (of 23 total)