special fx on rendered images

Aug 15, 2006 at 9:24pm

special fx on rendered images

hello. how would i go about applying special effects (blurring, etc.) on rendered images? say i had a 3d cube moving around and i wanted to have a motion trail show behind it. how would i do that? is it even possible? thanks.

#27173
Aug 15, 2006 at 9:32pm

definitely possible.

you can do it do ways. use capture to render the geometry to a single
texture, or use render to texture to render the whole scene to a
texture, and then apply slab processing to the texture, and then
display the texture on the screen.

you’ll have to be familiar with working with openGL with automatic 0
mode (so you can specify render order), but people are doing it now.

v a d e //

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

On Aug 15, 2006, at 5:24 PM, harlan wrote:

>
> hello. how would i go about applying special effects (blurring,
> etc.) on rendered images? say i had a 3d cube moving around and i
> wanted to have a motion trail show behind it. how would i do that?
> is it even possible? thanks.

#82004
Aug 15, 2006 at 10:02pm

how exactly would i go about the capture method? it sounds like what im looking for but im still a bit lost.

#82005
Aug 15, 2006 at 10:41pm

Try this patch.

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 658 358 158 196617 blend_mode 6 7 , color 1. 1. 1. 1.;
#P message 490 359 164 196617 blend_mode 6 1 , color 1. 1. 1. 0.5;
#P message 543 164 80 196617 blend_mode 6 1;
#P message 71 336 124 196617 erase_color 0. 0. 0. 0.01;
#P message 448 164 87 196617 color 1. 0. 0. 0.7;
#P message 378 164 58 196617 tex_map 2;
#P message 254 290 43 196617 dispose;
#P user jit.fpsgui 41 384 60 196617 0;
#P flonum 549 284 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 549 310 80 196617 param phase $1;
#P flonum 719 282 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 677 282 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 635 309 111 196617 pak param center 0. 0.;
#P flonum 769 282 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 474 284 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 474 310 73 196617 param amp $1;
#P message 769 310 78 196617 param damp $1;
#P flonum 392 284 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 392 310 75 196617 param freq $1;
#P message 261 310 95 196617 read td.sinefold.jxs;
#P message 411 86 34 196617 reset;
#P newex 411 118 325 196617 jit.gl.handle capture @visible 0
@inherit_transform 0 @auto_rotate 1;
#P newex 73 149 223 196617 t b b b b;
#P toggle 41 50 15 0;
#P newex 41 79 51 196617 qmetro 2;
#P newex 41 110 58 196617 t b b erase;
#P newex 41 362 102 196617 jit.gl.render capture;
#P window linecount 2;
#P newex 286 194 350 196617 jit.gl.plato capture @lighting_enable 1
@depth_enable 1 @smooth_shading 1 @blend_enable 1 @capture
capture_destination @automatic 0 @shape cube;
#P newex 242 379 226 196617 jit.gl.videoplane capture @scale 1.3333
1. 1. @automatic 0 @depth_enable 0 @blend_enable 1;
#P window linecount 1;
#P newex 242 340 154 196617 jit.gl.slab capture @automatic 0;
#P newex 242 249 340 196617 jit.gl.texture capture @name
capture_destination @automatic 0 @adapt 1;
#P newex 162 435 167 196617 jit.window capture @depthbuffer 1;
#P connect 8 0 7 0;
#P connect 7 0 6 0;
#P connect 28 0 5 0;
#P connect 6 0 5 0;
#P connect 6 2 5 0;
#P connect 5 0 24 0;
#P connect 6 1 9 0;
#P connect 9 2 1 0;
#P connect 1 0 2 0;
#P fasten 25 0 2 0 259 322 247 322;
#P fasten 15 0 2 0 774 332 247 332;
#P fasten 19 0 2 0 640 332 247 332;
#P fasten 16 0 2 0 479 332 247 332;
#P fasten 13 0 2 0 397 332 247 332;
#P fasten 12 0 2 0 266 332 247 332;
#P connect 9 1 2 0;
#P connect 30 0 3 0;
#P connect 9 0 3 0;
#P connect 2 0 3 0;
#P connect 31 0 3 0;
#P connect 29 0 4 0;
#P connect 27 0 4 0;
#P connect 26 0 4 0;
#P connect 9 3 4 0;
#P connect 10 0 4 0;
#P connect 14 0 13 0;
#P connect 11 0 10 0;
#P connect 17 0 16 0;
#P connect 23 0 22 0;
#P connect 20 0 19 2;
#P connect 21 0 19 3;
#P connect 18 0 15 0;
#P window clipboard copycount 32;

