mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-12 17:21:08 -05:00
162 lines
5 KiB
Text
162 lines
5 KiB
Text
|
#version 300 es
|
||
|
uniform highp vec4 _ZBufferParams;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform highp sampler2D _CameraDepthTexture;
|
||
|
uniform sampler2D _VelTex;
|
||
|
uniform sampler2D _NeighbourMaxTex;
|
||
|
uniform sampler2D _NoiseTex;
|
||
|
uniform highp vec4 _MainTex_TexelSize;
|
||
|
uniform highp float _Jitter;
|
||
|
uniform highp float _MaxVelocity;
|
||
|
uniform highp float _SoftZDistance;
|
||
|
in highp vec2 xlv_TEXCOORD0;
|
||
|
out mediump vec4 _fragData;
|
||
|
void main ()
|
||
|
{
|
||
|
highp vec2 tmpvar_1;
|
||
|
tmpvar_1 = xlv_TEXCOORD0;
|
||
|
highp vec4 jitteredDir_3;
|
||
|
highp vec4 sum_4;
|
||
|
highp float weight_5;
|
||
|
highp float zx_6;
|
||
|
highp vec2 vx_7;
|
||
|
highp vec2 x_8;
|
||
|
highp vec2 xf_9;
|
||
|
xf_9 = xlv_TEXCOORD0;
|
||
|
x_8 = xlv_TEXCOORD0;
|
||
|
if ((_MainTex_TexelSize.y < 0.0)) {
|
||
|
xf_9.y = (1.0 - xlv_TEXCOORD0.y);
|
||
|
};
|
||
|
lowp vec4 tmpvar_10;
|
||
|
tmpvar_10 = textureLod (_NeighbourMaxTex, xf_9, 0.0);
|
||
|
highp vec2 tmpvar_11;
|
||
|
tmpvar_11 = tmpvar_10.xy;
|
||
|
lowp vec4 tmpvar_12;
|
||
|
tmpvar_12 = textureLod (_MainTex, xlv_TEXCOORD0, 0.0);
|
||
|
highp vec4 tmpvar_13;
|
||
|
tmpvar_13 = tmpvar_12;
|
||
|
lowp vec4 tmpvar_14;
|
||
|
tmpvar_14 = textureLod (_VelTex, xf_9, 0.0);
|
||
|
highp vec2 tmpvar_15;
|
||
|
tmpvar_15 = tmpvar_14.xy;
|
||
|
vx_7 = tmpvar_15;
|
||
|
highp vec4 tmpvar_16;
|
||
|
tmpvar_16.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_16.xy = xlv_TEXCOORD0;
|
||
|
highp vec4 coord_17;
|
||
|
coord_17 = (tmpvar_16 * 11.0);
|
||
|
lowp vec4 tmpvar_18;
|
||
|
tmpvar_18 = textureLod (_NoiseTex, coord_17.xy, coord_17.w);
|
||
|
highp vec4 tmpvar_19;
|
||
|
tmpvar_19 = ((tmpvar_18 * 2.0) - 1.0);
|
||
|
zx_6 = -((1.0/((
|
||
|
(_ZBufferParams.x * textureLod (_CameraDepthTexture, xlv_TEXCOORD0, 0.0).x)
|
||
|
+ _ZBufferParams.y))));
|
||
|
weight_5 = 1.0;
|
||
|
sum_4 = tmpvar_13;
|
||
|
highp vec4 tmpvar_20;
|
||
|
tmpvar_20 = (tmpvar_11.xyxy + (tmpvar_19 * (_MainTex_TexelSize.xyxy * _Jitter)).xyyz);
|
||
|
jitteredDir_3 = ((max (
|
||
|
abs(tmpvar_20.xyxy)
|
||
|
,
|
||
|
((_MainTex_TexelSize.xyxy * _MaxVelocity) * 0.15)
|
||
|
) * sign(tmpvar_20.xyxy)) * vec4(1.0, 1.0, -1.0, -1.0));
|
||
|
for (highp int l_2 = 0; l_2 < 12; l_2++) {
|
||
|
highp float zy_21;
|
||
|
highp vec4 yf_22;
|
||
|
highp vec4 tmpvar_23;
|
||
|
tmpvar_23 = (tmpvar_1.xyxy + ((jitteredDir_3.xyxy * vec2[12](vec2(-0.326212, -0.40581), vec2(-0.840144, -0.07358), vec2(-0.695914, 0.457137), vec2(-0.203345, 0.620716), vec2(0.96234, -0.194983), vec2(0.473434, -0.480026), vec2(0.519456, 0.767022), vec2(0.185461, -0.893124), vec2(0.507431, 0.064425), vec2(0.89642, 0.412458), vec2(-0.32194, -0.932615), vec2(-0.791559, -0.59771))[l_2].xyxy) * vec4(1.0, 1.0, -1.0, -1.0)));
|
||
|
yf_22 = tmpvar_23;
|
||
|
if ((_MainTex_TexelSize.y < 0.0)) {
|
||
|
yf_22.yw = (1.0 - tmpvar_23.yw);
|
||
|
};
|
||
|
lowp vec4 tmpvar_24;
|
||
|
tmpvar_24 = textureLod (_VelTex, yf_22.xy, 0.0);
|
||
|
highp vec2 tmpvar_25;
|
||
|
tmpvar_25 = tmpvar_24.xy;
|
||
|
zy_21 = -((1.0/((
|
||
|
(_ZBufferParams.x * textureLod (_CameraDepthTexture, tmpvar_23.xy, 0.0).x)
|
||
|
+ _ZBufferParams.y))));
|
||
|
highp vec2 x_26;
|
||
|
x_26 = (x_8 - tmpvar_23.xy);
|
||
|
highp vec2 x_27;
|
||
|
x_27 = (tmpvar_23.xy - x_8);
|
||
|
highp float tmpvar_28;
|
||
|
tmpvar_28 = sqrt(dot (tmpvar_25, tmpvar_25));
|
||
|
highp vec2 x_29;
|
||
|
x_29 = (tmpvar_23.xy - x_8);
|
||
|
highp float edge0_30;
|
||
|
edge0_30 = (0.95 * tmpvar_28);
|
||
|
highp float tmpvar_31;
|
||
|
tmpvar_31 = clamp (((
|
||
|
sqrt(dot (x_29, x_29))
|
||
|
- edge0_30) / (
|
||
|
(1.05 * tmpvar_28)
|
||
|
- edge0_30)), 0.0, 1.0);
|
||
|
highp float tmpvar_32;
|
||
|
tmpvar_32 = sqrt(dot (vx_7, vx_7));
|
||
|
highp vec2 x_33;
|
||
|
x_33 = (x_8 - tmpvar_23.xy);
|
||
|
highp float edge0_34;
|
||
|
edge0_34 = (0.95 * tmpvar_32);
|
||
|
highp float tmpvar_35;
|
||
|
tmpvar_35 = clamp (((
|
||
|
sqrt(dot (x_33, x_33))
|
||
|
- edge0_34) / (
|
||
|
(1.05 * tmpvar_32)
|
||
|
- edge0_34)), 0.0, 1.0);
|
||
|
highp float tmpvar_36;
|
||
|
tmpvar_36 = (((
|
||
|
clamp ((1.0 - ((zy_21 - zx_6) / _SoftZDistance)), 0.0, 1.0)
|
||
|
*
|
||
|
clamp ((1.0 - (sqrt(
|
||
|
dot (x_26, x_26)
|
||
|
) / sqrt(
|
||
|
dot (vx_7, vx_7)
|
||
|
))), 0.0, 1.0)
|
||
|
) + (
|
||
|
clamp ((1.0 - ((zx_6 - zy_21) / _SoftZDistance)), 0.0, 1.0)
|
||
|
*
|
||
|
clamp ((1.0 - (sqrt(
|
||
|
dot (x_27, x_27)
|
||
|
) / sqrt(
|
||
|
dot (tmpvar_25, tmpvar_25)
|
||
|
))), 0.0, 1.0)
|
||
|
)) + ((
|
||
|
(1.0 - (tmpvar_31 * (tmpvar_31 * (3.0 -
|
||
|
(2.0 * tmpvar_31)
|
||
|
))))
|
||
|
*
|
||
|
(1.0 - (tmpvar_35 * (tmpvar_35 * (3.0 -
|
||
|
(2.0 * tmpvar_35)
|
||
|
))))
|
||
|
) * 2.0));
|
||
|
lowp vec4 tmpvar_37;
|
||
|
tmpvar_37 = textureLod (_MainTex, tmpvar_23.xy, 0.0);
|
||
|
highp vec4 tmpvar_38;
|
||
|
tmpvar_38 = tmpvar_37;
|
||
|
sum_4 = (sum_4 + (tmpvar_38 * tmpvar_36));
|
||
|
weight_5 = (weight_5 + tmpvar_36);
|
||
|
};
|
||
|
highp vec4 tmpvar_39;
|
||
|
tmpvar_39 = (sum_4 / weight_5);
|
||
|
_fragData = tmpvar_39;
|
||
|
}
|
||
|
|
||
|
|
||
|
// stats: 99 alu 8 tex 4 flow
|
||
|
// inputs: 1
|
||
|
// #0: xlv_TEXCOORD0 (high float) 2x1 [-1]
|
||
|
// uniforms: 5 (total size: 0)
|
||
|
// #0: _ZBufferParams (high float) 4x1 [-1]
|
||
|
// #1: _MainTex_TexelSize (high float) 4x1 [-1]
|
||
|
// #2: _Jitter (high float) 1x1 [-1]
|
||
|
// #3: _MaxVelocity (high float) 1x1 [-1]
|
||
|
// #4: _SoftZDistance (high float) 1x1 [-1]
|
||
|
// textures: 5
|
||
|
// #0: _MainTex (low 2d) 0x0 [-1]
|
||
|
// #1: _CameraDepthTexture (high 2d) 0x0 [-1]
|
||
|
// #2: _VelTex (low 2d) 0x0 [-1]
|
||
|
// #3: _NeighbourMaxTex (low 2d) 0x0 [-1]
|
||
|
// #4: _NoiseTex (low 2d) 0x0 [-1]
|