Forums > Jitter

question on geometry morphing in open GL

October 23, 2007 | 1:27 pm

can someone explain, or point me towards relevant documentation -

why does jit.gl.model output the geometry matrix in a different way to other standard gl objects (nurbs, gridshape)?

it seems jit.gl.model outputs 8 planes of float32 data, and the dim size is just one number. on the other hand nurbs outputs 12 planes with a default dim size of 20×20.

as a test, i’m trying to do 3d geometry morphing using jit.xfade between a jit.gl.model and nurbs. when i xfade all the way to nurbs the geom disappears (or goes flat?).

is there any way to convert a dim 20×20 geom matrix to a dim 400 matrix… would that work?

any advice appreciated,

j


October 24, 2007 | 1:27 pm

bump…


October 24, 2007 | 1:32 pm

those of us who use email to read the forums need a little more to
bring topics back to our attention. can you quote the original
thread please, instead of just bumping?

On Oct 24, 2007, at 9:27 AM, justin wrote:

>
> bump…
>


October 24, 2007 | 1:44 pm

apologies for bump without question, didnt realise that was the case.

below is the original question:

can someone explain, or point me towards relevant documentation -

why does jit.gl.model output the geometry matrix in a different way to other standard gl objects (nurbs, gridshape)?

it seems jit.gl.model outputs 8 planes of float32 data, and the dim size is just one number. on the other hand nurbs outputs 12 planes with a default dim size of 20×20.

as a test, i’m trying to do 3d geometry morphing using jit.xfade between a jit.gl.model and nurbs. when i xfade all the way to nurbs the geom disappears (or goes flat?).

is there any way to convert a dim 20×20 geom matrix to a dim 400 matrix… would that work?

any advice appreciated,

Justin

Quote: joshua goldberg wrote on Wed, 24 October 2007 14:32
—————————————————-
> those of us who use email to read the forums need a little more to
> bring topics back to our attention. can you quote the original
> thread please, instead of just bumping?
>
> On Oct 24, 2007, at 9:27 AM, justin wrote:
>
> >
> > bump…
> >
>
>
—————————————————-


October 24, 2007 | 2:09 pm

if you send a single bang to a jit.gl.model @matrixoutput 1, you will
see a few things. you’ll see that a primitive is output after the
matrix name, and you’ll see that there are several matrices from each
bang- one for each disconnected shape in the model. if you need to
crossfade geometry, you’re going to have to take in account all of
those individual matrices.

On Oct 24, 2007, at 9:44 AM, justin wrote:

>
> apologies for bump without question, didnt realise that was the case.
>
> below is the original question:
>
> can someone explain, or point me towards relevant documentation -
>
> why does jit.gl.model output the geometry matrix in a different way
> to other standard gl objects (nurbs, gridshape)?
>
> it seems jit.gl.model outputs 8 planes of float32 data, and the dim
> size is just one number. on the other hand nurbs outputs 12 planes
> with a default dim size of 20×20.
>
> as a test, i’m trying to do 3d geometry morphing using jit.xfade
> between a jit.gl.model and nurbs. when i xfade all the way to nurbs
> the geom disappears (or goes flat?).
>
> is there any way to convert a dim 20×20 geom matrix to a dim 400
> matrix… would that work?
>
> any advice appreciated,
>
> Justin
>
> Quote: joshua goldberg wrote on Wed, 24 October 2007 14:32
> —————————————————-
>> those of us who use email to read the forums need a little more to
>> bring topics back to our attention. can you quote the original
>> thread please, instead of just bumping?
>>
>> On Oct 24, 2007, at 9:27 AM, justin wrote:
>>
>>>
>>> bump…
>>>
>>
>>
> —————————————————-
>
>
>


October 24, 2007 | 3:39 pm

The issue is that jit.gl.model reads arbitrary lists of triangles. It
doesn’t do any kind of downsampling internally so if you give it a
10,000 triangle model for example, how is it going to fit into a 20×20
matrix? Because the data is arbitrary, it is strung out into a 1D
matrix. Hope this makes sense. It’s 8 planes for (xyz) texcoord(uv)
normal(xyz).

wes


October 24, 2007 | 3:41 pm

Also check out the jit.gl.render helpfile which explains the geometry where plane 0 to 11 of the matrix represents x,y,z,s,t,nx,ny,nz,r,g,b,a.

s and t are your texture coordinates.
nx,ny,nz are normal components for the point and the rest are colors.

I was looking at open GL documents to get a better understanding of these parameters….. anybody have some good links that explain in detail all these parameters?


October 24, 2007 | 4:13 pm

i understand what you are saying, but is there a way of doing it the other way round…