v a d e //

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

On Aug 15, 2006, at 6:02 PM, harlan wrote:

>
> how exactly would i go about the capture method? it sounds like
> what im looking for but im still a bit lost.

#82006
Aug 16, 2006 at 11:03am

Quote: vade wrote on Tue, 15 August 2006 15:32
—————————————————-
you can do it do ways. use capture to render the geometry to a single texture, or use render to texture to render the whole scene to a texture, and then apply slab processing to the texture, and then display the texture on the screen.
—————————————————-

Vade, I’m having the same need. I’ve tried the capture to texture method in the past, but that works for a single GL object. I need to capture 8 of them to process them in a slab chain. Does the second technique (render to texture) work entirely on the GPU? I don’t want to loose performance by capturing to a matrix on the CPU. Is that technique related to pbuffers or FBO (FrameBuffer Object)? I’m not using Jitter 1.6 yet (Windows)and it seems these teqhniques only works in that version… what are my options?

Thanks in advance.

#82007
Aug 16, 2006 at 1:24pm

you can render the entire scene as a texture, which will work with
any objects in the GL world:

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 268 345 85 196617 read cf.sobel.jxs;
#P newex 220 369 77 196617 jit.gl.slab vade;
#P window linecount 2;
#P newex 262 142 344 196617 jit.gl.gridshape vade @shape sphere
@automatic 0 @lighting_enable 1 @depth_enable 1 @smooth_shading 1
@blend_enable 1 @position 0.8 0.8 0;
#P window linecount 1;
#P message 265 182 34 196617 reset;
#P user jit.fpsgui 55 464 60 196617 0;
#P flonum 1281 287 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 265 200 189 196617 jit.gl.handle vade @inherit_transform 1;
#P window linecount 2;
#P newex 248 235 303 196617 jit.gl.gridshape vade @shape cube
@automatic 0 @lighting_enable 1 @depth_enable 1 @smooth_shading 1
@blend_enable 1;
#P window linecount 1;
#P message 234 275 146 196617 usetexture target , to_texture;
#P newex 206 118 66 196617 t b b b b b;
#P newex 206 406 266 196617 jit.gl.videoplane vade @automatic 0
@transform_reset 2;
#P newex 220 317 202 196617 jit.gl.texture vade @name target @adapt 1;
#P toggle 54 44 15 0;
#P newex 54 64 51 196617 qmetro 2;
#P newex 54 85 58 196617 t b b erase;
#P newex 147 440 82 196617 jit.window vade;
#P newex 55 440 89 196617 jit.gl.render vade;
#P connect 16 0 15 0;
#P connect 15 0 6 0;
#P connect 5 0 15 0;
#P connect 7 4 14 0;
#P connect 2 1 7 0;
#P connect 7 1 5 0;
#P connect 7 2 8 0;
#P connect 7 3 9 0;
#P connect 7 0 6 0;
#P connect 10 0 9 0;
#P connect 13 0 10 0;
#P connect 8 0 0 0;
#P connect 2 2 0 0;
#P connect 2 0 0 0;
#P connect 3 0 2 0;
#P connect 4 0 3 0;
#P connect 0 0 12 0;
#P window clipboard copycount 17;

v a d e //

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

On Aug 16, 2006, at 7:03 AM, Pedro Santos wrote:

>
> Quote: vade wrote on Tue, 15 August 2006 15:32
> —————————————————-
> you can do it do ways. use capture to render the geometry to a
> single texture, or use render to texture to render the whole scene
> to a texture, and then apply slab processing to the texture, and
> then display the texture on the screen.
> —————————————————-
>
> Vade, I’m having the same need. I’ve tried the capture to texture
> method in the past, but that works for a single GL object. I need
> to capture 8 of them. Does the second technique (render to texture)
> work entirely on the GPU? I don’t want to loose performance by
> capturing to a matrix on the CPU. Is that teqhnique related to
> pbuffers or FBO (FrameBuffer Object)? I’m not using Jitter 1.6 yet
> (Windows)and it seems these teqhniques only works in that
> version… what are my options?
>
> Thanks in advance.
>

#82008
Aug 16, 2006 at 4:28pm

Thanks for the quick response, Vade.

Unfortunately, your patch gives me the following error:
jit.gl.texture: error doing screen grab!: GL error: Invalid value

In my previous post, I mentioned that I’m not using Jitter 1.6, only 1.5.2, as I’m trying this on a Windows machine. Is that the problem? If it is, is there a workaraound for this?

#82009
Aug 16, 2006 at 4:55pm

Ah, that would be it. I believe this is a 1.6 feature.

However, set the dim size of the window, and of the texture to be the
same, and then re-open the patch. perhaps that fixes it.

v a d e //

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

On Aug 16, 2006, at 12:28 PM, Pedro Santos wrote:

>
> Thanks for the quick response, Vade.
>
> Unfortunately, your patch gives me the following error:
> jit.gl.texture: error doing screen grab!: GL error: Invalid value
>
> In my previous post, I mentioned that I’m not using Jitter 1.6,
> only 1.5.2, as I’m trying this on a Windows machine. Is that the
> problem? If it is, is there a workaraound for this?

#82010
Aug 16, 2006 at 4:56pm

for a quick and easy example of how to do this using Jitter 1.5.2, check
out the Jitter Recipe 24: GLFeedback

http://www.cycling74.com/story/2006/2/14/161736/108

You might also have a look at the SceneProcess recipe as well.
You will need to make sure that your texture that you render to is the
same size as your context window.

Cheers,
Andrew B.

#82011
Aug 16, 2006 at 5:05pm

On Aug 16, 2006, at 9:28 AM, Pedro Santos wrote:

>
> In my previous post, I mentioned that I’m not using Jitter 1.6,
> only 1.5.2, as I’m trying this on a Windows machine. Is that the
> problem? If it is, is there a workaraound for this?

In Jitter 1.6, there were several fixes both to capture and
jit.gl.render’s to_texture method (which I find easier to use,
myself. it just copies the contents of the framebuffer to a texture).
It works in 1.5.2, but requires very special circumstances and
scripting techniques to instantiate new instances of jit.gl.texture
if the window size changes. This is no longer necessary in 1.6.

FWIW, we hope to have Jitter 1.6 for windows ready within the next
couple of weeks.

-Joshua

#82012
Aug 16, 2006 at 8:23pm

Thank you all very much for your responses. I’ve been trying the example patches mentioned above to figure out how to correctly use the to_texture method. I understand that the destination jit.gl.texture has to have the same dimensions of the window being captured. As I want to display the final patch in fullscreen (say, 1024*768 or above) and process the captured texture with a series of slab objects, I guess it would be better in terms of performance if I could downsize the texture before sending it to the slab chain. Is this possible at all? A jit.gl.texture sending the texture to another jit.gl.texture with different dimensions? I hope it makes sense to you.

Another method I will try is the capture to a jit.gl.texture method for each of the 8 objects, resulting in 8 textures. Then, with “jit.slab op.add.jxs” or other math operation join all the textures into one. The problem is that to join 8 textures I need 7 slabs, as the shader only mixes two textures. I’ll try it and report back, for your information.

