I was thinking about a better way to "block" my lensflare effect and I thought that reading the value of the depthbuffer at the position where my sunsprite is on the screen would be an elegant way.(Like if the depth value is higher (or lower what ever means nearer) then I know something else is in front of the sunsprite) I tried copying the Depthbuffer to a Rsstersurface with
But all I get are Zeros (or if I clear the surface first, then I get the color I cleared with). I used the same Pixelformat for the Rastersurface as I used for the Depthformat of the Modeltexture.
I also tried to read the "color" values of the texture (Rastersurface changed to RGBA8 and scenetexturetype to "color") to see if that works, but that also gives me zeros at any position.
So for being sure I use the correct method I saved a regular TTexture to the surface and NOW I was getting actual color values of the position X/Y.
Is reading values of the depthbuffer possible in another way?
Code:
FModeltexture.Retrieve(Tscenetexturetype.depth).Save(LSurface, 0, ZeroPoint2i, ZeroIntRect); Pixelvalue := Lsurface.pixels [posx,posy];
I also tried to read the "color" values of the texture (Rastersurface changed to RGBA8 and scenetexturetype to "color") to see if that works, but that also gives me zeros at any position.
So for being sure I use the correct method I saved a regular TTexture to the surface and NOW I was getting actual color values of the position X/Y.
Is reading values of the depthbuffer possible in another way?
Comment