Forums > Jitter

grain/noise on openGL scene

May 21, 2007 | 10:27 pm

Hello,

I would like to ad the effect of grain/noise on an openGL scene. Is
there a way, and if so which, to achieve this?

regards,

brecht.


May 21, 2007 | 10:34 pm

Try using some kind of noise effect to modulate the luminance of the
final opengl image by capturing it to a texture and adding noise with
a slab object. You could do this procedurally with some noise
function or otherwise by creating a short loop of noise from source
footage or an animation program.

HTH,
wes

On 5/21/07, Brecht Debackere wrote:
> Hello,
>
> I would like to ad the effect of grain/noise on an openGL scene. Is
> there a way, and if so which, to achieve this?
>
> regards,
>
> brecht.
>
>


May 22, 2007 | 12:49 pm

Quote: Brecht wrote on Tue, 22 May 2007 00:27
—————————————————-
> Hello,
>
> I would like to ad the effect of grain/noise on an openGL scene. Is
> there a way, and if so which, to achieve this?
>
> regards,
>
> brecht.
>
>
—————————————————-

You could try to place a plane with the noise in front of the camera and try different blend modes.

Mattijs


May 22, 2007 | 2:44 pm

yeah, that wiuld be easier wouldn’t it :] I’ve got my head in shader land!

wes

On 5/22/07, Mattijs Kneppers wrote:
>
> Quote: Brecht wrote on Tue, 22 May 2007 00:27
> —————————————————-
> > Hello,
> >
> > I would like to ad the effect of grain/noise on an openGL scene. Is
> > there a way, and if so which, to achieve this?
> >
> > regards,
> >
> > brecht.
> >
> >
> —————————————————-
>
> You could try to place a plane with the noise in front of the camera and try different blend modes.
>
> Mattijs
> –
> SmadSteck – http://www.smadsteck.nl
> Hard- and software for interactive audiovisual sampling
>


May 22, 2007 | 5:55 pm

I would rather mix it with shaders/slabs, while noise part would be
some kind of feedback process so that ‘sprinkles’ would have some
time to come to and out of existance, like (hopefully) in the example
pasted below.

-nesa

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 208 89 884 680;
#P window setfont "Sans Serif" 9.;
#P flonum 93 449 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 0;
#P message 92 470 79 196617 param alpha $1;
#P newex 50 497 280 196617 jit.gl.slab fluffy @file
cc.contrast.ip.jxs @param alpha 4.82;
#P flonum 266 64 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 266 109 81 196617 param width $1;
#P flonum 73 274 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 73 296 81 196617 param width $1;
#P newex 50 325 257 196617 jit.gl.slab fluffy @file cf.dilate.jxs
@param width 0.58;
#P window linecount 2;
#P newex 50 149 174 196617 jit.gl.slab fluffy @file cf.emboss.jxs
@param width 0.17;
#P number 149 78 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 50 99 109 196617 jit.op @op > @val 253;
#P flonum 186 357 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 185 378 74 196617 param bias $1;
#P flonum 97 352 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 247 188 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 247 207 88 196617 param amount $1;
#P newex 50 235 271 196617 jit.gl.slab fluffy @file co.normal.jxs
@param amount 0.95;
#P message 96 373 79 196617 param scale $1;
#P newex 50 50 121 196617 jit.noise 1 char 320 240;
#P newex 50 420 361 196617 jit.gl.slab fluffy @file cc.scalebias.jxs
@param scale 6.77 @param bias -3.61;
#P inlet 50 30 15 0;
#P outlet 50 527 15 0;
#P connect 1 0 3 0;
#P connect 3 0 11 0;
#P connect 17 0 13 0;
#P connect 11 0 13 0;
#P connect 13 0 5 0;
#P connect 6 0 5 0;
#P connect 5 0 14 0;
#P connect 15 0 14 0;
#P connect 14 0 2 0;
#P connect 4 0 2 0;
#P connect 9 0 2 0;
#P connect 20 0 19 0;
#P connect 2 0 19 0;
#P connect 19 0 0 0;
#P connect 16 0 15 0;
#P connect 21 0 20 0;
#P connect 8 0 4 0;
#P connect 12 0 11 1;
#P connect 10 0 9 0;
#P connect 7 0 6 0;
#P connect 18 0 17 0;
#P fasten 14 0 5 1 55 346 392 346 392 229 316 229;
#P pop;
#P newobj 87 145 41 196617 p puffs;
#P user jit.fpsgui 44 261 60 196617 0;
#P newex 87 181 251 196617 jit.gl.videoplane fluffy @transform_reset
2 @layer 1;
#P toggle 174 243 15 0;
#P message 174 271 81 196617 doublebuffer $1;
#P window linecount 2;
#P message 44 298 107 196617 ; jitter glreadback fbo;
#P flonum 91 44 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 44 42 15 0;
#P window linecount 1;
#P newex 44 69 57 196617 qmetro 10;
#P newex 44 238 94 196617 jit.gl.render fluffy;
#P newex 174 295 258 196617 jit.window fluffy @sync 0 @doublebuffer 1
@floating 1;
#P connect 6 0 0 0;
#P connect 4 0 2 1;
#P connect 3 0 2 0;
#P connect 1 0 9 0;
#P connect 7 0 6 0;
#P connect 10 0 8 0;
#P connect 2 0 10 0;
#P connect 2 0 1 0;
#P window clipboard copycount 11;


