Skip to content

Instantly share code, notes, and snippets.

@katopz
Created December 12, 2012 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katopz/4268356 to your computer and use it in GitHub Desktop.
Save katopz/4268356 to your computer and use it in GitHub Desktop.
Stage3D kil opcode
refer to : http://www.kirupa.com/forum/showthread.php?374071-stage3d-AGAL-how-to-use-the-kil-opcode
AGAL:
[
"tex ft0, v0, fs0 <2d,clamp," + TextureSmoothing.NONE + ">", //store texture in ft0
"sub ft1.x ft0.a fc0.x", //store alpha - threshold (fc0.x) in temp ft.x
"kil ft1.x", //kill based on that
"mov oc, ft0" // move to output colour
]
// fragment shader specifying a threshold:
var myAlphaPoint:Number = .01
var myThreshold:Vector.<Number> = new <Number>[myAlphaPoint,myAlphaPoint,myAlphaPoint,myAlphaPoin t]
context.setProgramConstantsFromVector( Context3DProgramType.FRAGMENT, 0,myThreshold)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment