Forums > Jitter

OpenGL output issues with varying rendering methods

March 31, 2006 | 2:56 am

hi,

im wondering about why the following patch has different output
depending on my rendering method

Im sending the same geometry matrix to jit.gl.render, sketch and
mesh, and each one looks different.

Id love to be enlightened as to why. Im assuming it has something to
do with normals.

Thanks in advance,

max v2;
#N vpatcher 318 331 1317 970;
#P window setfont "Sans Serif" 9.;
#P message 416 124 90 196617 rebuild_geometry;
#P message 246 339 118 196617 normal_matrix geombuf;
#P window linecount 2;
#P comment 383 337 332 196617 ive noticed a normal_matrix message to
jit.gl.mesh , but cant seem to get it to do anything;
#P window linecount 1;
#P message 258 360 87 196617 normal_matrix 1;
#P newex 130 42 60 196617 loadmess 0;
#P window linecount 6;
#P comment 520 67 332 196617 Please load a model and bang the big
shiney bang to dump some data into our geometry buffer. Now , choose
a rendering method. Switch around and look at the difference in
output. Im assuming it has something to do with normals , yet , im
not changing normals anywhere? Note im using the same geometry and
using the same drawing mode for all of the rendering options
(triangles).;
#P window linecount 1;
#P newex 322 192 49 196617 r matrix;
#P message 416 98 30 196617 read;
#P button 373 79 33 0;
#P newex 627 470 48 196617 loadbang;
#P newex 130 292 49 196617 s matrix;
#P newex 332 398 41 196617 r mesh;
#P newex 145 273 41 196617 s mesh;
#P newex 160 253 47 196617 s sketch;
#P newex 576 489 47 196617 r sketch;
#P newex 130 118 27 196617 + 1;
#P user ubumenu 130 95 128 196617 0 1 1 0;
#X add matrix to jit.gl.render;
#X add jit.gl.mesh;
#X add jit.gl.sketch;
#X prefix_set 0 0 0;
#X pattrmode 1;
#P message 627 490 147 196617 drawmatrix geombuf triangles;
#P window linecount 2;
#P newex 614 518 244 196617 jit.gl.sketch v5 @depth_enable 1
@smooth_shading 1 @lighting_enable 1 @blend_enable 1 @automatic 0;
#P window linecount 1;
#P newex 373 221 95 196617 jit.matrix geombuf;
#P newex 42 478 83 196617 append triangles;
#P newex 36 524 369 196617 jit.gl.handle v5 @inherit_transform 1
@auto_rotate 1 @tracking 0.2 @visible 0;
#P toggle 782 378 15 0;
#P message 782 398 75 196617 auto_colors $1;
#P toggle 680 378 15 0;
#P message 680 398 95 196617 auto_bitangents $1;
#P toggle 588 378 15 0;
#P message 588 398 85 196617 auto_tangents $1;
#P toggle 495 378 15 0;
#P message 495 398 85 196617 auto_normals $1;
#P user jit.fpsgui 18 581 60 196617 0;
#P newex 390 398 99 196617 prepend draw_mode;
#P user ubumenu 391 378 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 prefix_set 0 0
0;
#X pattrmode 1;
#P toggle 18 38 15 0;
#P window linecount 2;
#P newex 373 425 355 196617 jit.gl.mesh v5 @depth_enable 1
@blend_enable 1 @auto_normals 1 @lighting_enable 1 @smooth_shading 1
@automatic 0 @draw_mode triangles;
#P window linecount 1;
#P newex 373 153 283 196617 jit.gl.model v5 @matrixoutput 1
@automatic 0 @normalize 0;
#P newex 314 550 199 196617 jit.window v5 @depthbuffer 1 @floating 1;
#P window linecount 2;
#P newex 18 547 236 196617 jit.gl.render v5 @depth_enable 1
@lighting_enable 1 @smooth_shading 1 @blend_enable 1;
#P window linecount 1;
#P newex 130 231 40 196617 gate 3;
#P newex 18 74 58 196617 t b b erase;
#P newex 18 55 51 196617 qmetro 4;
#P comment 144 71 140 196617 Choose our rendering method;
#P comment 520 49 100 196617 Hi!;
#P connect 9 0 2 0;
#P connect 2 0 3 0;
#P fasten 3 2 5 0 71 319 23 319;
#P connect 3 0 5 0;
#P connect 21 0 5 0;
#P fasten 22 0 5 0 47 508 23 508;
#P connect 5 0 12 0;
#P connect 23 0 22 0;
#P connect 38 0 26 0;
#P connect 26 0 27 0;
#P connect 27 0 4 0;
#P connect 4 0 32 0;
#P connect 4 1 30 0;
#P fasten 3 1 4 1 47 183 165 183;
#P connect 4 2 29 0;
#P connect 42 0 7 0;
#P connect 34 0 7 0;
#P connect 35 0 7 0;
#P connect 7 0 23 0;
#P fasten 36 0 23 0 327 215 378 215;
#P fasten 41 0 8 0 251 389 378 389;
#P fasten 39 0 8 0 263 389 378 389;
#P fasten 19 0 8 0 787 419 378 419;
#P fasten 17 0 8 0 685 419 378 419;
#P fasten 15 0 8 0 593 419 378 419;
#P fasten 13 0 8 0 500 419 378 419;
#P fasten 11 0 8 0 395 419 378 419;
#P fasten 31 0 8 0 337 420 378 420;
#P connect 23 0 8 0;
#P fasten 10 1 11 0 425 396 395 396;
#P connect 14 0 13 0;
#P connect 16 0 15 0;
#P connect 25 0 24 0;
#P connect 28 0 24 0;
#P connect 33 0 25 0;
#P connect 18 0 17 0;
#P connect 20 0 19 0;
#P pop;