May 22, 2007 | 7:04 pm

heheh. Yeah… that’s an idea as well… but I haven’t been to
shaderland yet and I’ve the rides are really cool,… so I’m checking
that out.
Why didn’t I think of that :-) cheers for the tips.

b.

On 22 May 2007, at 16:44, Wesley Smith wrote:

> yeah, that wiuld be easier wouldn’t it :] I’ve got my head in
> shader land!
>
> wes
>
> On 5/22/07, Mattijs Kneppers wrote:
>>
>> Quote: Brecht wrote on Tue, 22 May 2007 00:27
>> —————————————————-
>> > Hello,
>> >
>> > I would like to ad the effect of grain/noise on an openGL scene. Is
>> > there a way, and if so which, to achieve this?
>> >
>> > regards,
>> >
>> > brecht.
>> >
>> >
>> —————————————————-
>>
>> You could try to place a plane with the noise in front of the
>> camera and try different blend modes.
>>
>> Mattijs
>> –
>> SmadSteck – http://www.smadsteck.nl
>> Hard- and software for interactive audiovisual sampling
>>


May 22, 2007 | 7:14 pm

Hi Noise Makers,

Here’s a film noise shader I originally made as a render_mode
plugin. It comes with a test patch so one doesn’t need render_node
though.

http://2uptech.com/zip/grain_plugin.zip

It’s actually two shaders: one that generates a pseudo-random frame
of an input texture based on a frame number, and another one that
adds it in a film-noise-like way. Midtones in film noise have more
grain than shadows and highlights. So the shader does a luminance
calculation to decide how much noise to add to a given pixel. This
would be hard and slow or maybe outright impossible to do with just
the built-in GL blend modes.

on the other hand, the shader, while very nice looking, is kind of
slow for full-screen images and so now for live shows I use, guess
what, a plane with noise in front of the camera which gets subtracted
from the scene.

best,
Randy


May 22, 2007 | 7:18 pm

On May 22, 2007, at 10:55 AM, nesa wrote:

> I would rather mix it with shaders/slabs, while noise part would be
> some kind of feedback process so that ‘sprinkles’ would have some
> time to come to and out of existance, like (hopefully) in the
> example pasted below.

Slick, as always Nesa!

Thanks for sharing this great example.

-Joshua


May 22, 2007 | 7:18 pm

Wow… I get some very funky glitchy feedback with your patch running
alongside mine…(on my patches jit.window)
The noise looks good though. I want it a bit less harsch so I’ll see
to implementing jit.slide or smth.
Really wondering what’s causing the feedback

greets,

Brecht.

On 22 May 2007, at 19:55, nesa wrote:

