Displacement filter 3D - Fisheye Effect - Fragment Samplers are black when setTextureAt - WTF?

Software: Away3D 4.x

FLAmaniac, Newbie
Posted: 21 May 2013 01:23 PM   Total Posts: 9

hi,
I am trying to create displacement filter.
I create displacment based on procedural map ( sin) but i look bad.

I want to set additional texture for Fragment shader but something is wrong.
Were i put texture to sampler i get black image on fs0 (i want to post process/displace currentFrame of view3d)

my code in FishEyeFilterTask

override protected function getVertexCode():String
{
   
 
return  "mov op, va0n" 
   
"mov v0, va1n";
}
override 
protected function getFragmentCode():String
{
 
//trying to get view when context.setTextureAt(1, _t); is call = black screen on all samplers
 
return "tex oc, v0, fs0 <2d,linear,nomip>n";

}

override 
public function activatestage3DProxy:Stage3DProxycamera3D:Camera3DdepthTexture:Texture ):void
  {
   
// TODO: not used
   
camera3D camera3D;
   
depthTexture depthTexture;
   
   var 
context:Context3D stage3DProxy._context3D;
   
//set on sampler1 but all saplers are black
   
context.setTextureAt(1_t);

   
context.setProgramConstantsFromVectorContext3DProgramType.VERTEX0_data);
   
context.setProgramConstantsFromVectorContext3DProgramType.FRAGMENT0_data);
  

trying to get view when context.setTextureAt(1, _t);  (_t is displacment map texture) is called = black screen on all samplers
I only get something when i put displacment map texture on fs0 but this owerrides screen frame.

yes i am changing fragment code to sample 1to see displacment map but it is black (fs0 also)

return “tex oc, v0, fs1 <2d,linear,nomip>n”;

   

FLAmaniac, Newbie
Posted: 21 May 2013 02:40 PM   Total Posts: 9   [ # 1 ]

First view.render() is ok but next are black….
something is clearing texture?

   

FLAmaniac, Newbie
Posted: 21 May 2013 03:36 PM   Total Posts: 9   [ # 2 ]

I solve it!!!
Texture have to be set null on deactivate method.

override public function activatestage3DProxy:Stage3DProxycamera3D:Camera3DdepthTexture:Texture ):void
  {
   trace
(this +  "activate"target  );
   
// TODO: not used
   
camera3D camera3D;
   
depthTexture depthTexture;
 

   var 
context:Context3D stage3DProxy._context3D;
   
context.setTextureAt(1_t.getTextureForStage3D(stage3DProxy));
   
   
context.setProgramConstantsFromVectorContext3DProgramType.VERTEX0_data);
   
context.setProgramConstantsFromVectorContext3DProgramType.FRAGMENT0_data);
  
}
  override 
public function deactivate(stage3DProxy Stage3DProxy) : void
  {
   stage3DProxy
.setTextureAt(1null);
  

cool hmm

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X