## URGENT QUESTION!!!!

Nov 4, 2008 at 6:40pm

# URGENT QUESTION!!!!

I’ve worked with jitter for a long time, and what I cannot understand is why a jit.gl.render requires 3 planes for rendering 3D stuff (x,y,z) vector arranged in a:

“jit.matrix 3 float32 30 30″

This is a 3 plane matrix with 30 rows and 30 columns..

WHY 30 rows and 30 columns having already 3 planes for the 3D vector?

If I try to render something with 3 planes and just 30 rows it doesn’t work… what is this N x M (rows x columns) thing? what is the meaning of this? please explain that to me… I can’t end a project because of this abstraction!

Much much thanks

Miguel

#40665
Nov 4, 2008 at 6:43pm

#144038
Nov 4, 2008 at 7:20pm

On Tue, Nov 4, 2008 at 7:40 PM, Miguel Mesa Perez wrote:

>
>
> I’ve worked with jitter for a long time, and what I cannot understand is
> why a jit.gl.render requires 3 planes for rendering 3D stuff (x,y,z) vector
> arranged in a:
>
> “jit.matrix 3 float32 30 30″
>
> This is a 3 plane matrix with 30 rows and 30 columns..
>
> WHY 30 rows and 30 columns having already 3 planes for the 3D vector?
>
> If I try to render something with 3 planes and just 30 rows it doesn’t
> work… what is this N x M (rows x columns) thing? what is the meaning of
> this? please explain that to me… I can’t end a project because of this
> abstraction!
>

I don’t know where you get this 30×30 idea from but I don’t think there is
such a requirement. I usually don’t render gl from video matrices, but the
last time I did it was definately not a 30×30 matrix.

Every cell in a matrix holds a vertex and its additional data. The first 3
planes are the bare minimum to hold the data for 1 vertex (x y and z). If
you want to add other info like color and texture coordinates you need to
use more planes then the first 3. The specification of what planes hold what
data is somewhere in the jitter reference.

So a 30×30 matrix would mean you can store data for a maximum of 900
vertices. There is no such limit afaik. There is a limit to the maximum
jitter matrix dimensions but that’s way higher.

Quoted from the online jitter sdk:
*Since Jitter is a general purpose matrix processing framework, it makes
sense that you would have the ability to pass geometry information through a
Jitter network as matrices if your geometry is well suited to a matrix
representation. The cells of your matrix can hold vertex information such as
position, texture coordinates, normal vectors, color, and edge flags, and
are documented in the “Geometry Under The Hood” Jitter Tutorial. You also
have the option of specifying a connections matrix to reference the
connectivity of the vertices if it is not implicit in the matrix
representation, and a drawing primitive to use when drawing the vertices.*

If you’ve worked with jitter for so long, maybe now is a good time to have a
look at the documentation ;-)

Thijs

#144039
Nov 4, 2008 at 7:28pm

Hi there,
If you are sending a matrix directly to jit.gl.render, then by default it is reading the matrix as a “tri_grid”, meaning a grid of vertex positions connected as triangles. Without a second dimension, you have no grid. You can try switching the drawing mode of jit.gl.render to try different interpretations (polygon,line_loop,quads, etc.). In general, I would recommend using jit.gl.mesh for this sort of thing, as the interface is a lot more friendly and robust and it provides a lot more sensible options. As always, we’re going to be much more help if you post a specific patch that is giving you trouble. It is quite a bit more time-consuming for someone to sit down and explain a general theory of operation without any clue as to what you are working on. The easier you make it for us to help, the more likely we all are to help you.

Take a breath.

Andrew B.

#144040
Nov 4, 2008 at 7:37pm

Sorry if my post sounded harsh…. it wasn’t my intention to offend . Just receive help because tomorrow is my deadline and now things are confusing.

here is my patch. If you open the “plot” subpatch and change the “dim” then it would work anymore.