> I would rather mix it with shaders/slabs, while noise part would be
> some kind of feedback process so that ‘sprinkles’ would have some
> time to come to and out of existance, like (hopefully) in the
> example pasted below.
>
> -nesa
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #N vpatcher 208 89 884 680;
> #P window setfont "Sans Serif" 9.;
> #P flonum 93 449 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 0;
> #P message 92 470 79 196617 param alpha $1;
> #P newex 50 497 280 196617 jit.gl.slab fluffy @file
> cc.contrast.ip.jxs @param alpha 4.82;
> #P flonum 266 64 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P message 266 109 81 196617 param width $1;
> #P flonum 73 274 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P message 73 296 81 196617 param width $1;
> #P newex 50 325 257 196617 jit.gl.slab fluffy @file cf.dilate.jxs
> @param width 0.58;
> #P window linecount 2;
> #P newex 50 149 174 196617 jit.gl.slab fluffy @file cf.emboss.jxs
> @param width 0.17;
> #P number 149 78 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 1;
> #P newex 50 99 109 196617 jit.op @op > @val 253;
> #P flonum 186 357 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P message 185 378 74 196617 param bias $1;
> #P flonum 97 352 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P flonum 247 188 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P message 247 207 88 196617 param amount $1;
> #P newex 50 235 271 196617 jit.gl.slab fluffy @file co.normal.jxs
> @param amount 0.95;
> #P message 96 373 79 196617 param scale $1;
> #P newex 50 50 121 196617 jit.noise 1 char 320 240;
> #P newex 50 420 361 196617 jit.gl.slab fluffy @file
> cc.scalebias.jxs @param scale 6.77 @param bias -3.61;
> #P inlet 50 30 15 0;
> #P outlet 50 527 15 0;
> #P connect 1 0 3 0;
> #P connect 3 0 11 0;
> #P connect 17 0 13 0;
> #P connect 11 0 13 0;
> #P connect 13 0 5 0;
> #P connect 6 0 5 0;
> #P connect 5 0 14 0;
> #P connect 15 0 14 0;
> #P connect 14 0 2 0;
> #P connect 4 0 2 0;
> #P connect 9 0 2 0;
> #P connect 20 0 19 0;
> #P connect 2 0 19 0;
> #P connect 19 0 0 0;
> #P connect 16 0 15 0;
> #P connect 21 0 20 0;
> #P connect 8 0 4 0;
> #P connect 12 0 11 1;
> #P connect 10 0 9 0;
> #P connect 7 0 6 0;
> #P connect 18 0 17 0;
> #P fasten 14 0 5 1 55 346 392 346 392 229 316 229;
> #P pop;
> #P newobj 87 145 41 196617 p puffs;
> #P user jit.fpsgui 44 261 60 196617 0;
> #P newex 87 181 251 196617 jit.gl.videoplane fluffy
> @transform_reset 2 @layer 1;
> #P toggle 174 243 15 0;
> #P message 174 271 81 196617 doublebuffer $1;
> #P window linecount 2;
> #P message 44 298 107 196617 ; jitter glreadback fbo;
> #P flonum 91 44 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P toggle 44 42 15 0;
> #P window linecount 1;
> #P newex 44 69 57 196617 qmetro 10;
> #P newex 44 238 94 196617 jit.gl.render fluffy;
> #P newex 174 295 258 196617 jit.window fluffy @sync 0 @doublebuffer
> 1 @floating 1;
> #P connect 6 0 0 0;
> #P connect 4 0 2 1;
> #P connect 3 0 2 0;
> #P connect 1 0 9 0;
> #P connect 7 0 6 0;
> #P connect 10 0 8 0;
> #P connect 2 0 10 0;
> #P connect 2 0 1 0;
> #P window clipboard copycount 11;
>


May 22, 2007 | 7:44 pm

Patch runs pretty smooth on MBP (25fps), with Nesa’s and my patch
running in the back…
Well.. I know what to do tonight!

On 22 May 2007, at 21:14, Randy Jones wrote:

>
> Hi Noise Makers,
>
> Here’s a film noise shader I originally made as a render_mode
> plugin. It comes with a test patch so one doesn’t need render_node
> though.
>
> http://2uptech.com/zip/grain_plugin.zip
>
> It’s actually two shaders: one that generates a pseudo-random frame
> of an input texture based on a frame number, and another one that
> adds it in a film-noise-like way. Midtones in film noise have
> more grain than shadows and highlights. So the shader does a
> luminance calculation to decide how much noise to add to a given
> pixel. This would be hard and slow or maybe outright impossible to
> do with just the built-in GL blend modes.
>
> on the other hand, the shader, while very nice looking, is kind of
> slow for full-screen images and so now for live shows I use, guess
> what, a plane with noise in front of the camera which gets
> subtracted from the scene.
>
> best,
> Randy
>
>


May 22, 2007 | 8:55 pm

