Forums > Jitter

Scalebias on GPU

July 30, 2007 | 12:54 am

Hi,
Forgive me if this is an easy question, but how can scalebias be performed on the GPU using a shader? I can see that a scalebias shader is already available but it doesn’t offer any RGB control. Does it work in a different way or am I better using a different shader? Essentially I want to colour a white video different colours on the GPU.

Cheers

Andy


July 30, 2007 | 1:09 am

au contraire it does offer RGB control. There are 2 parameters if you
look at the shader file:

vec4 scale;
vec4 bias;

These are RGBA vectors you can set with for example [param scale 1. 1. 1. 1.]

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 111 310 76 196617 prepend param;
#P flonum 120 242 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 83 242 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 46 242 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 9 242 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 21 264 94 196617 pak bias 1. 1. 1. 1.;
#P flonum 396 286 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 359 286 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 322 286 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 285 286 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 297 308 99 196617 pak scale 1. 1. 1. 1.;
#P newex 186 359 269 196617 jit.gl.videoplane test @transform_reset 2
@color 1 1 1 1;
#B color 5;
#P newex 186 337 175 196617 jit.gl.slab test @file cc.scalebias.jxs;
#B color 5;
#P flonum 386 207 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 386 228 42 196617 rate $1;
#P message 272 207 80 196617 read dozer.mov;
#P message 320 228 27 196617 stop;
#P message 286 228 31 196617 start;
#P flonum 229 207 35 9 0.5 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 187 207 15 0;
#P newex 187 227 52 196617 metro 30;
#P message 350 228 31 196617 clear;
#P newex 187 255 103 196617 jit.qt.movie 320 240;
#B color 5;
#P message 173 90 34 196617 reset;
#P newex 173 110 186 196617 jit.gl.handle test @inherit_transform 1;
#P newex 38 110 48 196617 r render;
#P toggle 153 81 15 0;
#N vpatcher 53 128 279 297;
#P inlet 106 30 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 0;
#P newex 43 95 47 196617 gate 1 1;
#P newex 42 116 41 196617 s draw;
#P window linecount 1;
#P newex 17 52 58 196617 t b b erase;
#P inlet 17 32 15 0;
#P outlet 17 83 15 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P fasten 2 2 0 0 70 75 22 75;
#P connect 4 0 3 0;
#P fasten 5 0 4 0 111 88 48 88;
#P fasten 2 1 4 1 46 83 85 83;
#P lcolor 15;
#P pop;
#P newobj 91 110 42 196617 p Draw;
#P toggle 229 49 15 0;
#P message 229 69 68 196617 fullscreen $1;
#N vpatcher 30 89 166 253;
#P window setfont "Sans Serif" 9.;
#P newex 50 71 35 196617 sel 27;
#P newex 50 50 40 196617 key;
#P outlet 50 93 15 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P pop;
#P newobj 246 49 33 196617 p Esc;
#P newex 229 87 151 196617 jit.window test @depthbuffer 1;
#P toggle 91 62 15 0;
#P newex 91 81 57 196617 qmetro 30;
#P newex 91 137 187 196617 jit.gl.render test @erase_color 0 0 0 1;
#P connect 34 0 22 0;
#P connect 29 0 34 0;
#P connect 24 0 34 0;
#P connect 30 0 29 1;
#P connect 31 0 29 2;
#P connect 32 0 29 3;
#P connect 33 0 29 4;
#P connect 25 0 24 1;
#P connect 26 0 24 2;
#P connect 27 0 24 3;
#P connect 28 0 24 4;
#P connect 22 0 23 0;
#P connect 12 0 22 0;
#P connect 21 0 20 0;
#P connect 16 0 14 1;
#P fasten 20 0 12 0 391 249 192 249;
#P fasten 19 0 12 0 277 249 192 249;
#P fasten 18 0 12 0 325 249 192 249;
#P fasten 17 0 12 0 291 249 192 249;
#P fasten 13 0 12 0 355 249 192 249;
#P fasten 14 0 12 0 192 252 192 252;
#P connect 15 0 14 0;
#P connect 5 0 3 0;
#P connect 6 0 5 0;
#P connect 4 0 6 0;
#P connect 11 0 10 0;
#P fasten 8 0 7 1 158 103 128 103;
#P fasten 9 0 0 0 43 132 96 132;
#P connect 7 0 0 0;
#P fasten 10 0 0 0 178 132 96 132;
#P connect 1 0 7 0;
#P connect 2 0 1 0;
#P window clipboard copycount 35;


July 30, 2007 | 9:11 am

Ah of course. It didn’t occur to me that they would be vectors. A bit obvious really, don’t know how I missed it. Thanks for that.

Andy


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