so say you took the geometry from nurbs in a 20 x 20 matrix, can u put that in a 1 x 400 matrix? then you could xfade with an equivalent model of the same matrix size – in theory!

or is it possible to create your own jitter patch for downsampling of arbitrary geometry matrices?

your answers are much appreciated!

j

ps. i’m familiar with the jit.gl.render helpfile – and the 12 plane matrix format doesnt seem to apply to jit.gl.model, which is partly why i asked this question.

Quote: wesley.hoke@gmail.com wrote on Wed, 24 October 2007 16:39
—————————————————-
> The issue is that jit.gl.model reads arbitrary lists of triangles. It
> doesn’t do any kind of downsampling internally so if you give it a
> 10,000 triangle model for example, how is it going to fit into a 20×20
> matrix? Because the data is arbitrary, it is strung out into a 1D
> matrix. Hope this makes sense. It’s 8 planes for (xyz) texcoord(uv)
> normal(xyz).
>
> wes
>
—————————————————-


October 24, 2007 | 4:22 pm

> so say you took the geometry from nurbs in a 20 x 20 matrix, can u put that in a 1 x 400 matrix? then you could xfade with an equivalent model of the same matrix size – in theory!

Yes, but you’ll have to align the vertices appropriately. That might
be tricky to do but you can try it.

wes


October 24, 2007 | 10:13 pm

cant u just take one row at a time and put one after the other, or is "aligning vertices appropriately" more difficult than that?

j

Quote: wesley.hoke@gmail.com wrote on Wed, 24 October 2007 17:22
—————————————————-
> > so say you took the geometry from nurbs in a 20 x 20 matrix, can u put that in a 1 x 400 matrix? then you could xfade with an equivalent model of the same matrix size – in theory!
>
> Yes, but you’ll have to align the vertices appropriately. That might
> be tricky to do but you can try it.
>
> wes
>
—————————————————-


October 24, 2007 | 10:24 pm

Try using jit.scanwrap to shape the matrix similarly to the model and
see what happens.

wes

On 10/24/07, justin wrote:
>
> cant u just take one row at a time and put one after the other, or is "aligning vertices appropriately" more difficult than that?
>
> j
>
> Quote: wesley.hoke@gmail.com wrote on Wed, 24 October 2007 17:22
> —————————————————-
> > > so say you took the geometry from nurbs in a 20 x 20 matrix, can u put that in a 1 x 400 matrix? then you could xfade with an equivalent model of the same matrix size – in theory!
> >
> > Yes, but you’ll have to align the vertices appropriately. That might
> > be tricky to do but you can try it.
> >
> > wes
> >
> —————————————————-
>
>
>


October 24, 2007 | 10:49 pm

On Oct 24, 2007, at 3:24 PM, Wesley Smith wrote:

> Try using jit.scanwrap to shape the matrix similarly to the model and
> see what happens.

Going to be really odd since triangles -> quad_grid isn’t going to
look right. In general I would say you can’t easily morph between
jit.gl.model with jit.gl.nurbs unless you *really* know what you’re
doing..i.e. you understand how to generate models so that the
triangle ordering is specific, and you understand how to unwind a
quad_grid (or tri_grid) to a set of triangles. It is pretty tricky.
Most people that want to morph with jit.gl.model model their
equivalent nurbs/gridshape/etc object in the same modelling
environment as their model and use very specific rules. There’s at
least one thread on this somewhere in the archive.

-Joshua


October 25, 2007 | 10:16 am

here’s a patch to illustrate the idea. it seems joshua’s comments on triangles -> quad_grid persist…

i admit i’m not one of those who *really* knows what they are doing with regard to unwinding vertices from quad_grid to triangles, but i’m happy to read up on it and find out a little more before i decide whether or not it’s *really* too difficult!

if anyone has any relevant documentation (other than Jitter help)
i’d appreciate any links.

i have also searched the forum archives, but not found anything of much help on this topic.

j

