» Fri May 27, 2011 6:14 am
I'd be happy to try it, but I don't have the know-how on how to get information on stuff from the depth buffer, I've only ever worked in 2D. Unless someone is willing to teach me?
EDIT: Read up a little, and I now know that the buffer stores the depth of each pixel's nearest object. What I want to know is: what do the four indices of the vector that Scanti's testshader computes? Are they colors and one depth, and if so, which is which? Looking at the code, I'm guessing that the last three are color related, as Scanti sets them to 0 to get black on near objects, so I'm also guessing from that that the other one must be related to depth, as that one is the only one left to vary, and that must lead to the color variation. Am I right?
EDIT 2: OK, so playing around with it, it seems that for the float4(x,y,z,a), x is the colour of the farthest pixels, and a is the colour of the nearest pixels. I have no idea what the other two are though. Oh, and I was thinking that DoF would need a camera vector, but just realised that it can be done by finding the depth of the centre pixel of the screen, which is where the crosshair should be, and therefore what you're looking at. Now to find out how to do that...