Forums > Jitter

@capture mesh distance clipping

June 28, 2006 | 12:50 pm

Alright everybody:

I’m using the @capture command to render a gl.mesh object and a gl.sketch object to separate textures, which I’m then combining with a shader on a video slab. This works great, and gives me all the control I want, but it seems that when an object’s position goes beyond -1 to 1 in the z-axis (perhaps all axes, i’m not sure) it disappears. Is there a way to define near_clip and far_clip when capturing straight to texture? Any other ideas about why this is happening?

If this has been answered before, forgive me. The only computer I have access to is a pretty hack old PC in a hotel lobby in serbia, so crawling through newsgroups is like watching dead grass not grow.

Thanks much,
Charlie


June 28, 2006 | 1:07 pm

I think this might be a depth_enable issue. make sure that you render
with automatic 0 for strict and that the videoplane or geometry you
are rendering to has depth_enable set to 0, otherwise the objects you
render are ‘infront’ of the captured texture and might pull through
and not show up properly?

*shot in the dark*

v a d e //

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


June 28, 2006 | 1:09 pm

I’ve never seen that problem before. I’m guessing that it’s not going
to be easy for you to provide an example patch? The near_clip and
far_clip are taken from jit.gl.render’s settings, so that shouldn’t be
an issue. The idea of capture is that it renders to texture exactly
what you would get if you didn’t capture. You might be able to try
using a different backend for capture. There are 3 choices

;
jitter glreadback fbo

;
jitter glreadback rtt

;
jitter glreadback ctt

fbo works well in the new beta of jitter, but is a bit slower than
rtt. However rtt has some issues that will be addressed in a future
version. If you’re on windows, I have no idea about these things
except that ctt is the current default. To use the above, send a
message to jitter via a message ";jitter glreadback fbo" etc. I was
unable to reproduce your problems on OSX with the latest beta release.
Hope this helps.

wes

On 6/28/06, Charlie wrote:
>
> Alright everybody:
>
> I’m using the @capture command to render a gl.mesh object and a gl.sketch object to separate textures, which I’m then combining with a shader on a video slab. This works great, and gives me all the control I want, but it seems that when an object’s position goes beyond -1 to 1 in the z-axis (perhaps all axes, i’m not sure) it disappears. Is there a way to define near_clip and far_clip when capturing straight to texture? Any other ideas about why this is happening?
>
> If this has been answered before, forgive me. The only computer I have access to is a pretty hack old PC in a hotel lobby in serbia, so crawling through newsgroups is like watching dead grass not grow.
>
> Thanks much,
> Charlie
>


June 28, 2006 | 1:11 pm

On 6/28/06, vade wrote:
>
> I think this might be a depth_enable issue. make sure that you render with
> automatic 0 for strict and that the videoplane or geometry you are rendering
> to has depth_enable set to 0, otherwise the objects you render are ‘infront’
> of the captured texture and might pull through and not show up properly?
>
> *shot in the dark*
>

This sounds like a good guess to me…that the videoplane is clipping the mesh.

wes


June 28, 2006 | 3:39 pm

Thanks for your quick replies, guys. I managed to hijack internet with my powerbook, so i can attach the example i was using. The behavior I’m seeing happens in the Scene Process example in Jitter Recipes Book 2, recipe 21. If you drop a [pak position 0. 0. 0.] onto the mesh, or just hold ALT down and use the jit.handle that’s already on it, moving it along the z-axis makes it disappears pretty quick. I’ve tried the depth_enable things, but didn’t have any luck. Also, I tried those different glreadback messages, but to no avail.

I’m going to download the beta now, but this is for a production that’s happening in about a week and a half. How stable is the beta?

Thanks again, let me know if you come up with anything, or if the same problem happens for you in this patch. I confirmed it on a G5 desktop as well.

-Charlie

—–BEGIN PATCH—-