#82013
Aug 16, 2006 at 8:30pm

To resize a texture like that you could render it to texture via
jit.gl.videoplane @capture small_texture and then send small_texture
through some slabs.

wes

On 8/16/06, Pedro Santos

wrote:
>
> Thank you all very much for your responses. I’ve been trying the example patches mentioned above to figure out how to correctly use the to_texture method. I understand that the destination jit.gl.texture has to have the same dimensions of the window being captured. As I want to display the final patch in fullscreen (say, 1024*768 or above) and process the captured texture with a series of slab objects, I guess it would be better in terms of performance if I could downsize the texture before sending it to the slab chain. Is this possible at all? A jit.gl.texture sending the texture to another jit.gl.texture with different dimensions? I hope it makes sense to you.
>
> Another method I will try is the capture to a jit.gl.texture method for each of the 8 objects, resulting in 8 textures. Then, with “jit.slab op.add.jxs” or other math operation join all the textures into one. The problem is that to join 8 textures I need 7 slabs, as the shader only mixes two textures. I’ll try it and report back, for your information.
>

#82014
Aug 16, 2006 at 9:04pm

On Aug 16, 2006, at 1:23 PM, Pedro Santos wrote:

>
> Thank you all very much for your responses. I’ve been trying the
> example patches mentioned above to figure out how to correctly use
> the to_texture method. I understand that the destination
> jit.gl.texture has to have the same dimensions of the window being
> captured. As I want to display the final patch in fullscreen (say,
> 1024*768 or above) and process the captured texture with a series
> of slab objects, I guess it would be better in terms of performance
> if I could downsize the texture before sending it to the slab
> chain. Is this possible at all? A jit.gl.texture sending the
> texture to another jit.gl.texture with different dimensions? I hope
> it makes sense to you.

You can resize textures through jit.gl.slab @adapt 0 @dim .
You might want to send it through a blur operation when downsampling
if you want it to look smoother.

> Another method I will try is the capture to a jit.gl.texture method
> for each of the 8 objects, resulting in 8 textures. Then, with
> “jit.slab op.add.jxs” or other math operation join all the textures
> into one. The problem is that to join 8 textures I need 7 slabs, as
> the shader only mixes two textures. I’ll try it and report back,
> for your information.

You can always make an 8 input slab object. Just check out the
example slab tutorial in the manual which shows how to make a 4 input
mixer. Easy to extend to 8 inputs.

-Joshua

#82015
Aug 16, 2006 at 9:59pm

On Aug 16, 2006, at 2:04 PM, Joshua Kit Clayton wrote:

>
> You can always make an 8 input slab object. Just check out the
> example slab tutorial in the manual which shows how to make a 4
> input mixer. Easy to extend to 8 inputs.

Sorry. Neglected to mention that this requires that your GPU and
driver supports 8 or more texture units to work. Should be fine with
Radeon 9600 or higher on the ATI side. However, for NVidia cards, it
might also depend on the driver, and what it reports for
GL_MAX_TEXTURE_UNITS. I’ve read that while the NVidia HW only reports
4 texture units in response to querying GL_MAX_TEXTURE_UNITS, newer
HW has 8-16 texture units available for the programmable shader
pipeline (but only 4 for the fixed pipeline). Currently we limit this
number based on GL_MAX_TEXTURE_UNITS or 8 (whichever is fewer). We
can investigate exposing up to 8 for these NVidia cards for the
programmable pipeline in the future.

-Joshua

#82016
Aug 17, 2006 at 3:06am

Thank you very much for your explanations.
I guess the downsizing of the to_texture method is probably best. It’s great that jit.gl.slab can do that.

The other workaround (capturing each objects to individual textures and mixing them thru jit.slabs), altough I’ve tested it and it works, it seems a little cumbersome and doesn’t scale well if I need to include more objects. Besides, if the z order of the objects in the scene is important, I simply couldn’t use that method.

Thanks everyone.

#82017

You must be logged in to reply to this topic.