Defocus Glitch?

I just ran across one of the oddest things I’ve ever come across in Blender. I think its’ a glitch, but if it is, it’s a rather annoying one. I have a scene with multiple cameras (about seven) which move around and change their depth of field throughout the animation. Every shot works great except one.

One camera’s shot simply does not want to come into focus, the entire thing is fuzzy no matter what DOF distance I set. Normally I would assume that one of my settings was weird, but that exact camera works fine in other positions. And when I create a new camera it doesn’t work there either. When I move the camera sideways about four Blender units and back a bit it works like a charm.

There is simply a small zone in my scene where defocus will not work, and where it is has nothing to do with the node itself. It isn’t a setting on the camera or the node changing. It is the camera’s position. I checked all the layers and removed anything nearby it without any luck. I think it’s just a small circle in my scene where for some reason defocus won’t work. Has anyone else encountered this?

Are any transparent objects blocking the camera’s view from that location? That will kill DoF every time.

At one time there was a tree that was in another layer not being rendered at that spot, but I even deleted the tree completely and it still didn’t work. Other than that, nothing. Perhaps another camera was in its way, but that doesn’t affect rendering or DOF I do’t think, or at least I have never noticed that it does. Weird, huh.

The only cause I can think of is a possibly transparent object occluding the camera, as RamboBaby already mentioned, since transparent objects are still visible in the zbuffer. The postprocess is completely based on the zbuffer…
Otherwise, if that is really not the case, I would suggest making a bugreport with an example file of the problem.

That does sound strange. Can you upload a .blend?

Sorry RamboBaby, I didn’t see your post until now. I was in San Francisco, California interviewing for a job the last week and forgot about this thread until I got back. The file this happened in was over 75 megs, so uploading it is a bit impractical.

However, I did get some new information on the problem (hence the resurrection of an old topic). I finished that scene and went on to a new one, completely new models and everything. I encountered the same problem. So I made a copy of my file and began deleting everything until the problem went away.

The scene is inside of a building, where the camera panned through a window from outside. I deleted the entire building, all the people, everything escept the lights and that one camera, and replaced the focal point person with a normal small cube. The problem persisted.

I finally found out that it was the ground plane for outside that was causing the problem. But it’s just a simple plane with a composite node texture on it. And the weird thing is that it wasn’t even visible from the camera with everything else in place, nor was it intersecting the camera at all. It is quite a ways below the camera. Yet when I move it further below the problem goes away.

What could cause a normal plane to mess with defocus when it isn’t intersecting anything?

Edit: Oh, and the camera change between working and not is a single frame, and maybe 10 degrees or a shift to the right, it doesn’t even change vertically.

It could be a corrupt file but more likely it’s just one of the many wierd things that go on inside a 3D program. Often changing the parameters of the offending object then changing them back will cause the object to behave properly. I’m experiencing that with right now with a particle system that I have parented to a jet engine that’s strapped to a pig. When I change some of the constraints of the pig (“copy rotation” in particular) it causes the particles to move out of place at various frames for some reason. Changing the particle’s life span one frame then changing it back causes them to begin respecting their assigned (parented) locations again. From some of the things I’ve read I gather that most 3D programs are a bit quirky like this.


That sounds about right, thanks. A jet engine strapped to a pig? I would love to see that when you finish. It sounds wildly, wonderfully, bizarre.

If anything goes wrong, at least he’ll have BBQ pork to show for it!:D:p

try taking the Z buffer output from that dead zone area from the render layer and mapping it to the visible spectrum (0-1) and looking at it. That will tell you what the Defocus node is seeing and using as the Z. It might be that the ground plane is transparent or background(?) and thus has an infinite Z and so the defocus makes it all very out of focus…

good luck on the job interview, btw…was it for any kind of graphic or CG/anim job?


Thanks for the best wishes. I am not nearly good enough for a CG job. The job was actually for a pastorate, that’s my main vocation when I’m not Blending. And I got it, so it looks like I’ll be leaving Kansas soon. From Idaho to Alaska to Kansas to California.

As for your suggestion, I would love to, but while I know how to get the zbuffer from the render layer, how would I go about mapping it to the visible specturm?

If you’re using a recent SVN build, plug it into a normalise node. Otherwise you’ll have to fiddle with the map value node.

When following broken and RamboBaby’s advice didn’t turn up anything unusual I just worked around the problem, but when it turned up in a third scene and I couldn’t seem to fix it I became a bit paranoid. I finally narrowed it down to what is causing the problem and wanted to post it in case anyone else is having this problem.

Defocus nodes will render the entire image out of focus, like you don’t have limits on your camera, if part of the rendered image is outside the clipping range. That means if your set ends farther than 100 BU (standard clipping settings) away from your camera it will be completely out of focus and nothing will change it except shrinking your scene or enlarging your clipping settings.

I probably misunderstand what you are saying since I don’t see any difference when I reduce the clipping range. It doesn’t matter if the focal point is inside or outside of the clipping range.
Could you provide a simple example file? Then I might be able to do something about it.


Of course, here you go.

This is a simple blend file. Just take the default scene, set it up with defocus, and add a plane that stretches more than 100 BU, the default camera limit. It will render out of focus. It doesn’t matter if you put something in the way or not, if the edge of an object in frame is farther away than the limit of the camera no focal length can bring it into focus. But just change the limits to longer than the object, even if that part of the object isn’t being seen in frame, and it works like a charm.

Well, I tried, but I honestly don’t see what the problem is. I get a perfectly normal result, not a completely out of focus image at all. Only the back of the plane is slightly out of focus, exactly as expected…

What version of blender are you using?
Only other thing I can think of that might be related is that in the early blender releases that had the defocus node, there was a problem with unpredictable sudden changes in blurring when used in animations, since the node used the closest object to the camera to derive some parameters for foreground processing. But I removed that some time ago, so in the latest versions that should not occur anymore.

Well thank you eeshlo, I appreciate your efforts. I was simply content to take it as a matter of course that it wouldn’t do some things, but thanks for looking at it. I am using Blender 2.43 because Blender 2.44 doesn’t like my animated gifs anymore and I use them heavily as textures in my current project.

The could definitely be the problem. I made sure to check this out on another machine before posting, but forgot that both are running 2.43 at the moment. I’ll drop 2.44 on one of them and check it out, thank you.