Hello Mark
The 'z buffer' is the bit of video memory where the video card stores
depth information. You have the normal colour buffer (with is the RGBA
part), and also Z if you have depth enabled. When the video card draws
anything (say e.g. a cube), it will draw the polygons, writing the
colour + transparency info and also the Z data for the pixel. Then if
another cube gets drawn, the GPU can work out if it should draw the
new pixels or not by checking what's already in the Z buffer, so it
knows if the new object is in front or behind whatever is already there.
The reason transparency doesn't work with it, is that it can only
write one value to the z buffer. I.e. if you have a transparent object
in front, it still has a depth value, so the value gets written to Z.
If you then draw something behind, the GPU checks the Z value, decides
there's something in front, and doesn't draw the back object.
I'm sure there must be ways around this, but they'll be pretty
limited. Like you could check both the Z and alpha values, to
determine if there's transparency, so you would get objects behind
transparent objects rendered correctly. The catch though is that you
still only have one Z value, so objects behind a transparent object
wouldn't be depth sorted any more, and you'd end up with glitching.
I think what you've got in your composition now is pretty much the
best way to handle it. To improve things a little, you could link the
blur value to the z position, so the clouds blur more as they come
closer (you'll probably want a faster blur filter in that case, and
it's worth adding some transparent area around the clouds then
cropping after the blur, otherwise the clouds will shrink as they blur
more).
There are other ways of doing depth of field too, but I can't think of
any that will be easy to do in QC (actually I've done it the way you
did it here before now). One way is to render the clouds without blur,
but with depth sorting, then write a custom blur filter that blurs
according to the Z buffer value, so that objects blur as they get
further or closer than a certain point. That way is pretty flexible,
but not perfect quality and it's fairly tricky to do. Another is to
render the clouds several times (I'd say at least 5) from slightly
different angles, then combine the renders into one image. The idea is
that images near the centre (or at the back, depending on how you set
it up) stay in the same place and look sharp, objects close to the
camera will render in different positions, and look blurred when
they're combined.
Chris
On 3 Aug 2008, at 20:09, MARK HARRIS wrote:
thanks Chris. thats the problem I've been having if I select the
read/write on the base sprite (the one which is duplicated) it sorts
the depth problem, i.e. the shapes in the foreground go over the
ones in the background, but I lose the transparency around the
shape.. Please excuse my lack of knowledge but is that what you mean
by the Z buffer?
The best solution I could come up with is this.. I split the
composition into four layer which allowed me to have the extreme
distance and forground blurred and transparent which gives it a nice
depth of field effect..
I was just wondering if there was a better solution to this..
Many thanks Mark
<solution.qtz>
I've not had time to look at the composition, but I've learnt a
fair bit about Z sorting in QC. Most patches do respect Z sorting,
just make sure you have 'Read/Write' selected for the Z buffer for
each patch you want depth enabled for. If you're rendering inside a
render-in-image, make sure you have the z buffer enabled for that
too or it won't work.
The other thing to be aware of is transparency - if you use say a
bunch of sprites with a texture that has transparent areas, if
another sprite renders behind one it will be correctly Z-sorted but
won't render in the transparent areas because it's 'behind' the
front sprite. I've found it's a case of one or the other but not
both when it comes to transparency and Z.
Chris
On 3 Aug 2008, at 18:36, vade wrote:
it looks like this is because quartz renders based on layers, and
does not do any z sorting between layers. Since you have clouds
and shadows in the same iterator, they are rendered one after the
other, per iteration, using the painters algorithm, (meaning, its
just drawn on top of whatever was there before).
easy fix - separate out your shadows in a separate iterator and
draw them first.
hard fix, figure out depth sorting in QC..
On Aug 3, 2008, at 12:22 PM, MARK HARRIS wrote:
<problem.qtz>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected]
)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/psonice%40gmail.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected]
)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/psonice%40gmail.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]