mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-21 23:31:30 +11:00
Add a fast curvature function that try to survive "Dolby ears®"
This commit is contained in:
parent
43ad7ab791
commit
5766ed2fbf
|
@ -29,6 +29,20 @@ vec2 tl_warp(vec2 pos)
|
|||
return pos*0.5 + 0.5;
|
||||
}
|
||||
|
||||
/* Curvature by kokoko3k, GPL-3.0 license
|
||||
* w.x and w.y are global warp parameters
|
||||
* protrusion is the rounded shape near the middle
|
||||
* keep protrusion higher than ~0.5
|
||||
*/
|
||||
vec2 Warp_koko(vec2 co, vec2 w, float protrusion) {
|
||||
float czoom = 1 - distance(co, vec2(0.5));
|
||||
czoom = mix(czoom, czoom * protrusion, czoom);
|
||||
vec2 czoom2d = mix(vec2(1.0), vec2(czoom), w);
|
||||
vec2 coff = mix( vec2(0.0), vec2(0.625), w);
|
||||
return zoomxy(co, coff + czoom2d );
|
||||
}
|
||||
|
||||
|
||||
// cgwg's geom
|
||||
// license: GPLv2
|
||||
|
||||
|
@ -99,6 +113,8 @@ vec2 cgwg_warp(vec2 coord)
|
|||
vec2(1.0, 1.0)/aspect + vec2(0.5, 0.5));
|
||||
}
|
||||
|
||||
|
||||
|
||||
float corner(vec2 coord)
|
||||
{
|
||||
coord = (coord - vec2(0.5)) + vec2(0.5, 0.5);
|
||||
|
|
Loading…
Reference in a new issue