Initial work on background visualization
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// FinalRender.fsh
|
||||
// XIONControlPanel
|
||||
//
|
||||
// Created by Charles Magahern on 12/29/15.
|
||||
// Copyright © 2015 XION. All rights reserved.
|
||||
//
|
||||
|
||||
uniform sampler2D u_colorSampler;
|
||||
uniform sampler2D u_blurmapSampler;
|
||||
varying vec2 v_uv;
|
||||
|
||||
float saturate(float v)
|
||||
{
|
||||
return clamp(v, 0.0, 1.0);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture2D(u_colorSampler, v_uv) + texture2D(u_blurmapSampler, v_uv);
|
||||
float dist = length(v_uv - vec2(0.5));
|
||||
gl_FragColor = saturate(1.0 / (8.0 * (dist + 0.1))) * color;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// FinalRender.vsh
|
||||
// XIONControlPanel
|
||||
//
|
||||
// Created by Charles Magahern on 12/29/15.
|
||||
// Copyright © 2015 XION. All rights reserved.
|
||||
//
|
||||
|
||||
attribute vec4 a_position;
|
||||
varying vec2 v_uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
v_uv = (a_position.xy + 1.0) * 0.5;
|
||||
gl_Position = a_position;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// FirstPass.fsh
|
||||
// XIONControlPanel
|
||||
//
|
||||
// Created by Charles Magahern on 12/29/15.
|
||||
// Copyright © 2015 XION. All rights reserved.
|
||||
//
|
||||
|
||||
uniform sampler2D u_colorSampler;
|
||||
varying vec2 v_uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = texture2D(u_colorSampler, v_uv);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// FirstPass.vsh
|
||||
// XIONControlPanel
|
||||
//
|
||||
// Created by Charles Magahern on 12/29/15.
|
||||
// Copyright © 2015 XION. All rights reserved.
|
||||
//
|
||||
|
||||
attribute vec4 a_position;
|
||||
varying vec2 v_uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
v_uv = (a_position.xy + 1.0) * 0.5;
|
||||
gl_Position = a_position;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// HorizontalBlur.fsh
|
||||
// XIONControlPanel
|
||||
//
|
||||
// Created by Charles Magahern on 12/29/15.
|
||||
// Copyright © 2015 XION. All rights reserved.
|
||||
//
|
||||
|
||||
uniform sampler2D u_colorSampler;
|
||||
varying vec2 v_uv;
|
||||
varying vec2 v_blurTexCoords[14];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(0.0);
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 0])*0.0044299121055113265;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 1])*0.00895781211794;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 2])*0.0215963866053;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 3])*0.0443683338718;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 4])*0.0776744219933;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 5])*0.115876621105;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 6])*0.147308056121;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_uv )*0.159576912161;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 7])*0.147308056121;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 8])*0.115876621105;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 9])*0.0776744219933;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[10])*0.0443683338718;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[11])*0.0215963866053;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[12])*0.00895781211794;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[13])*0.0044299121055113265;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// HorizontalBlur.vsh
|
||||
// XIONControlPanel
|
||||
//
|
||||
// Created by Charles Magahern on 12/29/15.
|
||||
// Copyright © 2015 XION. All rights reserved.
|
||||
//
|
||||
|
||||
attribute vec4 a_position;
|
||||
varying vec2 v_uv;
|
||||
varying vec2 v_blurTexCoords[14];
|
||||
|
||||
void main()
|
||||
{
|
||||
v_uv = (a_position.xy + 1.0) * 0.5;
|
||||
v_blurTexCoords[ 0] = v_uv + vec2(-0.028, 0.0);
|
||||
v_blurTexCoords[ 1] = v_uv + vec2(-0.024, 0.0);
|
||||
v_blurTexCoords[ 2] = v_uv + vec2(-0.020, 0.0);
|
||||
v_blurTexCoords[ 3] = v_uv + vec2(-0.016, 0.0);
|
||||
v_blurTexCoords[ 4] = v_uv + vec2(-0.012, 0.0);
|
||||
v_blurTexCoords[ 5] = v_uv + vec2(-0.008, 0.0);
|
||||
v_blurTexCoords[ 6] = v_uv + vec2(-0.004, 0.0);
|
||||
v_blurTexCoords[ 7] = v_uv + vec2( 0.004, 0.0);
|
||||
v_blurTexCoords[ 8] = v_uv + vec2( 0.008, 0.0);
|
||||
v_blurTexCoords[ 9] = v_uv + vec2( 0.012, 0.0);
|
||||
v_blurTexCoords[10] = v_uv + vec2( 0.016, 0.0);
|
||||
v_blurTexCoords[11] = v_uv + vec2( 0.020, 0.0);
|
||||
v_blurTexCoords[12] = v_uv + vec2( 0.024, 0.0);
|
||||
v_blurTexCoords[13] = v_uv + vec2( 0.028, 0.0);
|
||||
|
||||
gl_Position = a_position;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// VerticalBlur.fsh
|
||||
// XIONControlPanel
|
||||
//
|
||||
// Created by Charles Magahern on 12/29/15.
|
||||
// Copyright © 2015 XION. All rights reserved.
|
||||
//
|
||||
|
||||
uniform sampler2D u_colorSampler;
|
||||
varying vec2 v_uv;
|
||||
varying vec2 v_blurTexCoords[14];
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(0.0);
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 0])*0.0044299121055113265;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 1])*0.00895781211794;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 2])*0.0215963866053;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 3])*0.0443683338718;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 4])*0.0776744219933;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 5])*0.115876621105;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 6])*0.147308056121;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_uv )*0.159576912161;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 7])*0.147308056121;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 8])*0.115876621105;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[ 9])*0.0776744219933;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[10])*0.0443683338718;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[11])*0.0215963866053;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[12])*0.00895781211794;
|
||||
gl_FragColor += texture2D(u_colorSampler, v_blurTexCoords[13])*0.0044299121055113265;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// VerticalBlur.vsh
|
||||
// XIONControlPanel
|
||||
//
|
||||
// Created by Charles Magahern on 12/29/15.
|
||||
// Copyright © 2015 XION. All rights reserved.
|
||||
//
|
||||
|
||||
attribute vec4 a_position;
|
||||
varying vec2 v_uv;
|
||||
varying vec2 v_blurTexCoords[14];
|
||||
|
||||
void main()
|
||||
{
|
||||
v_uv = (a_position.xy + 1.0) * 0.5;
|
||||
v_blurTexCoords[ 0] = v_uv + vec2(0.0, -0.028);
|
||||
v_blurTexCoords[ 1] = v_uv + vec2(0.0, -0.024);
|
||||
v_blurTexCoords[ 2] = v_uv + vec2(0.0, -0.020);
|
||||
v_blurTexCoords[ 3] = v_uv + vec2(0.0, -0.016);
|
||||
v_blurTexCoords[ 4] = v_uv + vec2(0.0, -0.012);
|
||||
v_blurTexCoords[ 5] = v_uv + vec2(0.0, -0.008);
|
||||
v_blurTexCoords[ 6] = v_uv + vec2(0.0, -0.004);
|
||||
v_blurTexCoords[ 7] = v_uv + vec2(0.0, 0.004);
|
||||
v_blurTexCoords[ 8] = v_uv + vec2(0.0, 0.008);
|
||||
v_blurTexCoords[ 9] = v_uv + vec2(0.0, 0.012);
|
||||
v_blurTexCoords[10] = v_uv + vec2(0.0, 0.016);
|
||||
v_blurTexCoords[11] = v_uv + vec2(0.0, 0.020);
|
||||
v_blurTexCoords[12] = v_uv + vec2(0.0, 0.024);
|
||||
v_blurTexCoords[13] = v_uv + vec2(0.0, 0.028);
|
||||
|
||||
gl_Position = a_position;
|
||||
}
|
||||
Reference in New Issue
Block a user