crt-distort-coordinates
Do a barrel distortion to a given texture coordinate to emulate a curved CRT screen.
Index
Functions
Functions
- ApproxAtan2
-
float2 ApproxAtan2( float2 y, float2 x)Description
Do a fast approximation of a two-component atan2 calculation. This is only accurate near 0 (it only uses a few terms from its taylor series, so becomes increasingly inaccurate away from the origin. But it is good enough for our purposes.
Called by
DistortCRTCoordinates.Parameters
y-
Type:
float2The y component(s) of the angle (corresponding to the sine of the angle(s)).
x-
Type:
float2The x component(s) of the angle (corresponding to the cosine of the output angle(s)).
Return Value
Type: float2A pair of angles, one for each y, x pair of inputs.
- DistortCRTCoordinates
-
float2 DistortCRTCoordinates( float2 texCoord, float2 distortion)Description
Do a barrel distortion to a given texture coordinate to emulate a curved CRT screen.
Called by generate-screen-texture and rgb-to-crt.
Parameters
texCoord-
Type:
float2The original texture coordinate, intended to come straight from the full-render-target quad, in
[-1..1]range (not standard[0..1]) distortion-
Type:
float2A (horizontal, vertical) distortion pair which describes the effective curvature of the virtual screen.
Return Value
Type: float2The texture coordinates, distorted to emulate being on a curved screen.