reusing depth stencil texture in another fbo

Started by
13 comments, last by Yours3!f 11 years, 11 months ago
if you want the skybox drawn only on pixel in wich it was not drawn you don't need FBO. you can achieve that with early z culling. You have just to draw skybox as last drawcall, just have to keep proper Z test to make z culling work ;-)

Peace and love, now I understand really what it means! Guardian Angels exist! Thanks!

Advertisement

if you want the skybox drawn only on pixel in wich it was not drawn you don't need FBO. you can achieve that with early z culling. You have just to draw skybox as last drawcall, just have to keep proper Z test to make z culling work ;-)


well the skybox already works, the point is that I need to blur the scene later, and I'd like to save some texture fetches by masking out the skybox.
ah :)

Peace and love, now I understand really what it means! Guardian Angels exist! Thanks!


well the skybox already works, the point is that I need to blur the scene later, and I'd like to save some texture fetches by masking out the skybox.

Here might be a conceptual issue. When you blur, you most likely use a two pass or a single pass approach. When using a two pass approach(x/y axis), utilizing the stencil buffer could result in interesting effects (you stencil out the target and not the source texels). When using a single pass approach, you have a similar effect and you would have a performance impact (single pass (n*n) vs two pass (2*n) ).

Why not use the alpha channel (or some other) to determine a mask by discarding a pixel once the alpha channel has a value less than X. This is not as fast as a stencil buffer, but it should work on a block base, that is, when all pixels in a certain block (i.e. 16x16 pixel block) are discarded , then it is faster for this block. When using large parts of the image as background, this should performe better than the brute force approach. This way you could even implement a bilateral gauss filter (ignore masked source texels).

And try to utilise linear texture blending to half the number of taps needed for the blurring.

[quote name='Yours3!f' timestamp='1335684549' post='4935774']
well the skybox already works, the point is that I need to blur the scene later, and I'd like to save some texture fetches by masking out the skybox.

Here might be a conceptual issue. When you blur, you most likely use a two pass or a single pass approach. When using a two pass approach(x/y axis), utilizing the stencil buffer could result in interesting effects (you stencil out the target and not the source texels). When using a single pass approach, you have a similar effect and you would have a performance impact (single pass (n*n) vs two pass (2*n) ).

Why not use the alpha channel (or some other) to determine a mask by discarding a pixel once the alpha channel has a value less than X. This is not as fast as a stencil buffer, but it should work on a block base, that is, when all pixels in a certain block (i.e. 16x16 pixel block) are discarded , then it is faster for this block. When using large parts of the image as background, this should performe better than the brute force approach. This way you could even implement a bilateralgauss filter (ignore masked source texels).

And try to utilise linear texture blending to half the number of taps needed for the blurring.
[/quote]

Well, I use a separated gausssian blur with linear sampling (http://rastergrid.co...inear-sampling/), and I check the normals, so that the blur is geometry aware. I also implemented masking by checking if the normal vector is a null vector (only checking the source), and this seems to do the trick, but I was seeking for a faster method. So this is kind of the alpha-channel method that you described. But if stencil testing is only needed on the source as you described, than I guess the problem is solved smile.png

Thanks for the bilateral approach I'll look into that.

This topic is closed to new replies.

Advertisement