Making a fake focul blur.

The artists and authors forum! NOTE: © original author - do not use w/out consent!

Moderators: MetalBeast, Capm

Post Reply
User avatar
Topher
DBB Alumni
DBB Alumni
Posts: 3545
Joined: Thu Nov 05, 1998 12:01 pm
Location: New York
Contact:

Making a fake focul blur.

Post by Topher »

Say I have an image and an image of the exact size that's a grayscale depthmap. Is there a free tool that will blur the image more based on how close the pixels are to the camera? I found one GIMP plugin that claims it will do this, but I can't unpack the file and it looks like I'd have to actually compile it to get it to work.

I tried to fake it using layers by blurring the image, setting the depthmap as the alpha channel and then overlaying that on the original image, but I get a glowy effect that I want to avoid.
http://www.csh.rit.edu/~topher/dir/blur.png
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7737
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Post by Isaac »

I think ur doing this which isn't bad if it's for touching up photos. But are you trying to simulate depth perception in 3d? cuzz... they're better ways that arn't very cpu intense.

depth of field with multipass rendering
User avatar
Topher
DBB Alumni
DBB Alumni
Posts: 3545
Joined: Thu Nov 05, 1998 12:01 pm
Location: New York
Contact:

Post by Topher »

Multipass really isn't an option with raytracing, the scenes take hours to render. It's much less expensive to render the scene once plus get it's depth field and then apply a filter. I could just use the raytraced focal blur, but it takes much longer and isn't very smooth.

That link is more or less what I did and the picture of the girl there has the \"glowy\" effect because you're bluring all the pixels at the maximum blur and then just choosing which ones to show in the image. I want to blur the pixels based on the depth map.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7737
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Post by Isaac »

what 3d app are you using?
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

simply using the depth map as a alpha mask is like using a silkscreen to smear vaseline onto a photo; use the depth map as a guide to generate mulitple blur layers.

use the depth map to create several slices of the rendered image(and thusly, the pixels for a given distance), and apply the correct level of blur for the slice's given distance range, and then use that slice's alpha mask to limit the bluring to the actual pixel there(in essence, trimming off excess blur).

.

I'd start with 3 such slices, and tweak from there.
User avatar
Topher
DBB Alumni
DBB Alumni
Posts: 3545
Joined: Thu Nov 05, 1998 12:01 pm
Location: New York
Contact:

Post by Topher »

This is 3D app independent, but currently I'm using POV-Ray.

I shouldn't have to create multiple blur layers, that's a ton of work and won't give as nice a result as having 256 levels of blur with the grayscale depthmap.

This is exactly what I'm trying to do, except on an image, not a rendered scene in Blender:
http://www.elysiun.com/forum/viewtopic.php?t=55567
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7737
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Re:

Post by Isaac »

Topher wrote:Multipass really isn't an option with raytracing, the scenes take hours to render. It's much less expensive to render the scene once plus get it's depth field and then apply a filter. I could just use the raytraced focal blur, but it takes much longer and isn't very smooth.

That link is more or less what I did and the picture of the girl there has the "glowy" effect because you're bluring all the pixels at the maximum blur and then just choosing which ones to show in the image. I want to blur the pixels based on the depth map.
It depends, but rendering it once is the less complicated way. using multipass rendering can solve almost any lighting, blurring, or cluttering problem. Even if you have a renderfarm this way can be faster than cramming all the calculations on one take.
image wrote:Image
imageshack
Note that i did add the 'glowy' look in Photoshop but if you fallow the tiles you can see it blurs fine...
20 cameras all rendering at the same time exporting and blending into one file. Also the global lum was done here like this. No plugs needed. I'm sure there's an easy way of doing this on your sys.
User avatar
Topher
DBB Alumni
DBB Alumni
Posts: 3545
Joined: Thu Nov 05, 1998 12:01 pm
Location: New York
Contact:

Post by Topher »

Right, I'm sure multi pass would work great, but some of the stuff I'm working on takes days to render. Multipass just isn't an option in some cases.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7737
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Post by Isaac »

.. which makes me wonder what you're doing that requires the final product to be exported in one pass. If you are new to compositing, you might stay away from this method. Almost all special effects you've seen in films use this technique (multipass rendering). It can be everything from lighting, texture detail, particles, and of course, blur. Im guessing the reason it takes you so long to render is because of your \"Global Illumination.\" This can be solved by baking the shadows into your objects. This will allow you to render the object many times very fast from different angles in an animation or during a multipass render.
User avatar
Topher
DBB Alumni
DBB Alumni
Posts: 3545
Joined: Thu Nov 05, 1998 12:01 pm
Location: New York
Contact:

Post by Topher »

Again, it's not possible to render the scenes many many times because they take a very long time to render. :)

Images with lots of objects or complicated isosurfaces just take a long time to process. I'm looking for a post-process focal blur approach that can be applied relatively quickly to an image given a depthmap. This approach also lets you tweak the effect relatively easily instead of adjusting the variables and re-rendering the scene 20x again.

I found a nice program to do that here:
http://www.imagico.de/hcredit/index.html
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7737
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Post by Isaac »

Oh i thought your rendering hadn't stared yet or was still in the process of exporting. But what could you be doing that requires light to be recalculated per frame?
Post Reply