v a d e //

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

I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I
LIVE! I LIVE! I LIVE! I LIVE!

You will not be saved by the Holy Ghost. You will not be saved by the
God Plutonium.

In fact, YOU WILL NOT BE SAVED!


April 1, 2006 | 8:46 pm

Hi,

No one has any clue about this?
Id love to get a thought from the hard core Jitter folk…

v a d e //

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


April 1, 2006 | 10:32 pm

Hey there,
I took a look at your patch. The obj works nicely because it takes
it’s normals from the text file. So, whatever program generated the
obj file also generated the normals to make it look proper.

The mesh object doesn’t do a good job of "smooth shading" when in
@draw_mode triangles. If you don’t give it a normals matrix, and set
@auto_normals 1 it jit.gl.mesh will make it look bizarre because it
uses the triangle vertices (a guess here) to calculate the normal.
Depending on vertex winding and thus which way the normal is facing,
you will get a jagged, checkered look. If however, you explicity set
the vertex matrix by sending a 3 plane matrix in the 3rd inlet, it
will look just like jit.gl.model’s results. For some reason, sending
an 8 plane matrix in jit.gl.mesh’s first inlet doesn’t set the normal
matrix like I thought it was supposed to. So, you have to break the
matrix up and set the matrices on a per inlet basis. Personally, I
think the jit.gl.mesh object could use this feature as it would be
very simple to add as it is a pain in the ass to unpack and repack
matrices for opengl geometry.

As far as the sketch results are concerned, I haven’t a clue.

The patch below shows how to get good results from jit.gl.mesh.

best,
wes

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 474 293 53 196617 jit.pack 3;
#P newex 529 293 53 196617 jit.pack 3;
#P newex 480 265 118 196617 jit.unpack 8;
#P message 347 479 70 196617 fullscreen $1;
#P toggle 296 485 15 0;
#P newex 244 490 44 196617 sel 102;
#P number 232 469 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 234 444 40 196617 key;
#P message 156 496 34 196617 reset;
#P user jit.fpsgui 482 208 60 196617 2;
#P user jit.fpsgui 394 286 60 196617 4;
#P message 423 131 90 196617 rebuild_geometry;
#P message 253 346 118 196617 normal_matrix geombuf;
#P window linecount 2;
#P comment 390 344 332 196617 ive noticed a normal_matrix message to
jit.gl.mesh , but cant seem to get it to do anything;
#P window linecount 1;
#P message 265 367 87 196617 normal_matrix 1;
#P newex 137 49 60 196617 loadmess 0;
#P window linecount 6;
#P comment 527 74 332 196617 Please load a model and bang the big
shiney bang to dump some data into our geometry buffer. Now , choose
a rendering method. Switch around and look at the difference in
output. Im assuming it has something to do with normals , yet , im
not changing normals anywhere? Note im using the same geometry and
using the same drawing mode for all of the rendering options
(triangles).;
#P window linecount 1;
#P newex 329 199 49 196617 r matrix;
#P message 423 105 30 196617 read;
#P button 380 86 33 0;
#P newex 634 477 48 196617 loadbang;
#P newex 137 299 49 196617 s matrix;
#P newex 339 405 41 196617 r mesh;
#P newex 152 280 41 196617 s mesh;
#P newex 167 260 47 196617 s sketch;
#P newex 583 496 47 196617 r sketch;
#P newex 137 125 27 196617 + 1;
#P user ubumenu 137 102 128 196617 0 1 1 0;
#X add matrix to jit.gl.render;
#X add jit.gl.mesh;
#X add jit.gl.sketch;
#X prefix_set 0 0 0;
#X pattrmode 1;
#P message 634 497 147 196617 drawmatrix geombuf triangles;
#P window linecount 2;
#P newex 621 525 305 196617 jit.gl.sketch v5 @depth_enable 1
@smooth_shading 1 @lighting_enable 1 @blend_enable 1 @automatic 0
@autonormal 1;
#P window linecount 1;
#P newex 380 228 95 196617 jit.matrix geombuf;
#P newex 49 485 83 196617 append triangles;
#P newex 43 531 369 196617 jit.gl.handle v5 @inherit_transform 1
@auto_rotate 1 @tracking 0.2 @visible 1;
#P toggle 789 385 15 0;
#P message 789 405 75 196617 auto_colors $1;
#P toggle 687 385 15 0;
#P message 687 405 95 196617 auto_bitangents $1;
#P toggle 595 385 15 0;
#P message 595 405 85 196617 auto_tangents $1;
#P toggle 502 385 15 0;
#P message 502 405 85 196617 auto_normals $1;
#P user jit.fpsgui 25 588 60 196617 0;
#P newex 397 405 99 196617 prepend draw_mode;
#P user ubumenu 398 385 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 prefix_set 0 0
0;
#X pattrmode 1;
#P toggle 25 45 15 0;
#P window linecount 2;
#P newex 380 432 355 196617 jit.gl.mesh v5 @depth_enable 1
@blend_enable 1 @auto_normals 1 @lighting_enable 1 @smooth_shading 1
@automatic 0 @draw_mode triangles;
#P window linecount 1;
#P newex 380 160 283 196617 jit.gl.model v5 @matrixoutput 1 @automatic
0 @normalize 0;
#P newex 321 557 199 196617 jit.window v5 @depthbuffer 1 @floating 1;
#P window linecount 2;
#P newex 25 554 236 196617 jit.gl.render v5 @depth_enable 1
@lighting_enable 1 @smooth_shading 1 @blend_enable 1;
#P window linecount 1;
#P newex 137 238 40 196617 gate 3;
#P newex 25 81 58 196617 t b b erase;
#P newex 25 62 51 196617 qmetro 4;
#P comment 151 78 140 196617 Choose our rendering method;
#P comment 527 56 100 196617 Hi!;
#P connect 53 0 8 0;
#P connect 51 2 53 2;
#P connect 51 1 53 1;
#P connect 51 0 53 0;
#P connect 52 0 8 2;
#P connect 51 7 52 2;
#P connect 51 6 52 1;
#P connect 51 5 52 0;
#P connect 23 0 22 0;
#P connect 23 0 43 0;
#P connect 23 0 51 0;
#P connect 25 0 24 0;
#P connect 28 0 24 0;
#P connect 50 0 6 0;
#P connect 49 0 50 0;
#P connect 48 0 49 0;
#P connect 47 0 48 0;
#P connect 46 0 47 0;
#P connect 21 0 5 0;
#P connect 45 0 21 0;
#P connect 7 0 23 0;
#P connect 7 0 44 0;
#P connect 20 0 19 0;
#P connect 18 0 17 0;
#P connect 33 0 25 0;
#P connect 16 0 15 0;
#P connect 14 0 13 0;
#P fasten 10 1 11 0 432 403 402 403;
#P fasten 31 0 8 0 344 427 385 427;
#P fasten 11 0 8 0 402 426 385 426;
#P fasten 13 0 8 0 507 426 385 426;
#P fasten 15 0 8 0 600 426 385 426;
#P fasten 17 0 8 0 692 426 385 426;
#P fasten 19 0 8 0 794 426 385 426;
#P fasten 39 0 8 0 270 396 385 396;
#P fasten 41 0 8 0 258 396 385 396;
#P fasten 36 0 23 0 334 222 385 222;
#P connect 35 0 7 0;
#P connect 34 0 7 0;
#P connect 42 0 7 0;
#P connect 4 2 29 0;
#P fasten 3 1 4 1 54 190 172 190;
#P connect 4 1 30 0;
#P connect 4 0 32 0;
#P connect 27 0 4 0;
#P connect 26 0 27 0;
#P connect 38 0 26 0;
#P connect 5 0 12 0;
#P fasten 22 0 5 0 54 515 30 515;
#P connect 3 0 5 0;
#P fasten 3 2 5 0 78 326 30 326;
#P connect 2 0 3 0;
#P connect 9 0 2 0;
#P window clipboard copycount 54;


April 2, 2006 | 12:36 am

Ah, Wesley, thanks. For some reason I hadn’t thought of manually
packing/unpacking the normal array from the model output. Thanks –
that makes total sense.

I humbly submit a request to have jit.gl.mesh take the normals from
the 8 or 13 plane matrix that would ‘normally’ (no pun intended) come
out of any gl object with matrixoutput 1 enabled. perhaps it would
only be overridden if one manually entered a textcordinate array or
normals array to the proper input.

Ive shunted in your version wes to my main patch and it works fine.
Thanks.

as for jit.gl.sketch.. anyone? Ive tried playing with the syntax
drawmatrix triangles 0 0 0 0 or 0 0 2 2 etc etc, with no luck.

any idea about jit.gl.sketch anyone?

v a d e //

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

I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I
LIVE! I LIVE! I LIVE! I LIVE!

You will not be saved by the Holy Ghost. You will not be saved by the
God Plutonium.

In fact, YOU WILL NOT BE SAVED!


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