Does compositor 'input previous' inputs the depth buffer?
Posted: Thu Feb 02, 2012 3:27 pm
Hello,
I have 2 objects. Water surface (visibility_mask 2) and solid cylindrical object (visibility_mask 1).
I want to render to a texture only the portion of the object that appear under the water surface, so I wrote this composition.
The composition is used for a RenderTarget texture that is latter used in the shader of water surface for refraction effect.
I thought I could do the following:
1st Set the viewport visibility_mask to 1
2nd The composition 1st pass will render the fluid surface but it will not clear the depth buffer, so the fluid surface that is hidden by the cylinder would not be rendered, now I should have in rt0 only the water surface that is not hidden by the cylinder with alpha 1 and the rest of texture alpha 0.
3rd Use rt0 with render_quad, and the material should mask out from input previous all parts that coincide with rt0 alpha 0.
But unfortunately the output of the whole process is alpha 0 and black background.
Any help is much appreciated, thanks for advance.
I have 2 objects. Water surface (visibility_mask 2) and solid cylindrical object (visibility_mask 1).
I want to render to a texture only the portion of the object that appear under the water surface, so I wrote this composition.
The composition is used for a RenderTarget texture that is latter used in the shader of water surface for refraction effect.
I thought I could do the following:
1st Set the viewport visibility_mask to 1
2nd The composition 1st pass will render the fluid surface but it will not clear the depth buffer, so the fluid surface that is hidden by the cylinder would not be rendered, now I should have in rt0 only the water surface that is not hidden by the cylinder with alpha 1 and the rest of texture alpha 0.
3rd Use rt0 with render_quad, and the material should mask out from input previous all parts that coincide with rt0 alpha 0.
But unfortunately the output of the whole process is alpha 0 and black background.
Code: Select all
compositor FluidBG
{
technique
{
texture rt0 target_width target_height PF_R8G8B8A8
target rt0
{
visibility_mask 2
input previous
// Clear frame and stencil buffer but not depth
pass clear
{
buffers stencil color
stencil_value 0.0
color 0 0 0 0
}
pass render_scene
{
}
}
target_output
{
input previous
pass render_quad
{
input 0 rt0
material shader/FluidBG
}
}
}
}