max v2;
#N vpatcher 33 388 1173 794;
#P origin -76 0;
#P setbglock 1;
#P window setfont "Sans Serif" 9.;
#P flonum 388 189 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 324 229 99 196617 pak position 0. 0. 0.;
#P window linecount 4;
#P comment 541 335 371 196617 This patch demonstrates a technique for doing matrix-style processing on an openGL scene without reading back to the CPU. This allows you to add a variety of processing effects to your live OpenGL patch without encountering much loss of frame rate. Another incentive to look at those shaders…;
#P window linecount 1;
#P comment 951 348 169 196617 andrewb@cycling74.com;
#P comment 789 279 80 196617 scale_bias filter;
#P comment 609 179 132 196617 dodge composite (feedback);
#P comment 702 233 64 196617 gaussian blur;
#P comment 601 79 201 196617 this is our render destination for the nurbs;
#P user jit.fpsgui 34 351 60 196617 0;
#P flonum 624 113 42 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 624 133 88 196617 param amount $1;
#P newex 120 116 56 196617 qlim 1000;
#P newex 120 137 124 196617 jit.matrix 3 float32 10 5;
#P message 1053 155 43 196617 $1 400;
#P newex 1053 174 40 196617 line 0.;
#P newex 1053 136 41 196617 * 0.03;
#P newex 1053 116 64 196617 random 100;
#P message 988 155 43 196617 $1 400;
#P newex 988 174 40 196617 line 0.;
#P newex 988 136 41 196617 * 0.03;
#P newex 988 116 64 196617 random 100;
#P message 923 155 43 196617 $1 400;
#P newex 923 174 40 196617 line 0.;
#P newex 923 136 41 196617 * 0.03;
#P newex 923 116 64 196617 random 100;
#P message 814 154 43 196617 $1 400;
#P newex 814 172 40 196617 line 0.;
#P newex 833 69 50 196617 qlim 500;
#P hidden newex 491 15 48 196617 loadbang;
#P hidden message 491 35 14 196617 0;
#P toggle 541 14 47 0;
#P newex 541 107 27 196617 + 1;
#P newex 541 135 38 196617 gate 2;
#P flonum 1005 210 38 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 966 210 38 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 923 210 42 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 922 231 135 196617 pak param scale 1. 1. 1.;
#P newex 569 260 300 196617 jit.gl.slab cracks @file cc.scalebias.jxs @dim 320 240 @adapt 0;
#P newex 569 160 171 196617 jit.gl.slab cracks @file co.dodge.jxs;
#P newex 814 94 29 196617 gate;
#P number 63 237 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 63 257 56 196617 dim $1 $1;
#P newex 120 198 177 196617 jit.matrix 3 float32 20 20 @interp 1;
#P newex 120 217 184 196617 jit.slide @slide_up 50 @slide_down 50;
#P newex 814 135 103 196617 expr $i1*0.02-0.01;
#P newex 814 115 64 196617 random 200;
#P message 813 195 81 196617 param width $1;
#P newex 569 288 203 196617 jit.gl.videoplane cracks @scale 1.333 1. 1.;
#P newex 569 214 197 196617 jit.gl.slab cracks @file cf.gaussian.2p.jxs;
#P newex 569 92 233 196617 jit.gl.texture cracks @name super @dim 640 480;
#P newex 236 256 271 196617 jit.gl.handle cracks @inherit_transform 1 @auto_rotate 1;
#P message 236 237 34 196617 reset;
#P newex 120 237 115 196617 jit.dimmap @invert 1 1;
#P newex 120 257 91 196617 prepend ctlmatrix;
#P window linecount 2;
#P newex 120 284 311 196617 jit.gl.nurbs cracks @color 0.8 0.7 0.3 0.6 @capture super @rotate 20. 60. 0. 0. @blend_enable 1 @poly_mode 1 0 @lighting_enable 1;
#P window linecount 1;
#P newex 34 45 74 196617 t erase b b b b;
#P newex 34 330 229 196617 jit.gl.render cracks @erase_color 0.2 0.1 0.1 1.;
#P window linecount 2;
#P newex 120 159 226 196617 jit.expr @expr "jit.noise()*0.5-0.5+snorm[0]" "jit.noise()*4.-2." "snorm[1]" @cache 0;
#P window linecount 1;
#P newex 86 25 162 196617 jit.window cracks @size 640 480;
#P toggle 4 25 29 0;
#P newex 34 25 51 196617 qmetro 5;
#P window linecount 3;
#P comment 589 19 57 196617 turn on/off slab processing;
#P window setfont "Sans Serif" 24.;
#P window linecount 1;
#P comment 950 320 169 196632 SceneProcess;
#P user panel 0 0 538 389;
#X brgb 150 218 112;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P background;
#P user panel 537 0 587 389;
#X brgb 255 250 224;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P background;
#P hidden connect 5 0 4 0;
#P connect 4 0 9 0;
#P fasten 9 1 8 0 55 196 39 196;
#P connect 9 0 8 0;
#P connect 8 0 56 0;
#P connect 24 0 23 0;
#P fasten 9 2 53 0 71 111 125 111;
#P connect 53 0 52 0;
#P connect 52 0 7 0;
#P fasten 9 2 22 0 71 191 125 191;
#P connect 7 0 22 0;
#P connect 22 0 21 0;
#P connect 21 0 12 0;
#P connect 12 0 11 0;
#P connect 63 0 10 0;
#P connect 11 0 10 0;
#P fasten 23 0 10 0 68 277 125 277;
#P connect 14 0 10 0;
#P connect 13 0 14 0;
#P connect 64 0 63 3;
#P hidden connect 36 0 35 0;
#P connect 34 0 33 0;
#P hidden fasten 35 0 33 0 496 104 546 104;
#P connect 33 0 32 0;
#P fasten 9 3 15 0 87 81 574 81;
#P connect 15 0 32 1;
#P fasten 54 0 26 0 629 155 574 155;
#P connect 32 1 26 0;
#P connect 26 0 16 0;
#P fasten 18 0 16 0 818 210 574 210;
#P fasten 28 0 27 0 927 255 574 255;
#P connect 16 0 27 0;
#P connect 27 0 17 0;
#P fasten 32 0 17 0 546 281 574 281;
#P connect 55 0 54 0;
#P fasten 27 0 26 1 574 281 561 281 561 155 735 155;
#P connect 38 0 18 0;
#P fasten 34 0 25 0 546 65 819 65;
#P connect 25 0 19 0;
#P connect 19 0 20 0;
#P connect 20 0 39 0;
#P connect 39 0 38 0;
#P hidden fasten 9 4 37 0 103 65 838 65;
#P connect 37 0 25 1;
#P fasten 25 0 40 0 819 112 928 112;
#P connect 40 0 41 0;
#P connect 41 0 43 0;
#P connect 43 0 42 0;
#P connect 42 0 29 0;
#P connect 46 0 30 0;
#P fasten 29 0 28 2 928 227 989 227;
#P fasten 25 0 44 0 822 112 993 112;
#P connect 44 0 45 0;
#P connect 45 0 47 0;
#P connect 47 0 46 0;
#P connect 50 0 31 0;
#P fasten 30 0 28 3 971 227 1020 227;
#P fasten 31 0 28 4 1010 227 1051 227;
#P fasten 25 0 48 0 820 112 1058 112;
#P connect 48 0 49 0;
#P connect 49 0 51 0;
#P connect 51 0 50 0;
#P pop;


