PixelArtCrt_Frag

shade.Shade → shade.Frag → shaders.PixelArtCrt_Frag (Class)

precision: 'highp': screen positions reach the thousands, which a mediump float (10 bit mantissa) cannot resolve to the pixel.

Instance Members

shade
new(): Void

Private Members

shade
FLICKER_RATE: Float

Flicker frequency, in radians per second


shade
params: Map

shade
mainTex: shade.Sampler2D

shade
bloomTex: shade.Sampler2D

shade
resolution: shade.Vec2

shade
outputScale: Float

shade
screenRect: shade.Vec4

The filter on screen, in screen pixels: origin in xy, size in zw. Gives each fragment its screen position, so that phosphor masks stay fixed on the screen like the glass of a real tube, whatever the content does (gl_FragCoord is not available on every target)


shade
beamAmount: Float

shade
hardPix: Float

shade
sharpBand: Float

shade
hardScan: Float

shade
beamMin: Float

shade
beamMax: Float

shade
scanlineStrength: Float

shade
maskType: Float

shade
maskDark: Float

shade
maskLight: Float

shade
maskScale: Float

shade
lcdGridStrength: Float

shade
lcdSubpixelLow: Float

shade
bloomAmount: Float

shade
warpX: Float

shade
warpY: Float

shade
cornerRadius: Float

shade
cornerSmooth: Float

shade
vignetteStrength: Float

shade
gamma: Float

shade
brightness: Float

shade
colorMatrix: shade.Mat3

shade
luminance: Float

shade
time: Float

shade
noiseStrength: Float

shade
flickerStrength: Float

shade
quality: Float

shade
tcoord: shade.Vec2

shade
color: shade.Vec4

shade
luma(c: shade.Vec3): Float

Rec. 709 luma weights

Name Type
c shade.Vec3
Returns
Float

shade
toLinear(c: shade.Vec3): shade.Vec3

Display to linear light (no-op when gamma is 0)

Name Type
c shade.Vec3
Returns
shade.Vec3

shade
toDisplay(c: shade.Vec3): shade.Vec3

Linear light back to display (no-op when gamma is 0)

Name Type
c shade.Vec3
Returns
shade.Vec3

shade
fetch(pos: shade.Vec2, off: shade.Vec2): shade.Vec3

Lottes Fetch: the texel off texels away from the one under pos, in linear light

Name Type
pos shade.Vec2
off shade.Vec2
Returns
shade.Vec3

shade
dist(pos: shade.Vec2): shade.Vec2

Lottes Dist: distance from the center of the texel under pos, in texels (-0.5 to 0.5)

Name Type
pos shade.Vec2
Returns
shade.Vec2

shade
gaus(pos: Float, scale: Float): Float

Lottes Gaus: 1D Gaussian, scale is negative (hardPix, hardScan)

Name Type
pos Float
scale Float
Returns
Float

shade
horz3(pos: shade.Vec2, off: Float): shade.Vec3

Lottes Horz3: 3-tap Gaussian reconstruction along x of the source row off

Name Type
pos shade.Vec2
off Float
Returns
shade.Vec3

shade
horz5(pos: shade.Vec2, off: Float): shade.Vec3

Lottes Horz5: 5-tap Gaussian reconstruction along x of the source row off

Name Type
pos shade.Vec2
off Float
Returns
shade.Vec3

shade
beamScale(c: shade.Vec3): Float

Width of the beam drawing a row of the given color: the crt-geom idea (brighter rows draw a wider beam), applied to the Lottes scanline Gaussian

Name Type
c shade.Vec3
Returns
Float

shade
scan(pos: shade.Vec2, off: Float, scale: Float): Float

Lottes Scan: weight of the source row off at this position, for a beam of width scale

Name Type
pos shade.Vec2
off Float
scale Float
Returns
Float

shade
sharpTexel(pos: shade.Vec2): shade.Vec3

Pixel art antialiasing (Quilez, Themaister, Fernandes, Golus): nearest texel, with bilinear interpolation only within a band of sharpBand output pixels around texel edges, so that sub-pixel scrolling stays smooth without blurring the pixels

Name Type
pos shade.Vec2
Returns
shade.Vec3

shade
maskTriad(x: Float): shade.Vec3

Lottes: one RGB triad per three cells along x (in cells)

Name Type
x Float
Returns
shade.Vec3

shade
maskTv(pos: shade.Vec2): shade.Vec3

Lottes mask 1: compressed TV style shadow mask, triads offset every other line

Name Type
pos shade.Vec2
Returns
shade.Vec3

shade
maskAperture(pos: shade.Vec2): shade.Vec3

Lottes mask 2: aperture grille

Name Type
pos shade.Vec2
Returns
shade.Vec3

shade
maskVgaStretched(pos: shade.Vec2): shade.Vec3

Lottes mask 3: stretched VGA style shadow mask

Name Type
pos shade.Vec2
Returns
shade.Vec3

shade
maskVga(pos: shade.Vec2): shade.Vec3

Lottes mask 4: VGA style shadow mask

Name Type
pos shade.Vec2
Returns
shade.Vec3

shade
maskLcd(uv: shade.Vec2): shade.Vec3

LCD (after SameBoy): each source pixel split in three RGB subpixels, with a dark grid between pixels. Tied to source pixels, not screen pixels: one game pixel is one LCD pixel

Name Type
uv shade.Vec2
Returns
shade.Vec3

shade
mask(uv: shade.Vec2, screenPos: shade.Vec2): shade.Vec3

uv: image coordinates (after curvature), for the LCD mask tied to source pixels. screenPos: fragment position in screen pixels, for the phosphor masks

Name Type
uv shade.Vec2
screenPos shade.Vec2
Returns
shade.Vec3

shade
warp(pos: shade.Vec2): shade.Vec2

Lottes Warp: barrel distortion of the image coordinates

Name Type
pos shade.Vec2
Returns
shade.Vec2

shade
cornerMask(uv: shade.Vec2): Float

Rounded rectangle in source pixels: 1 inside, 0 outside. Also hides what the curvature pushed outside the image

Name Type
uv shade.Vec2
Returns
Float

shade
vignette(uv: shade.Vec2): Float

crtemu vignette: 1 at the center, darker towards the edges

Name Type
uv shade.Vec2
Returns
Float

shade
hash(p: shade.Vec2): Float

The usual one-line GLSL hash

Name Type
p shade.Vec2
Returns
Float

shade
main(): shade.Vec4
Returns
shade.Vec4

Metadata

Name Parameters
:build shade.macros.ShadeMacro.buildFragVertForHaxe()
:autoBuild shade.macros.ShadeMacro.buildFragVertForHaxe()
shade { precision : "highp" }