This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Exact distortion parameters (a, b, c) are not known yet, these are just placeholers | |
float a = 0.20f; | |
float b = 0.00f; | |
float c = 0.00f; | |
float d = 1 - (a + b + c); | |
// Calculate the source location "radius" (distance from the centre of the viewport) | |
// fragPos - xy position of the current fragment (destination) in NDC space [-1 1]^2 | |
float destR = length(fragPos); | |
float srcR = a * pow(destR,4) + b * pow(destR,3) + c * pow(destR,2) + d * destR; |