Barrel distortion as parameter

This commit is contained in:
saschawillems 2018-06-08 21:07:51 +02:00
parent a122c2380a
commit 0eb306ec9e
3 changed files with 11 additions and 3 deletions

View file

@ -2,6 +2,11 @@
layout (binding = 1) uniform sampler2DArray samplerView;
layout (binding = 0) uniform UBO
{
layout(offset = 272) float distortionAlpha;
} ubo;
layout (location = 0) in vec2 inUV;
layout (location = 0) out vec4 outColor;
@ -9,7 +14,7 @@ layout (constant_id = 0) const float VIEW_LAYER = 0.0f;
void main()
{
const float alpha = 0.2;
const float alpha = ubo.distortionAlpha;
vec2 p1 = vec2(2.0 * inUV - 1.0);
vec2 p2 = p1 / (1.0 - alpha * length(p1));