June 28, 2006 | 4:02 pm

Hi Charlie,
The mesh object is being clipped by the jit.gl.videoplane that is used
to display the geometry. To prevent this, you will need to turn off
@automatic on jit.gl.mesh and jit.gl.videoplane and impose a strict
rendering order.

The order will be something like
1. bang geometry matrix above jit.gl.mesh
2. bang jit.gl.mesh
3. bang destination texture
4. bang jit.gl.videoplane

FWIW, the beta does solve several issues with capturing to textures, and
appears to be very stable. If you are serious about OpenGL stuff, I
highly recommend checking out the jitter 1.6 public beta. It includes
several very handy new features like @layer and @transform_reset. Also,
the Max/jitter beta will install as a completely self-contained folder,
so you can keep the older version around without trouble.

Cheers,
Andrew B.


June 28, 2006 | 4:05 pm

the beta is actually remarkably stable, save for the jit.gl.imageunit
external. Im using it, but just make sure to NOT resize your
destination window.

Im not seeing that behavior on the patch you posted BTW, moving the z
axis for the mesh will render just fine regardless – Max OS X 10.4.6
jitter 1.6. Maybe its a 1.6 fix? I didnt try with 4.5.7 and Jitter
1.5.3..

v a d e //

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

On Jun 28, 2006, at 11:39 AM, Charlie wrote:

