| Author |
Message |
| < Talk to the developers ~ quartz question |
|
Posted:
Thu Mar 01, 2007 7:23 am
|
|
|
Video Architect
Joined: 04 Feb 2007
Posts: 16
|
|
I've been playing around with making my own qtz. files to use in VDMX, but I haven't figured out how to expose parramaters so they can be controlled in VDMX. Any help with that and direction towards some tutorials beyond this is how you make a rotating box with a glow effect would be greatly appreciated.
~Michael |
|
|
|
|
|
 |
|
Posted:
Thu Mar 01, 2007 12:45 pm
|
|
|
Joined: 01 Mar 2007
Posts: 8
Location: Zurich - Switzerland
|
|
I am too working with qtz files I created and have to say: vdmx has the best support for them I have seen so far.
Have you already read this post?
http://www.vidvox.com/phpBB2/viewtopic.php?t=1718
Just make sure you publish your inputs in QuartzCompser. If you need other value scaling than "0" to "1" you can add an input splitter in QC and set the min/max values there.
Now the qtz input values can be set and modulated in the layer window.
It is really straight forward.
To publish inputs in QC just control-click on the QC module and select the published inputs in the pop-up menu. |
|
|
|
|
|
 |
|
Posted:
Thu Mar 01, 2007 12:58 pm
|
|
|
Video Architect
Joined: 10 Jul 2004
Posts: 1093
|
|
|
|
|
 |
|
Posted:
Sun Mar 04, 2007 2:52 am
|
|
|
Video Architect
Joined: 04 Feb 2007
Posts: 16
|
|
| Thanks for the info. I'm excited to get cracking with quartz. |
|
|
|
|
|
 |
|
Posted:
Sun Mar 04, 2007 2:13 pm
|
|
|
Video Architect
Joined: 11 May 2006
Posts: 330
Location: London UK
|
|
It's amazing how quickly you can knock together something quite impressive-looking in Quartz Composer. I think you'd need to get into OpenGL to get really impressive 3D stuff going though. I'm really into the idea of realtime 3D mesh warping, but I don't think you can do that kind of thing without some serious coding, even with the help of QC.
Alex
http://www.toneburst.net |
|
|
|
|
|
 |
|
Posted:
Tue Mar 06, 2007 1:50 pm
|
|
|
Video Architect
Joined: 10 Jul 2004
Posts: 1093
|
|
howdy alex-
"I think you'd need to get into OpenGL to get really impressive 3D stuff going"
isn't that self-evident? when you get right down to it, quartz composer is a programming language. if you want to do impressive things with it, then yes- you absolutely should be conversant with all aspects of it. while learning opengl so you can write custom objects would be one extreme, there's plenty you can do that's nowhere near as difficult. in particular, the javascript and core image kernel objects are quite useful, and are relatively easy to use.
ironically, the object that i think has the most untapped potential is actually the hidden glsl shader object. i've had very little luck getting it working, but that's probably why it's hidden- because it's unfinished. if this gets turned on in a future version of quartz composer, then you would be well advised to learn glsl- which, though related to opengl, isn't nearly as convoluted. if this object gets turned on, mesh deformations will probably be the least impressive example of what it can do.
look at it this way: we're all computer artists (neither dave nor myself consider ourselves "programmers"). learning how to program- even if it's just javascript, some cikernels, or glsl- expands our palette, and places more tools at our disposal. if you want to learn more (which, in case it isn't painfully obvious, we *strongly encourage*), all you have to do is ask one of us for links.
while you can do one *hell* of a lot with qc as-is, i certainly agree with your assertion that it could use more work in the 3d-object-creation-and-deformation department. as far as i can tell, there's no way to import 3d objects or modify the actual shapes of existing objects (beyond geometric transformations). these are the sorts of things that clever 3rd-party devs could probably whip up- so cross your fingers, and hope that either these features get added directly to the next release of qc, or that apple decides to open up the quartz composer api.
peace
: : ray |
|
|
|
|
|
 |
|
Posted:
Tue Mar 06, 2007 11:35 pm
|
|
|
Video Architect
Joined: 04 Feb 2007
Posts: 16
|
|
[quote="mrRay"]
look at it this way: we're all computer artists (neither dave nor myself consider ourselves "programmers"). learning how to program- even if it's just javascript, some cikernels, or glsl- expands our palette, and places more tools at our disposal. if you want to learn more (which, in case it isn't painfully obvious, we *strongly encourage*), all you have to do is ask one of us for links.
: : ray[/quote]
I can totaly relate to your explanation of a computer artist here! The technical parts of the creation part have never been what fascinates me, but what I can do once I learn them. To that end I'd love to see what links you and dave have for openGL, glsl, core image, and quartz.
I'd also like to thank you guys again for VDMX which is one of the most versatile and amazing video tools I've come across to date. You guys are my heroe's.
~Michael |
|
|
|
|
|
 |
|
Posted:
Wed Mar 07, 2007 3:42 pm
|
|
|
Video Architect
Joined: 10 Jul 2004
Posts: 1093
|
|
first and foremost, none of the following information will be useful at all without practice. reading a tutorial (even reading it thoroughly) will not teach you how to program; that's like trying to learn how to ride a bike by reading about the physics underlying the whole process. in order to learn how to program, you need to practice- if you're working your way through a tutorial, you should be actually doing whatever it is the tutorial is describing- if that gets boring, pick a simple project ("simple" is the key word- take baby steps, you don't want to get frustrated and burn out) and see it through. the more time you spend actually creating, the more you'll learn.
in terms of utility and ease of use, javascript seems like a good place to start off. it's relatively simple, you don't need a compiler, and once you know it you'd be surprised how many uses you can find for it (web pages are the first thing that spring to mind, but you can find javascript everywhere). javascript is also one of those languages that's *insanely* easy to pick up once you know other languages, and i picked it up kinda late in the game, so i was looking mainly for references. as such, i found the o'reilly javascript reference to be completely invaluable, and it's saved my bacon on more than one occasion. keep in mind that the javascript object in qc is relatively limited in it's scope, and includes only the basic libraries- which are still more than enough to do most of what you need (and are covered in the o'reilly reference). if you're just getting started and want some walk-throughs, check out webmonkey- they've got a number of decent tutorials. sure, the tutorials focus more on web pages- but javascript is javascript, and once you know it you can use it anywhere. work your way through the basic tutorial, and then move on from there:
http://www.webmonkey.com/webmonkey/programming/javascript/
...as an aside, i've found webmonkey to be an extremely useful site for all sorts of random wonderful things. their intro to css is fantastic, and i picked up a bunch of php from their php tutorials. if you need to learn the basics of a computer thing, webmonkey is a good first place to look.
the next object that i use the most would probably be the core image kernel object. cikernels (and shaders, for that matter) are basically programs that run on your gpu. when you write a cikernel, you're writing a single function which will be run on every single pixel in the resultant image- so they're conceptually a bit different from other programming languages. core image kernels and glsl fragment shaders are quite similar: in fact, the language used to write cikernels is a subset of glsl (meaning that you can use most, but not all, of it's functions). unfortunately, there's not a whole lot of tutorials out there on how to use cikernels. apple has a general guide on how to write a custom filter- ignore the bits and pieces about writing the class that goes around the filter, and focus on the first two steps (writing the kernel code and testing it in qc):
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/CoreImaging/ci_custom_filters/chapter_4_section_3.html#//apple_ref/doc/uid/TP30001185-CH207-BCICGCJF
...once you work your way through that, the best thing you can do would be to work your way through the core image kernel language reference (it's really quite short), which can be found here:
http://developer.apple.com/documentation/GraphicsImaging/Reference/CIKernelLangRef/index.html
...and experiment as you go (i'll post a bunch of sample kernels here so you have something to look at and build from). keep in mind that core image kernels are a *subset* of glsl, so you might find it useful to have the glsl spec handy- it can be found here:
http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf
...you'll notice that some methods in the glsl spec aren't supported in core image- the unsupported methods are listed at the end of the CIKernel language reference (linked to above). you'll actually be able to use the kernels you write in vdmx as quartz composer-based fx, so testing's fairly easy: save your changes in QC, make the effect in VDMX, and the file will reload. learning how to write cikernels seems like a good way to start to break into glsl. hopefully (cross your fingers) the hidden glsl object will be turned on right about the same time as you figure out cikernels and are starting to get frustrated with their shortcomings.
i can't really recommend anything specific for learning glsl, because i don't know it yet. i'll probably have to learn it at some point. i'm hoping that quartz composer turns on their glsl object, because that seems like the easiest way to tinker with the language- i've already got a fair idea of how to use it, and i've got the language reference (linked to above). if i need to know more, i'll probably just google for the information. mostly, i'm looking forward to practicing glsl.
as far as opengl goes, it's a very large set of tools, and not for the inexperienced. there's an enormous amount of information on the web pertaining to opengl- if you're looking for something specific, google is your friend. there are a number of tutorials out there, but no list of links would be complete without nudging you towards the venerable opengl.org. there are two main sources of documentation here: the red book (which is more of a programming guide), and the blue book (which is more of a reference manual). these can be found here:
http://opengl.org/documentation/red_book/
http://opengl.org/documentation/blue_book/
if you want to get the most out of the programming guide/red book, i'd recommend becoming familiar with programming in c or c++ to get the most out of it. learning how to program in c/c++ is well beyond the scope of this intro- there are countless books on these topics, and if you want to write quartz composer plugins you'll definitely want to be conversant with it. learning to program in c is a good deal more complex and time-consuming than working with javascript, cikernels, or glsl. that being said, if you're looking for a quicky intro, you could do a good deal worse than this site:
http://www.eskimo.com/~scs/cclass/cclass.html
....the web page isn't flashy (in fact, it's incredibly utilitarian), but i found it to be a very nice intro to c that moved at a reasonable pace (i found a lot of tutorials to be insipid, and painfully slow). one thing it (and most guides) are short on is a walkthrough on how to actually start programming on os x- knowing what an array is isn't particularly useful until you can get an application compiled and start tinkering around. you could probably figure this out just by tinkering around with xcode, but it's a pain in the ass.
...which brings us to objective-c/cocoa. objective-c is a superset of c, and i've found cocoa to be much more pleasant to work with than simple c. hands-down, the best guide to cocoa i've run across is 'cocoa programming for mac os x' by aaron hillegass. this book is great- it's got nice, simple walkthroughs and clear explanations of everything that's going on. best of all, it starts out at the very beginning: the first step is "create new project" in xcode, so you're not left guessing as to any missing steps. my copy's falling apart from excessive over-use; halfway through it, i was able to start vdmx.
cheers
: : ray |
|
|
|
|
|
 |
|
Posted:
Wed Mar 07, 2007 3:50 pm
|
|
|
Video Architect
Joined: 10 Jul 2004
Posts: 1093
|
|
....and here are some sample kernels. many of these should be recognizable from various fx in vdmx. you should be able to copy each of these (one at a time) into a core image kernel object in quartz composer, and you should be good to go. i don't think i've included any kernels that won't work (we've got some kernels that fare better in their respective bundles). also, please note that these are all in-progress (in particular, the HSL chromakey's a bit messy, but it works).
| Code: |
kernel vec4 BrightKernel(sampler image, float trans)
{
vec4 ret;
ret = unpremultiply(sample(image, samplerCoord(image)));
ret.r = ret.r + trans;
ret.g = ret.g + trans;
ret.b = ret.b + trans;
return premultiply(ret);
}
kernel vec4 ContrastKernel(sampler image, float trans)
{
vec4 tmp;
vec4 ret;
tmp = unpremultiply(sample(image, samplerCoord(image)));
ret.r = (tmp.r < 0.5) ? (0.5 - ((0.5 - tmp.r) * trans)) : (((tmp.r - 0.5) * trans) + 0.5);
ret.g = (tmp.g < 0.5) ? (0.5 - ((0.5 - tmp.g) * trans)) : (((tmp.g - 0.5) * trans) + 0.5);
ret.b = (tmp.b < 0.5) ? (0.5 - ((0.5 - tmp.b) * trans)) : (((tmp.b - 0.5) * trans) + 0.5);
ret.a = tmp.a;
return premultiply(ret);
}
kernel vec4 AlphaMaskKernel(sampler bg, sampler mask, float contrast, float offset)
{
vec4 bgVec;
vec4 maskVec;
float luma;
vec4 ret;
bgVec = unpremultiply(sample(bg, samplerCoord(bg)));
maskVec = sample(mask, samplerCoord(mask));
luma = ((maskVec.r + maskVec.g + maskVec.b)/3.0);
luma = ((luma<0.5)?(0.5-((0.5-luma)*contrast)):(((luma-0.5)*contrast)+0.5))+offset;
luma = (luma>1.0)?1.0:luma;
luma = (luma<0.0)?0.0:luma;
ret.rgb = bgVec.rgb;
ret.a = luma;
return premultiply(ret);
}
kernel vec4 ChannelSlideKernel(sampler image, vec4 trans)
{
vec4 tmp;
vec4 ret;
tmp = unpremultiply(sample(image, samplerCoord(image)));
ret = tmp + trans;
ret.r = (ret.r > 1.0) ? ret.r - 1.0 : ret.r;
ret.g = (ret.g > 1.0) ? ret.g - 1.0 : ret.g;
ret.b = (ret.b > 1.0) ? ret.b - 1.0 : ret.b;
ret.a = (ret.a > 1.0) ? ret.a - 1.0 : ret.a;
return premultiply(ret);
}
kernel vec4 FrameHold(sampler bg, vec2 offset)
{
vec2 dims;
vec2 loc;
dims = samplerSize(bg);
loc = mod(samplerCoord(bg) + offset, dims);
return sample(bg, loc);
}
kernel vec4 VVZoom(sampler top, vec2 center, float level)
{
vec2 loc;
vec2 modifiedCenter;
loc = destCoord();
loc = samplerTransform(top,loc);
modifiedCenter = samplerTransform(top, center);
loc = (loc - modifiedCenter)*(1.0/level) + modifiedCenter;
return sample(top,loc);
}
kernel vec4 XYZoom(sampler top, vec2 center, float levelX, float levelY)
{
vec2 loc;
vec2 modifiedCenter;
loc = destCoord();
loc = samplerTransform(top,loc);
modifiedCenter = samplerTransform(top, center);
loc.x = (loc.x - modifiedCenter.x)*(1.0/levelX) + modifiedCenter.x;
loc.y = (loc.y - modifiedCenter.y)*(1.0/levelY) + modifiedCenter.y;
return sample(top,loc);
}
kernel vec4 vvBWduotone(sampler image, float range)
{
vec4 pixel;
vec4 returnMe;
pixel = unpremultiply(sample(image, samplerCoord(image)));
returnMe = vec4((pixel.r+pixel.b+pixel.a)/3.0);
returnMe = (returnMe.r < range) ? vec4(0.0) : vec4(1.0);
returnMe.a = pixel.a;
return premultiply(returnMe);
}
kernel vec4 TwoColorDuotone(sampler image, float val, vec4 lowColor, vec4 highColor)
{
vec4 pixel;
vec4 returnMe;
pixel = unpremultiply(sample(image, samplerCoord(image)));
returnMe = vec4((pixel.r+pixel.b+pixel.a)/3.0);
returnMe = (returnMe.r < val) ? lowColor : highColor;
returnMe.a = pixel.a;
return premultiply(returnMe);
}
// RGB -> HSL (NOT HSV)
// adapted from easyrgb.com
kernel vec4 vvRGBimgToHSLimg(sampler img)
{
vec4 pixel;
vec4 returnMe;
float varMin;
float varMax;
float delMax;
float delR;
float delG;
float delB;
vec4 tmpVec;
bvec4 tmpState;
pixel = unpremultiply(sample(img, samplerCoord(img)));
varMin = min(pixel.r, min(pixel.g, pixel.b));
varMax = max(pixel.r, max(pixel.g, pixel.b));
delMax = varMax - varMin;
// returnMe.B is Luminance
returnMe.b = (varMax + varMin)/2.0;
// returnMe.G is Hue
returnMe.g = (returnMe.b<0.5) ? delMax/(varMax+varMin) : delMax/(2.0-varMax-varMin);
delR=(((varMax-pixel.r)/6.0)+(delMax/2.0))/delMax;
delG=(((varMax-pixel.g)/6.0)+(delMax/2.0))/delMax;
delB=(((varMax-pixel.b)/6.0)+(delMax/2.0))/delMax;
tmpVec = vec4(varMax);
tmpState = equal(pixel, tmpVec);
returnMe.r = (pixel.r == varMax) ? delB-delG : returnMe.r;
returnMe.r = (pixel.g == varMax) ? (1.0/3.0)+delR-delB : returnMe.r;
returnMe.r = (pixel.b == varMax) ? (2.0/3.0)+delG-delR : returnMe.r;
returnMe.r = (returnMe.r < 0.0) ? returnMe.r+1.0 : returnMe.r;
returnMe.r = (returnMe.r > 1.0) ? returnMe.r-1.0 : returnMe.r;
// if delMax is 0, H and S are 0- otherwise, leave 'em alone
returnMe.r = (delMax==0.0) ? 0.0 : returnMe.r;
returnMe.g = (delMax==0.0) ? 0.0 : returnMe.g;
returnMe.a = pixel.a;
return premultiply(returnMe);
}
// HSL (NOT HSV) -> RGB
// adapted WITH MODIFICATIONS IN vH from easyrgb.com
kernel vec4 vvHSLimgToRGBimg(sampler img)
{
vec4 pixel;
vec4 returnMe;
float var1;
float var2;
float vH;
pixel = unpremultiply(sample(img, samplerCoord(img)));
var2 = (pixel.b < 0.5) ? pixel.b*(1.0+pixel.g) : (pixel.b+pixel.g)-(pixel.g*pixel.b);
var1 = 2.0*pixel.b-var2;
vH = pixel.r+(1.0/3.0);
vH = (vH<0.0) ? vH+1.0 : vH;
vH = (vH>1.0) ? vH-1.0 : vH;
returnMe.r = var1;
returnMe.r = ((3.0*vH)<2.0) ? (var1+(var2-var1)*((2.0/3.0)-vH)*6.0) : returnMe.r;
returnMe.r = ((2.0*vH)<1.0) ? (var2) : returnMe.r;
returnMe.r = ((6.0*vH)<1.0) ? (var1+(var2-var1)*6.0*vH) : returnMe.r;
vH = pixel.r;
vH = (vH<0.0) ? vH+1.0 : vH;
vH = (vH>1.0) ? vH-1.0 : vH;
returnMe.g = var1;
returnMe.g = ((3.0*vH)<2.0) ? (var1+(var2-var1)*((2.0/3.0)-vH)*6.0) : returnMe.g;
returnMe.g = ((2.0*vH)<1.0) ? (var2) : returnMe.g;
returnMe.g = ((6.0*vH)<1.0) ? (var1+(var2-var1)*6.0*vH) : returnMe.g;
vH = pixel.r-(1.0/3.0);
vH = (vH<0.0) ? vH+1.0 : vH;
vH = (vH>1.0) ? vH-1.0 : vH;
returnMe.b = var1;
returnMe.b = ((3.0*vH)<2.0) ? (var1+(var2-var1)*((2.0/3.0)-vH)*6.0) : returnMe.b;
returnMe.b = ((2.0*vH)<1.0) ? (var2) : returnMe.b;
returnMe.b = ((6.0*vH)<1.0) ? (var1+(var2-var1)*6.0*vH) : returnMe.b;
returnMe.r = (pixel.g==0.0) ? pixel.b : returnMe.r;
returnMe.g = (pixel.g==0.0) ? pixel.b : returnMe.g;
returnMe.b = (pixel.g==0.0) ? pixel.b : returnMe.b;
returnMe.a = pixel.a;
return premultiply(returnMe);
}
kernel vec4 vvRGBtoYUV(sampler img)
{
vec4 inVec = unpremultiply(sample(img, samplerCoord(img)));
vec4 outVec;
outVec.r = inVec.r*0.257 + inVec.g*0.504 + inVec.b*0.098 + 16./100.;
outVec.g = inVec.r*-0.148 - inVec.g*0.291 + inVec.b*0.439 + 0.5;
outVec.b = inVec.r*.439 - inVec.g*0.368 - inVec.b*0.071 + 0.5;
outVec.a = inVec.a;
return premultiply(outVec);
}
kernel vec4 vvYUVtoRGB(sampler img)
{
vec4 inVec = unpremultiply(sample(img, samplerCoord(img)));
vec4 outVec;
outVec.r = inVec.r+(1.4075*(inVec.b-0.5));
outVec.g = inVec.r-(0.3455*(inVec.g-0.5)-(0.7169*(inVec.b-0.5)));
outVec.b = inVec.r+(1.7790*(inVec.g-0.5));
outVec.r = 1.164*(inVec.r-(16./100.)) + 1.596*(inVec.b-0.5);
outVec.g = 1.164*(inVec.r-16./100.)-0.813*(inVec.b-0.5)-0.391*(inVec.g-0.5);
outVec.b = 1.164*(inVec.r-(16./100.))+2.018*(inVec.g-0.5);
outVec.a = inVec.a;
return premultiply(outVec);
}
kernel vec4 hslChromaMask(sampler img, vec4 HSLcolor, float hRange, float sRange, float lRange)
{
vec4 pixel = unpremultiply(sample(img, samplerCoord(img)));
vec4 diffVec;
float hDiff;
float sDiff;
float lDiff;
diffVec = abs(pixel - HSLcolor);
hDiff = (diffVec.r);
sDiff = (diffVec.g);
lDiff = (diffVec.b);
//pixel.a = (lDiff <= lRange) ? (lDiff/lRange) : 1.0;
//pixel.a = (hDiff <= hRange) ? (hDiff/hRange)*pixel.a : pixel.a;
//pixel.a = (sDiff <= sRange) ? (sDiff/sRange)*pixel.a : pixel.a;
pixel.a = (hDiff <= hRange) ? (hDiff/hRange) : 1.0;
pixel.a = (sDiff <= sRange) ? (sDiff/sRange)*pixel.a : pixel.a;
pixel.a = (lDiff <= lRange) ? (lDiff/lRange)*pixel.a : pixel.a;
return premultiply(pixel);
}
|
hmm.....i should probably mention that the above hslChromasMask is expecting an HSL stream on it's 'img' input- run a standard img/video stream into vvRGBimgToHSLimg, then pass it to the chroma mask, then pass it through vvHSLimgToRGBimg prior to displaying it or running it through other kernels/core image fx. if any of that sounds confusing, i could probably be convinced to post a quartz composer doc with everything set up....
peace
: : ray |
|
|
|
|
|
 |
|
Posted:
Fri Mar 09, 2007 1:26 am
|
|
|
Video Architect
Joined: 04 Feb 2007
Posts: 16
|
|
mrRay,
Thank you for all the info and the kernel code. I can see I've got a lot to learn. But, I think you've got me started in the right direction. Thanks again.
~Michael |
|
|
|
|
|
 |
|
Posted:
Fri Mar 09, 2007 11:38 am
|
|
|
Video Architect
Joined: 04 May 2006
Posts: 84
|
|
Cheers for that ray, I've been looking for some shaders to start off with, as I've done some pixel shaders for pc, but there are a number of differences I could find references for!
Hopefully that will get me started! |
_________________ www.colour-burst.com |
|
|
|
|
 |
|
Posted:
Sat Mar 10, 2007 2:35 pm
|
|
|
Video Architect
Joined: 10 Jul 2004
Posts: 1093
|
|
hi cat-
there are a number of differences between cikernels and glsl- you can find a listing of the differences on the last page of the cikernel language reference linked to above. generaly speaking, run-of-the-mill glsl shaders are significantly more powerful than coreimage kernels, due mainly to the unsupported data types and methods (i read somewhere that they were disabled for security reasons). cikernels are suited more to direct two-dimensional image editing (there doesn't seem to be anything directly analogous to vertex shaders). if you're looking to experiment with cikernels, quartz composer is a fantastic testing bed: all you need is an image source (drag a movie in from the finder), a sprite or a billboard to display the results on, and a "core image kernel" object. while i'm certainly not a model of efficiency, this is the setup i use for prototyping various fx, and i've found it to be a joy to work in.
they've got their limitations, but i think cikernels are a nice, comfortable stepping-stone to learning glsl, and if QC's glsl shader object gets turned on we can look forward to enjoying the best of both worlds. oh, and for the record: quartz composer patches make nifty fx- we'll be releasing an update relatively soon (there's a couple things we'd like to get squared away first).
peace
: : ray |
|
|
|
|
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|