Shadows ?

franz's picture

Hi, does any1 knows any way of rendering Shadows from 3D objects (even a simple cube or sphere) from within QC ? I assume this has to take place from within a GLSL shader.....

Any help, hint, link truely welcome.

psonice's picture
Nope. Except the SSAO stuff..

No way to render shadows that i know of, unless there's some support for it in kineme 3d (or you write your own patch to do a 3d scene with shadows?)

But perhaps the SSAO effects would do? http://kineme.net/Discussion/ProgrammingQuartzComposerPatches/separating...

cwright's picture
multi-pass/others

Shadows in OpenGL work in one of three ways:

1) You flatten the object you want to have cast a shadow (flattened according to the plane the shadow is cast on, and the light's direction, so it's not a simple gl_Position.z = 0 flatten). The, you render the object, and the "shadow object". The shadow object only works on a plane, not curved or irregular surfaces.

2) You use the accumulation buffer and render shadow volumes (QC doesn't have an accumulation buffer, so that's out) -- I'm a bit rusty on the details for this method, since it's not applicable to QC, and I might have some of it wrong, but either way it's not possible.

3) You render the scene from the lights' point(s)-of-view, and capture the depth map for each of those. Then, you feed that into an ordinary camera PoV render, and it tests each pixel against the shadow map -- if the pixel is farther than the shadow map, it's not lit, and can be rendered dark. There are 80 zillion variations on this method (dual-paraboloid projection, trapezoidal projection, etc shadow mapping) to deal with quirks and quality. This method requires N+1 passes, where N is the number of lights casting shadows.

None of these are currently possible in QC, though 3 might be possible once ReadPixels in GLTools is released (though you'd still have to manually render everything yourself twice, and associated transforms, to get a usable shadow map).

toneburst's picture
HLSL

There's an HLSL shader to do soft-edged shadows here http://vvvv.org/tiki-index.php?page=User+Shaders

Haven't looked at it to see if it's possible in QC though. I suspect it may not be.

I'm intrigued by this GL ReadPixels thing. I will have to look into that.

a|x

gtoledo3's picture
You can also make a sprite

You can also make a sprite with a little shadow looking circle/oval of appropriate size, and angle/move it appropriately... probably turn depth testing off as well. I saw a post by "Rinboku" on vimeo, where he is doing that, and it looked ok for a variety of situations.

NI makes some kind of filter that does a little "shadow"/double image with offset. I don't find it that useful though.

Also, that shadow patch thread that toneburst references is pretty nice.

Out of that experience, I came up with a "cheap shadow" that works ok in some circumstances. It's a seriously "shortcut" version of toneburst's concept, but can also actually be set to look like things are radiating light if you play with it.

This may or may not be useful... the shadow will have a little bit of the color from the object. Maybe it is possible to use a blend filter to turn that (the difference image between the blurred and non blurred) black like a shadow. I don't know, haven't messed with it any...

You need v002 zoom blur for this... you can use the regular zoom, but then it doesn't really work in most situations, and does weird image resizing that sucks.

PreviewAttachmentSize
cheap shadow.qtz5.06 KB
cheap shadow front cull white color.qtz5.55 KB