Pixel screen position in base2D shader?


Hi! I’m trying to port a simple 2d lighting shader from glsl to heaps shader, but I can’t quite seem to figure out how to get the pixel screen position in the fragment shader (to calc the distance to the light position)? Is there an equivalent to gl_FragCoord that I am missing? or some other way to access the screen coordinates for the current pixel?


If you look at h3d.shader.ScreenShader sources, you can declare in your shader the following:

var output : { position : Vec4 }

If you already extends ScreenShader, simply use output.position


If OTOH it’s not a post process filter but a shader you add on an object, you can use var outputPosition : Vec4 (see h3d.shader.Base2d definitions).