Better understanding of dottore DOF 2.0 module

Hi everyone,
there are a couple of things i can’t quite understand about the DOF 2.0 module from dottore (you can find it here: dof))

I was playing around with the help patch:

  1. The scene is composed of some boxes moving towards the camera and a big sphere, what is the big sphere for? if i delete it from the group going into the depth buffer renderer the dof effect seems to behave in a different way…
  2. the near/far - start/end distanced are calculated from the camera position along z axis?

thanks,
byebye

1)the big sphere is the background. needed for correct background distance value in the depth texture.

  1. depth is calculated along Z axis of the viewProjection space = it’s the distance from the camera (=> you can move the camera as you want)

2 --> ok thx

1 --> can you explain this a little bit more in detail? i have tried to modify the scale of the sphere or tried to use a grid instead of sphere and the blur effect on the boxes varies with it, but can’t understand how it is affected and why the background influences the blurring on the boxes…

hope you can answer back, thanks

in basic you have to set up radius of shpere to max distance from your cam
because depth is floating point map it still persist when you have sphere in the background, if you don’t you have true black witch is quite ruining stuff

i’m really sorry but i don’t get that :(
you mean that i have to set the sphere radius equal to the distance between the camera and the most distant object (in z space)? Talking in terms of DOF 2.0 help patch the camera is a 0,0,0 and the furthest box from camera is at z=20 so i’d say sphere radius of 20…but in the example patch is of 50 (sphere radius 0.5 x uniform scale 100).
And where should this sphere be placed inside the scene?

thanks again

have no chance to test but maybe darker it’s depth harder for dof to decide

it’s really simple:
depth texture represents the object’s distances from the camera.
black = distance 0
white (rgb=1) = distance 1
white (rgb>1) = distances > 1
(using float textures we can store any float value in the texture, not just values from 0 to1)
in your scene the most distant object is the sky (as in the help patch).
to correctly evaluate dof you need distance information of every pixel of the image, also for those showing the sky.
usually we manage to draw sky just using the background color of the renderer, but i noticed you can only set color values in 0-1 space for that.
btw…change background color pin in the renderer from 0-1 to float would be nice and think not so difficult task for devvvvs. if you have time have a look ;)
so, just consider the sky as an object; you must place it correctly in the scene so it can have correct depth values in the depth texture.
if you are in a closed room and the most far object you can see are the walls, obviously you don’t need the sky sphere.

you continue to mention the z space dimension as significant but it’s not. just try to move the camera around (it’s the common softimage camera module) and you will notice that dof works in any direction, indipendently where the objects are.
antokhio was suggesting to set the sphere radius to the maximum distance from the camera because sky IS the max distance object of the scene. so make it big enough, big big, very big. …so big.
you can simply connect the far clip plane of your camera to the radius of the sky (and assigning the camera position to the sphere) so you will be sure that the sky is at the maximum visible distance from the camera.
clear enough? :)

più che chiaro, CRISTALLINO!!
thanks very much now it’s very clear :)

thanks all for the time and effort spent in explaining this!
you rock