Nice stuff all around everyone!

Going to have to come up with a nice custom solution myself and post
it :)

Inspiring!

On May 22, 2007, at 3:44 PM, Brecht Debackere wrote:

> Patch runs pretty smooth on MBP (25fps), with Nesa’s and my patch
> running in the back…
> Well.. I know what to do tonight!
>
> On 22 May 2007, at 21:14, Randy Jones wrote:
>
>>
>> Hi Noise Makers,
>>
>> Here’s a film noise shader I originally made as a render_mode
>> plugin. It comes with a test patch so one doesn’t need
>> render_node though.
>>
>> http://2uptech.com/zip/grain_plugin.zip
>>
>> It’s actually two shaders: one that generates a pseudo-random
>> frame of an input texture based on a frame number, and another one
>> that adds it in a film-noise-like way. Midtones in film noise
>> have more grain than shadows and highlights. So the shader does a
>> luminance calculation to decide how much noise to add to a given
>> pixel. This would be hard and slow or maybe outright impossible
>> to do with just the built-in GL blend modes.
>>
>> on the other hand, the shader, while very nice looking, is kind of
>> slow for full-screen images and so now for live shows I use, guess
>> what, a plane with noise in front of the camera which gets
>> subtracted from the scene.
>>
>> best,
>> Randy
>>
>>
>

v a d e //

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


May 22, 2007 | 10:29 pm

nesa skrev:
> I would rather mix it with shaders/slabs, while noise part would be
> some kind of feedback process so that ‘sprinkles’ would have some time
> to come to and out of existance, like (hopefully) in the example
> pasted below.
>
> -nesa
This looks just right, nesa! Unfortunately it doesn’t work at all on my
machine – I just get a white screen, and when I turn the doublebuffer
on/off I get a snapshot of what the effect looks like on-screen.

Any ideas about what is going on here? It may be an overall slab problem
I am having… I’d better try the release candidate then!

Andreas.


May 22, 2007 | 10:40 pm

there was no erase command to the rendering context, adding one made
it work for me.

On 5/22/07, Andreas Wetterberg wrote:
> nesa skrev:
> > I would rather mix it with shaders/slabs, while noise part would be
> > some kind of feedback process so that ‘sprinkles’ would have some time
> > to come to and out of existance, like (hopefully) in the example
> > pasted below.
> >
> > -nesa
> This looks just right, nesa! Unfortunately it doesn’t work at all on my
> machine – I just get a white screen, and when I turn the doublebuffer
> on/off I get a snapshot of what the effect looks like on-screen.
>
> Any ideas about what is going on here? It may be an overall slab problem
> I am having… I’d better try the release candidate then!
>
> Andreas.
>


May 22, 2007 | 11:30 pm

Super-nice patch Nesa. Very clever use of the included shaders.

AB


May 22, 2007 | 11:59 pm

Doh! Of course.
This was every bit as cool as I thought it would be – totally not movie
noise, but I can make it do some cool smoke emulation, hehe.

Andreas.

yair reshef skrev:
> there was no erase command to the rendering context, adding one made
> it work for me.
>
>
> On 5/22/07, Andreas Wetterberg wrote:
>> nesa skrev:
>> > I would rather mix it with shaders/slabs, while noise part would be
>> > some kind of feedback process so that ‘sprinkles’ would have some time
>> > to come to and out of existance, like (hopefully) in the example
>> > pasted below.
>> >
>> > -nesa
>> This looks just right, nesa! Unfortunately it doesn’t work at all on my
>> machine – I just get a white screen, and when I turn the doublebuffer
>> on/off I get a snapshot of what the effect looks like on-screen.
>>
>> Any ideas about what is going on here? It may be an overall slab problem
>> I am having… I’d better try the release candidate then!
>>
>> Andreas.
>>
>
> .
>


May 23, 2007 | 5:19 pm

Thanks for kudos everyone!

I’ll stuff this message with few replies:

@Yair:

erase shouldn’t be necessary, but I’ve just tried this patch on XP –
and yes – erase does fix things up. XP also seems to miss some
parameters set as attributes for slabs(but I have to re-check this a
bit later, and then re-check with latest jit release).

@Andreas:

- Yep, it’s not a movie noise simulation, it just demonstrates some
aspects of the process. This is how it looks on my machine(1mb mov):