max v2;
#N vpatcher 693 128 1214 437;
#P origin 28 42;
#P window setfont “Sans Serif” 9.;
#P number 73 58 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#N vpatcher 563 467 1221 852;
#P origin 32 -1;
#P window setfont “Sans Serif” 9.;
#P user jit.fpsgui 238 321 60 9109513 0;
#P window linecount 1;
#P hidden newex 304 189 56 9109513 loadmess 1;
#P hidden newex 579 189 60 9109513 loadmess 1;
#P flonum 462 208 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 501 208 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 540 208 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 579 208 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 461 228 169 9109513 pak color 0. 0. 0. 0.;
#P flonum 304 208 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 343 208 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 382 208 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 421 208 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 303 228 138 9109513 pak erase_color 0. 0. 0. 0.;
#P newex 456 303 77 9109513 r parm_render;
#P hidden newex 9 326 77 9109513 s parm_render;
#P hidden newex 9 54 60 9109513 loadmess 2;
#P hidden newex 46 229 66 9109513 loadmess 15;
#P hidden newex 208 30 60 9109513 loadmess 5;
#P hidden newex 9 273 61 9109513 loadmess 10;
#P flonum 9 78 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 9 96 71 9109513 point_size \$1;
#P flonum 179 146 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 208 128 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 226 146 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 179 68 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 208 50 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 226 68 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 162 164 99 9109513 pak position 0. 0. 0.;
#P newex 167 86 94 9109513 pak lookat 0. 0. 0.;
#P toggle 9 126 23 0;
#P message 9 148 96 9109513 smooth_shading \$1;
#P toggle 9 179 23 0;
#P message 9 201 90 9109513 lighting_enable \$1;
#P hidden newex 372 294 62 9109513 r to_render;
#P flonum 9 229 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 9 247 111 9109513 pak camera 0. 0. 0.;
#P toggle 219 190 23 0;
#P toggle 242 221 22 0;
#P toggle 201 220 22 0;
#P newex 160 247 92 9109513 pak poly_mode 0 0;
#P user ubumenu 9 300 68 9109513 0 1 1 0;
#X prefix_set 0 0 0;
#X pattrmode 1;
#P window linecount 2;
#P newex 302 321 240 9109513 jit.gl.render ” ” @lighting_enable 1 @smooth_shading 1 @depth_enable 1 @erase_color 1. 1.1. 1.;
#P window linecount 1;
#P hidden newex 320 268 225 9109513 jit.gl.handle ” ” @auto_rotate 1 @inherit_transform 1;
#P window linecount 0;
#P comment 1 22 100 9109513;
#P hidden connect 28 0 24 0;
#P connect 24 0 23 0;
#P hidden connect 14 0 13 0;
#P hidden connect 12 0 11 0;
#P hidden connect 27 0 9 0;
#P hidden connect 25 0 3 0;
#P hidden connect 15 0 29 0;
#P hidden connect 4 0 29 0;
#P hidden connect 16 0 29 0;
#P hidden connect 23 0 29 0;
#P hidden connect 13 0 29 0;
#P hidden connect 11 0 29 0;
#P hidden connect 3 1 29 0;
#P hidden connect 8 0 29 0;
#P hidden connect 9 0 8 3;
#P hidden connect 22 0 16 1;
#P hidden connect 19 0 15 1;
#P fasten 7 0 5 0 224 216 206 216;
#P connect 5 0 4 1;
#P hidden connect 26 0 18 0;
#P hidden connect 21 0 16 2;
#P hidden connect 18 0 15 2;
#P connect 2 0 43 0;
#P fasten 7 0 6 0 224 216 247 216;
#P connect 6 0 4 2;
#P hidden connect 20 0 16 3;
#P hidden connect 17 0 15 3;
#P connect 1 0 2 0;
#P connect 36 0 2 0;
#P connect 31 0 2 0;
#P connect 30 0 2 0;
#P hidden fasten 10 0 2 0 377 316 307 316;
#P hidden connect 42 0 35 0;
#P hidden connect 41 0 35 0;
#P hidden connect 35 0 31 1;
#P hidden connect 42 0 34 0;
#P hidden connect 41 0 34 0;
#P hidden connect 34 0 31 2;
#P hidden connect 42 0 33 0;
#P hidden connect 41 0 33 0;
#P hidden connect 33 0 31 3;
#P hidden connect 42 0 32 0;
#P hidden connect 41 0 32 0;
#P hidden connect 32 0 31 4;
#P hidden connect 42 0 40 0;
#P hidden connect 41 0 40 0;
#P hidden connect 40 0 36 1;
#P hidden connect 42 0 39 0;
#P hidden connect 39 0 36 2;
#P hidden connect 42 0 38 0;
#P hidden connect 38 0 36 3;
#P hidden connect 42 0 37 0;
#P hidden connect 41 0 37 0;
#P hidden connect 37 0 36 4;
#P pop;
#P newobj 229 187 58 9109513 p renderer;
#P newex 25 217 33 9109513 sel 27;
#P newex 59 217 40 9109513 key;
#P newex 86 94 26 9109513 s on;
#P message 123 115 35 9109513 erase;
#P newex 62 137 53 9109513 s to_prob;
#P newex 44 158 55 9109513 s to_matrix;
#P newex 230 155 63 9109513 s to_render;
#N vpatcher 700 431 1171 685;
#P origin 58 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 3;
#P comment 122 29 100 9109513 THIS WORKS: 100 X 100 DIM (100 COLS , 100 ROWS);
#P window linecount 0;
#P message 264 98 41 9109513 dim 100;
#P window linecount 1;
#P newex 215 368 282 9109513 jit.expr @expr “in[0].p[0]” “in[0].p[1]” “sin(in[0].p[0])+sin(in[0].p[1])”;
#P newex 18 167 331 9109513 jit.expr @expr “in[0].p[0]*7″ “in[0].p[1]*7″ “sin(in[0].p[0]*24)+cos(in[0].p[1]*24)”;
#P message 160 97 59 9109513 dim 100 100;
#P newex 18 115 132 9109513 jit.gencoord 3 float32 100 100;
#P outlet 18 209 15 0;
#P newex 18 84 53 9109513 r to_matrix;
#P window linecount 0;
#P comment 0 21 100 9109513;
#P comment 265 42 117 9109513 THIS DOESNT WORK: JUST 100 ROWS;
#P connect 5 0 4 0;
#P connect 2 0 4 0;
#P connect 8 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 3 0;
#P pop;
#P newobj 230 133 31 9109513 p plot;
#P window setfont “Fixedwidth Serif” 12.;
#P hidden newex 119 241 66 9240588 r to_win;
#P window setfont “Sans Serif” 9.;
#P message 42 243 68 9109513 fullscreen \$1;
#P toggle 25 243 15 0;
#P newex 123 137 62 9109513 s to_render;
#P newex 26 180 62 9109513 s to_render;
#P newex 25 260 271 9109513 jit.window ” ” @floating 0 @depthbuffer 1 @size 640 480;
#P newex 26 94 57 9109513 qmetro 50;
#P newex 26 115 47 9109513 t b b b;
#P toggle 26 58 29 0;
#P window linecount 0;
#P comment 0 21 100 9109513;
#P hidden connect 16 0 17 0;
#P connect 17 0 7 0;
#P hidden connect 9 0 4 0;
#P hidden connect 8 0 4 0;
#P connect 1 0 3 0;
#P connect 3 0 2 0;
#P connect 2 0 5 0;
#P hidden fasten 7 0 8 0 41 258 41 243;
#P connect 2 1 12 0;
#P connect 2 2 13 0;
#P connect 19 0 3 1;
#P fasten 1 0 15 0 31 90 91 90;
#P fasten 3 0 14 0 33 113 128 113;
#P connect 14 0 6 0;
#P connect 10 0 11 0;
#P pop;