Thanks for your quick replies, guys. I managed to hijack internet
with my powerbook, so i can attach the example i was using. The
behavior I’m seeing happens in the Scene Process example in Jitter
Recipes Book 2, recipe 21. If you drop a [pak position 0. 0. 0.]
onto the mesh, or just hold ALT down and use the jit.handle that’s
already on it, moving it along the z-axis makes it disappears pretty
quick. I’ve tried the depth_enable things, but didn’t have any
luck. Also, I tried those different glreadback messages, but to no
avail.

I’m going to download the beta now, but this is for a production
that’s happening in about a week and a half. How stable is the beta?

Thanks again, let me know if you come up with anything, or if the
same problem happens for you in this patch. I confirmed it on a G5
desktop as well.

-Charlie


July 4, 2006 | 9:06 am

Sorry for vanishing for a bit, but I tried your suggestions and I’m still having the same issue. I’ve attached a much simpler patch that illustrates my problem. It may be fixed in the upcoming version of Jitter, but I have to use SoftVNS and a couple other objects that have been giving me trouble in the beta version.

In this patch, move the sphere along the z-axis, and you’ll see that it is only rendering objects that are between -1. and 1. Also, there doesn’t appear to actually be any z-axis movement, it simply clips itself off. I’m almost sure that the rendering order is correct.

I know that this is probably a problem that’s going to be (or already is) fixed in the coming release, but I’m sure that it’s not working in the current stable version of max. Could you open this in the max 4.5.6 / jit 1.5 and confirm this behavior (i’ve tried it on a couple machines). Any ideas?

Also vade: I experienced the same behavior in the patch you posted a couple days ago regarding capturing to texture. Add a [pak position] to the jit.gl.model and you can’t move it along the z-axis it just remains stationary until it is clipped all together.

Thanks for your patience guys, but I’m positive this isn’t working in jit 1.5, and I’ve had trouble with 1.6. If you get a chance, try the patch below.

-Charlie

max v2;
#N vpatcher 343 355 941 785;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 260 97 88 196617 jit.gl.handle tesla;
#P window setfont "Sans Serif" 18.;
#P flonum 245 42 69 18 -2. 2. 3 3 0 0 0 74 156 97 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 158 97 99 196617 pak position 0. 0. 0.;
#P newex 157 190 269 196617 jit.gl.texture @automatic 0 @name sphere @dim 720 480;
#P newex 158 152 407 196617 jit.gl.gridshape tesla @automatic 0 @capture sphere @lighting_enable 1 @poly_mode 1 1;
#P newex 26 111 74 196617 t erase b b b b;
#P newex 157 247 253 196617 jit.gl.videoplane tesla @automatic 0 @scale 1. 1. 300.;
#P message 44 355 68 196617 fullscreen $1;
#P toggle 25 355 15 0;
#P newex 67 330 35 196617 sel 27;
#P newex 25 330 40 196617 key;
#P newex 44 374 185 196617 jit.window tesla @rect 40 40 770 520;
#P newex 157 276 311 196617 jit.gl.render tesla @ortho 0 @erase_color 0. 0. 0. 1. @automatic 0;
#P toggle 26 32 41 0;
#P newex 26 81 52 196617 metro 33;
#P comment 316 44 100 196617 < - zpos of sphere;
#P fasten 6 0 7 0 72 352 30 352;
#P connect 2 0 1 0;
#P connect 1 0 10 0;
#P fasten 7 0 8 0 41 370 41 355;
#P connect 8 0 4 0;
#P fasten 5 0 6 0 66 347 66 332;
#P fasten 10 4 12 0 95 185 162 185;
#P connect 12 0 9 0;
#P fasten 10 2 9 0 63 238 162 238;
#P fasten 10 1 3 0 47 270 162 270;
#P fasten 10 0 3 0 31 270 162 270;
#P connect 13 0 11 0;
#P fasten 15 0 11 0 265 130 163 130;
#P fasten 10 3 11 0 79 140 163 140;
#P connect 14 0 13 3;
#P pop;


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