http://www.ruccas.org/pub/nesa/untitled2.mov

Can’t wait to try Randy’ shaders.

Cheers,
nesa


November 6, 2007 | 8:22 pm

hi

trying to get Nesa’s patch for noise working (my patch below). do I just need to plug a metro in at the top and a videoplane in at the bottom or I missing something? All I get is a white videoplane? Thanks in advance.

a+
gar

max v2;
#N vpatcher 466 93 1281 713;
#P origin 0 -17;
#P window setfont "Sans Serif" 9.;
#N vpatcher 370 437 976 1002;
#P window setfont "Sans Serif" 9.;
#P flonum 100 456 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 0;
#P message 99 477 79 196617 param alpha $1;
#P newex 57 504 280 196617 jit.gl.slab fluffy @file cc.contrast.ip.jxs @param alpha 4.82;
#P flonum 273 71 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 273 116 81 196617 param width $1;
#P flonum 80 281 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 80 303 81 196617 param width $1;
#P newex 57 332 257 196617 jit.gl.slab fluffy @file cf.dilate.jxs @param width 0.58;
#P window linecount 2;
#P newex 57 156 174 196617 jit.gl.slab fluffy @file cf.emboss.jxs @param width 0.17;
#P number 156 85 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 57 106 109 196617 jit.op @op > @val 253;
#P flonum 193 364 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 192 385 74 196617 param bias $1;
#P flonum 104 359 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 254 195 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 254 214 88 196617 param amount $1;
#P newex 57 242 271 196617 jit.gl.slab fluffy @file co.normal.jxs @param amount 0.95;
#P message 103 380 79 196617 param scale $1;
#P newex 57 57 121 196617 jit.noise 1 char 320 240;
#P newex 57 427 361 196617 jit.gl.slab fluffy @file cc.scalebias.jxs @param scale 6.77 @param bias -3.61;
#P inlet 57 37 15 0;
#P outlet 57 534 15 0;
#P connect 1 0 3 0;
#P connect 3 0 11 0;
#P connect 17 0 13 0;
#P connect 11 0 13 0;
#P connect 13 0 5 0;
#P connect 6 0 5 0;
#P connect 5 0 14 0;
#P connect 15 0 14 0;
#P connect 14 0 2 0;
#P connect 4 0 2 0;
#P connect 9 0 2 0;
#P connect 20 0 19 0;
#P connect 2 0 19 0;
#P connect 19 0 0 0;
#P connect 16 0 15 0;
#P connect 21 0 20 0;
#P connect 8 0 4 0;
#P connect 12 0 11 1;
#P connect 10 0 9 0;
#P connect 7 0 6 0;
#P connect 18 0 17 0;
#P fasten 14 0 5 1 62 353 399 353 399 236 323 236;
#P pop;
#P newobj 126 116 36 196617 p test;
#P message 210 129 33 196617 reset;
#P newex 173 162 79 196617 jit.gl.handle foo;
#P newex 130 187 185 196617 jit.gl.videoplane foo @scale 1.333 1. 1.;
#P toggle 125 69 15 0;
#P newex 125 88 55 196617 metro 20;
#P user jit.fpsgui 37 295 60 196617 0;
#P number 60 103 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 15 103 15 0;
#P newex 15 129 55 196617 qmetro 20;
#P newex 15 244 55 196617 t b b erase;
#P newex 15 339 80 196617 jit.gl.render foo;
#P newex 58 400 145 196617 jit.window foo @depthbuffer 1;
#P connect 4 0 3 0;
#P connect 3 0 2 0;
#P connect 2 0 1 0;
#P fasten 2 2 1 0 64 277 20 277;
#P connect 2 1 6 0;
#P connect 5 0 3 1;
#P connect 8 0 7 0;
#P connect 7 0 12 0;
#P connect 12 0 9 0;
#P fasten 10 0 9 0 178 183 135 183;
#P fasten 11 0 10 0 215 157 178 157;
#P pop;


November 6, 2007 | 9:27 pm

your slabs are all referencing a context names "fluffy", but your window, videoplane and render are all named "foo".
also, you should set your window attributes to the following.
@sync 0 @doublebuffer 1

i would start over from the original patch and slowly make whatever changes you want to make, and test as you go.


November 6, 2007 | 10:48 pm

oops, that did the trick, thanks.

a+
gar


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