#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P comment 804 355 141 196617 < < convert 20 x 20 matrix to match dim size of 3d model;
#P window linecount 1;
#P hidden message 775 526 14 196617 1;
#P toggle 757 525 15 0;
#P message 757 548 88 196617 poly_mode $1 $1;
#P newex 86 241 32 196617 sel 1;
#P newex 391 358 74 196617 pak dim 100 1;
#P newex 423 334 40 196617 change;
#P newex 423 314 53 196617 route dim;
#P newex 423 293 72 196617 jit.matrixinfo;
#P newex 163 385 55 196617 delay 500;
#P newex 126 241 29 196617 gate;
#P toggle 126 217 15 0;
#P newex 126 281 25 196617 t b b;
#P toggle 126 310 15 0;
#P message 141 310 37 196617 2000.;
#P button 126 264 15 0;
#P newex 126 361 40 196617 line 0.;
#P newex 641 327 184 196617 jit.slide @slide_up 10 @slide_down 10;
#P user jit.fpsgui 641 460 60 196617 3;
#P newex 641 350 130 196617 jit.matrix 8 float32 20 20;
#P number 572 332 35 9 0 3 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 572 351 45 196617 mode $1;
#P newex 641 383 142 196617 jit.scanwrap 8 float32 348 1;
#P comment 523 527 127 196617 texture;
#P message 598 545 53 196617 texture 0;
#P message 515 545 82 196617 texture textur1;
#P comment 315 145 140 196617 click to select 3d files folder;
#P window linecount 2;
#P comment 56 495 96 196617 triangles seems to provide best results;
#P window linecount 1;
#P comment 127 200 127 196617 click to set morph on loop;
#P comment 220 77 55 196617 fullscreen;
#P user jit.fpsgui 282 588 60 196617 3;
#P message 641 281 30 196617 rand;
#P flonum 126 400 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 126 421 48 196617 xfade $1;
#P user jit.fpsgui 270 342 60 196617 3;
#P newex 344 545 49 196617 jit.xfade;
#P newex 641 305 166 196617 jit.gl.nurbs 3DOB @matrixoutput 1;
#P message 515 226 99 196617 read mushrooms.obj;
#P hidden message 269 523 14 196617 1;
#P toggle 251 523 15 0;
#P message 251 545 90 196617 lighting_enable $1;
#P hidden message 174 523 14 196617 1;
#P toggle 156 522 15 0;
#P message 156 545 94 196617 smooth_shading $1;
#P newex 56 545 99 196617 prepend draw_mode;
#P user ubumenu 57 522 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;
#X pattrmode 1;
#P hidden message 464 207 14 196617 2;
#P message 424 226 90 196617 material_mode $1;
#P number 424 205 35 9 0 2 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 2;
#P newex 344 588 267 196617 jit.gl.mesh 3DOB @draw_mode triangles @lighting_enable 1 @smooth_shading 1 @color 1. 1. 1. 1.;
#P user ubumenu 299 204 100 196617 0 1 1 0;
#X add abstract;
#X add abstract/lineglith1.obj;
#X add abstract/lineglith1b.obj;
#X add abstract/lineglith2.obj;
#X add abstract/planes3.obj;
#X add abstract/shape.obj;
#X add abstract/stairss.obj;
#X add abstract/stairsss2.obj;
#X add cube;
#X add cube/sqquares.obj;
#X add cube/squbee.obj;
#X add cube/tria2.obj;
#X add pyramide;
#X add pyramide/honeyt.obj;
#X add pyramide/pyr44.obj;
#X add pyramide/tritri.obj;
#X add sphere;
#X add sphere/honeyc.obj;
#X add sphere/stairsss.obj;
#X add sphere/triacirc.obj;
#X add tunnel;
#X add tunnel/cubestar.obj;
#X add tunnel/honeyARAb.obj;
#X add tunnel/triglitch.obj;
#X add tunnel/triglitch1.obj;
#X add tunnel/triglitch2.obj;
#X add tunnel/triglitch3.obj;
#X add tunnel/triglitch4.obj;
#X add tunnel/triglitch5.obj;
#X add tunnel/triglitch6.obj;
#X add tunnel/triglitch77.obj;
#X prefix_set 0 1 "Macintosh HD:/Users/justin/Movies/weirdcore/obj/" 1;
#P window linecount 1;
#P newex 299 184 76 196617 prepend prefix;
#P button 299 145 15 0;
#P newex 299 164 76 196617 opendialog fold;
#P toggle 126 77 15 0;
#P newex 204 57 38 196617 sel 27;
#P newex 204 38 40 196617 key;
#N vpatcher 367 207 967 607;
#P window setfont "Sans Serif" 9.;
#P newex 89 148 42 196617 r 3DOB;
#P toggle 296 94 15 0;
#P newex 296 114 93 196617 prepend fullscreen;
#N comlet render;
#P inlet 296 75 15 0;
#N comlet render;
#P inlet 61 27 15 0;
#P newex 109 90 68 196617 s renderbang;
#P newex 61 68 58 196617 t b erase b;
#P newex 61 48 57 196617 qmetro 20;
#P newex 296 155 211 196617 jit.window 3DOB @floating 1 @depthbuffer 1;
#P newex 61 199 205 196617 jit.gl.render 3DOB @erase_color 0. 0. 0. 1.;
#P connect 5 0 2 0;
#P connect 2 0 3 0;
#P connect 3 1 0 0;
#P connect 3 0 0 0;
#P connect 9 0 0 0;
#P connect 3 2 4 0;
#P connect 6 0 8 0;
#P connect 8 0 7 0;
#P connect 7 0 1 0;
#P pop;
#P newobj 126 115 88 196617 p render_context;
#P toggle 204 77 15 0;
#P newex 344 226 68 196617 prepend read;
#P newex 344 264 167 196617 jit.gl.model 3DOB @matrixoutput 1;
#P comment 142 77 40 196617 render;
#P connect 39 0 26 1;
#P connect 39 0 43 0;
#P connect 26 0 31 0;
#P connect 26 0 12 0;
#P connect 1 0 27 0;
#P connect 1 0 26 0;
#P connect 1 0 53 0;
#P connect 59 0 58 0;
#P hidden connect 60 0 59 0;
#P fasten 56 0 39 0 396 379 646 379;
#P connect 42 0 39 0;
#P fasten 40 0 39 0 577 374 646 374;
#P connect 44 0 42 0;
#P connect 25 0 44 0;
#P fasten 30 0 25 0 646 302 646 302;
#P connect 41 0 40 0;
#P connect 13 0 14 0;
#P hidden connect 15 0 13 0;
#P connect 55 0 56 1;
#P connect 54 0 55 0;
#P connect 53 0 54 0;
#P fasten 58 0 12 0 762 575 349 575;
#P fasten 18 0 12 0 161 574 349 574;
#P fasten 21 0 12 0 256 574 349 574;
#P fasten 17 0 12 0 61 575 349 575;
#P fasten 37 0 12 0 603 573 349 573;
#P fasten 36 0 12 0 520 573 349 573;
#P fasten 28 0 26 0 131 490 349 490;
#P fasten 24 0 1 0 520 252 349 252;
#P fasten 14 0 1 0 429 252 349 252;
#P connect 2 0 1 0;
#P connect 11 1 2 0;
#P connect 10 0 11 0;
#P connect 8 0 10 0;
#P connect 9 0 8 0;
#P connect 22 0 21 0;
#P hidden connect 23 0 22 0;
#P connect 3 0 4 1;
#P connect 6 0 3 0;
#P connect 5 0 6 0;
#P connect 45 1 52 0;
#P connect 19 0 18 0;
#P hidden connect 20 0 19 0;
#P fasten 52 0 51 1 168 407 222 407 222 229 150 229;
#P connect 47 0 45 1;
#P connect 49 1 47 0;
#P connect 29 0 28 0;
#P connect 45 0 29 0;
#P connect 48 0 45 0;
#P connect 49 0 48 0;
#P connect 46 0 49 0;
#P fasten 57 0 46 0 91 261 131 261;
#P connect 51 0 46 0;
#P fasten 50 0 57 0 131 236 91 236;
#P connect 50 0 51 0;
#P connect 7 0 4 0;
#P fasten 16 1 17 0 91 541 61 541;
#P window clipboard copycount 62;


