Closed zpelgrims closed 5 years ago
could even try with a linear interpolation between the original samples and the transformed samples?
https://www.shadertoy.com/view/MtySRw https://marc-b-reynolds.github.io/math/2017/01/08/SquareDisc.html
decide if i want to do it "cheap" and put an intermediate value on the concentric disk sampling (linear interpolate should work) or more expensive, and do a squircle transformation after the concentric sampling (looks better)
Implemented, but do i need to account for this in the optical vignetting? E.g the exit pupil is also square? It might look better that way
yes, should be followed through
could do something like this for the optical vignetting calculations (true squircle instead of concentric circle lerp):
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 q = fragCoord.xy / iResolution.xy;
vec2 uv = -1.0 + 2.0 * q;
uv.x *= iResolution.x/iResolution.y;
vec3 color = vec3(0.780, 0.082, 0.522);
vec2 pos = vec2(0.0,0.0);
// True squircle (http://en.m.wikipedia.org/wiki/Squircle)
// (x-a)^4 + (y-b)^4 = r^4
float amount = 4.0;
float power = 1.0 + 1.0*(amount);
float radius =1.0;
float dist = pow(abs(uv.x-pos.x), power) + pow(abs(uv.y - pos.y),power);
if( dist > pow(radius, power))
{
color = vec3(0.580, 0.000, 0.827);
}
fragColor = vec4(color,1);
}
done
think i can do this with a bias on the lens->x, lens->y samples
this might look really nice with anamorphic bokeh