Hi there!
I want to sample depth map for further use as the filter3d for view3D.
Here’s the code of filter’s task:
override public function activate(stage3DProxy : Stage3DProxy, camera3D : Camera3D, depthTexture : Texture) : void
{
stage3DProxy.setTextureAt(1, depthTexture); // work with depth
stage3DProxy.context3D.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, _rgbData, 2);
}
override public function deactivate(stage3DProxy : Stage3DProxy) : void
{
stage3DProxy.setTextureAt(1, null);
}
And then in override protected function getFragmentCode():
return "mov ft2, v0 \n" + // ft2 = pos
"tex ft1, v0, fs1 <2d,nearest> \n" + // get depth map
"tex ft0, v0, fs0 <2d,nearest> \n" + // get texture map
"mov ft3, ft0 \n" + // just init new variable
"mov oc, ft3 \n";
But “tex ft1, v0, fs1 <2d,nearest>” always causes black screen, but as you can see I’ve just put texture of view3d to output color.
Please help!