October 25, 2007 | 9:25 pm

it looks to me like you’ve done a good job realizing your initial theory. you *are* morphing from a gl.model to a gl.nurbs, no?

what else do you want to achieve. i don’t think you’ll be able to get much more control with this basic morphing paradigm. are you trying to get specific vertices of the mushroom to morph to specific areas of the nurbs shape? this would be very hard (impossible) to do without modeling the nurbs shape in advance, or without knowing how the gl.nurbs vertices are indexed and modeling your gl.obj with this indexing in mind.

3d morphing requires the objects have the same number of vertices and prior knowledge of where a vertex in one model is going to end up in the second model. i would think this would be achieved by modeling the first object, and then very carefully, in a 3d editor reshaping the first model to look like the second model, moving each vertex in the first to where it should go in the second.

don’t know if that is much help.


October 25, 2007 | 10:43 pm

that is helpful… a different approach to morphing from gl.model to standard gl gridshape / nurbs.

thanks

j

Quote: robtherich wrote on Thu, 25 October 2007 22:25
—————————————————-

> 3d morphing requires the objects have the same number of vertices and prior knowledge of where a vertex in one model is going to end up in the second model. i would think this would be achieved by modeling the first object, and then very carefully, in a 3d editor reshaping the first model to look like the second model, moving each vertex in the first to where it should go in the second.
>
> don’t know if that is much help.
—————————————————-



Wei
January 31, 2013 | 4:54 am

Hi all

I am trying morphing dae files too, according to Robs words, I can not successfully morph my dae files under triangle mode, is that because of my models don’t have same amount of vertex? there’s always display error or broken faces while i morphing them, only the left inlet of the xfade displayed well.

Thanks

L


January 31, 2013 | 9:50 pm

is that because of my models don’t have same amount of vertex?

probably. how can we say more without seeing the patch and the models in question?


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