#144041
Nov 4, 2008 at 7:44pm

God! I’m tired and confused… my english is not good now… I’ve read the posts again and no one clamis to be offended, well don’t know why I tought that before… well… sorry for everything I’ve written wrong.

Miguel

#144042
Nov 4, 2008 at 8:31pm

Hello,
The problem mainly stems from how your expression is written. Since you rely on coordinates generated across the Y-dimension of your matrix, you are going to get very different results with a 1D matrix. In this case, all the cells of plane 1 will equal 0., which means that the result of your plane 2 expression will essentially just be the sin(norm[0]*24) when used with a 1D matrix. To remedy this, you can either change your expressions to no longer require values from plane 1 or use jit.submatrix to take a horizontal slice of your larger matrix coming from jit.gencoord. On a side note, another thing I might recommend is the use of norm[n],snorm[n],and cell[n] variables in jit.expr instead of the jit.gencoord object. Let us know how you get on. Also, try using other draw_modes besides tri_grid (line_strip comes to mind).
Best,
Andrew B.

#144043
Nov 4, 2008 at 8:46pm

On Tue, Nov 4, 2008 at 9:31 PM, Andrew Benson wrote:

>
> The problem mainly stems from how your expression is written. Since you
> rely on coordinates generated across the Y-dimension of your matrix, you are
> going to get very different results with a 1D matrix. In this case, all the
> cells of plane 1 will equal 0., which means that the result of your plane 2
> expression will essentially just be the sin(norm[0]*24) when used with a 1D
> matrix. To remedy this, you can either change your expressions to no longer
> require values from plane 1 or use jit.submatrix to take a horizontal slice
> of your larger matrix coming from jit.gencoord. On a side note, another
> thing I might recommend is the use of norm[n],snorm[n],and cell[n] variables
> in jit.expr instead of the jit.gencoord object. Let us know how you get on.
> Also, try using other draw_modes besides tri_grid (line_strip comes to
> mind).
>

A quick fix is to set your dimensions with 1 as a minimum with a simple
adjustment like shown in the patch below. I second the suggestion of Andrew
to use jit.gl.mesh instead of sending matrices directly to jit.gl.render.
That way your patch becomes more managable and also scalable. For example,
you could render multiple of these object by using multiple jit.gl.mesh
objects.

Thijs

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 251 96 57 9109513 pak dim 0 0;
#P number 303 75 35 9 1 100 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 259 75 35 9 1 100 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 18 167 331 9109513 jit.expr @expr “in[0].p[0]*7″ “in[0].p[1]*7″
“sin(in[0].p[0]*24)+cos(in[0].p[1]*24)”;
#P message 160 97 59 9109513 dim 100 100;
#P newex 18 115 132 9109513 jit.gencoord 3 float32 100 100;
#P outlet 18 209 15 0;
#P newex 18 84 53 9109513 r to_matrix;
#P comment 271 56 117 9109513 set 1 minimum;
#P connect 6 0 8 1;
#P connect 7 0 8 2;
#P connect 8 0 3 0;
#P connect 5 0 2 0;
#P connect 3 0 5 0;
#P connect 1 0 3 0;
#P connect 4 0 3 0;
#P window clipboard copycount 9;

#144044

You must be logged in to reply to this topic.