transparency based z-depth?

I’m interested in getting a z-depth image that derives its data from alpha textures on the mesh, rather than the mesh’s surface itself. So that for instance a cube covered with an opaque+transparent checkerboard pattern would get me a zdepth map where the partly visible backface textures have different values than those on the foreground. Maybe doable through some nifty compositing trick?

I don’t suppose it’s possible, but i thought i’d ask just in case; Blender is full of surprises after all.

Very interesting…

Well I can tell you this… I don’t think you mean the alpha of an object- because that would just cut out the object with clean edges. So alpa and Z-depth is actually the same thing (not really, but when you simplify it to B&W images that allow the data to be read (e.g. creating a depth map from a B&W image) then it is)- so depending on the material you have on there- as long as its transparent or has some sort of gradient (in other words can be compositied into B&W through nodes), then it can be used as a “faux” Z-depth channel- though there are some limitations as Z-depth is normally stored internally.
What you would do with it… ??? Thats why we create… more details perhaps might answer the question

If you take a look at the picture below; a simple group of boxes, covered with text but transparent everywhere else. I’m wondering if i can apply DoF in post that blurs the backface of the cubes differently than the front.

If the z-depth is derived from the mesh, a face in the foreground will blur out everything behind it, which is not how i want the DoF to behave.

Well the good news is is that it can work. What I did to test it (though its a very rough test and doesn’t look like much) is to add a gradient layer to the transparent text. Put in cubic mode from black to white. This allowed the bottom part of the text to be painted black and a gradient to the top white part.

I saved it as a jpeg and used it to drive a blur filter. Since it derives the blurred parts as black (No mask) and the white gradient as non blurred, it creates depth of focus. I really hope there are easier ways I’m not familiar with…
So- it can work, the thing is, you’ll definitely have to work to get what you’re looking for as the look.

Love the text- hope we can see hen its done…

I dont think thats what he is reffering to.

The issue is the z depth pass doesnt take into account alpha information as far as I can tell. Which really sucks for doing a depth pass on semi transparent objects. For example doing a depth pass on a bush with alpha leaves. You get squares instead of leaves despite that it renders with the alpha just fine. Im working on something similar and thus far havent found anything that will work.

Im going to try to get a depth pass through mist somehow next but i dont think that will work ether.

If anyone has found a solution to this i would be happy to know as well.

Same here, signing on in case some one has a breakthrough. How about rendering a psuedo depth pass from alpha. I’m not sure but can we render an alpha pass (white material on all alpha mapped objects) then cast a point light from the camera with fall off to scene, no shadows of course.

I managed to get a good alpha channel pass from Z-tra(nsparency faces) on with mist set to clip from object front to depth back.


Well that seems to work. I used a z-trans pass for the alpha channel using mist for fall off. Unfortunately mist is active in the final too. I would shift the master shot to another scene (fully linked) without the mist on. The other scene would just create the depth alpha pass by enabling the mist.

Note there is a ramp between the alpah out from depth source to the Z input on the defocus node, this needs adjusting to get sharpness at front of object.

Not sure if this unweildy or not but seems quite flexible.


Oh dear it seems that mist is not scene dependant, so I cannot turn it off for seperate passes. If anyone knows how to get the mist output, without passing it through to the end, that would be great.

Attachments


depth test.blend (166 KB)

Okay, you can get Mist pass without rendering mist (doh!) I just havent ever rendered passes before. Silly me. Anyway here it is SOLVED I think.

Attachments

Alpha depth NEW.blend (182 KB)



If you wanted to animate a focus pull through the object then you must animate the ramp that feeds the z value of the blur node. Painfull in 2.49 do-able in 2.5 (animate EVERYTHING yay).

The approach I would take would be messy, but I have done something similar.

  1. take your image textures with the text, convert them to be pure blue in color (no red/green)
  2. set the material for the buildings they are on to be pure red, transparent, with no shadows or refraction
  3. use nodes to separate out the results into masks
    a - pure blue no red = text directly viewable from camera
    b - pure blue + pure red = text on a back face
    c - pure red no blue = buildings
    d - everything else = background
  4. use the appropriate mask to post process you original picture, for instance, mask a in black to remove all front text, blur what is left, overlay the front text back in using the same mask a.

Mist approach would require knowledge of the boundaries of your scene (to set limits of effect), But the DOF nodes could be a node group to append to any project.