mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
85 lines
2.8 KiB
Text
85 lines
2.8 KiB
Text
#version 300 es
|
|
layout(location=0) out mediump vec4 _glesFragData[4];
|
|
uniform highp vec4 _ProjectionParams;
|
|
uniform sampler2D _CameraDepthNormalsTexture;
|
|
uniform sampler2D _RandomTexture;
|
|
uniform highp vec4 _Params;
|
|
in highp vec2 xlv_TEXCOORD0;
|
|
in highp vec2 xlv_TEXCOORD1;
|
|
void main ()
|
|
{
|
|
mediump float tmpvar_1;
|
|
highp vec2 tmpvar_2;
|
|
tmpvar_2 = xlv_TEXCOORD0;
|
|
highp float occ_4;
|
|
highp float scale_5;
|
|
highp float depth_6;
|
|
highp vec3 viewNorm_7;
|
|
highp vec4 depthnormal_8;
|
|
mediump vec3 randN_9;
|
|
lowp vec3 tmpvar_10;
|
|
tmpvar_10 = ((texture (_RandomTexture, xlv_TEXCOORD1).xyz * 2.0) - 1.0);
|
|
randN_9 = tmpvar_10;
|
|
lowp vec4 tmpvar_11;
|
|
tmpvar_11 = texture (_CameraDepthNormalsTexture, xlv_TEXCOORD0);
|
|
depthnormal_8 = tmpvar_11;
|
|
highp vec3 n_12;
|
|
highp vec3 tmpvar_13;
|
|
tmpvar_13 = ((depthnormal_8.xyz * vec3(3.5554, 3.5554, 0.0)) + vec3(-1.7777, -1.7777, 1.0));
|
|
highp float tmpvar_14;
|
|
tmpvar_14 = (2.0 / dot (tmpvar_13, tmpvar_13));
|
|
n_12.xy = (tmpvar_14 * tmpvar_13.xy);
|
|
n_12.z = (tmpvar_14 - 1.0);
|
|
viewNorm_7 = n_12;
|
|
highp float tmpvar_15;
|
|
tmpvar_15 = (dot (depthnormal_8.zw, vec2(1.0, 0.00392157)) * _ProjectionParams.z);
|
|
depth_6 = tmpvar_15;
|
|
scale_5 = (_Params.x / tmpvar_15);
|
|
occ_4 = 0.0;
|
|
for (int s_3 = 0; s_3 < 8; s_3++) {
|
|
highp vec4 sampleND_16;
|
|
mediump vec3 randomDir_17;
|
|
highp vec3 tmpvar_18;
|
|
highp vec3 I_19;
|
|
I_19 = vec3[8](vec3(0.0130572, 0.587232, -0.119337), vec3(0.323078, 0.0220727, -0.418873), vec3(-0.310725, -0.191367, 0.0561369), vec3(-0.479646, 0.0939877, -0.580265), vec3(0.139999, -0.33577, 0.559679), vec3(-0.248458, 0.255532, 0.348944), vec3(0.18719, -0.702764, -0.231748), vec3(0.884915, 0.284208, 0.368524))[s_3];
|
|
tmpvar_18 = (I_19 - (2.0 * (
|
|
dot (randN_9, I_19)
|
|
* randN_9)));
|
|
randomDir_17 = tmpvar_18;
|
|
highp float tmpvar_20;
|
|
tmpvar_20 = dot (viewNorm_7, randomDir_17);
|
|
mediump float tmpvar_21;
|
|
if ((tmpvar_20 < 0.0)) {
|
|
tmpvar_21 = 1.0;
|
|
} else {
|
|
tmpvar_21 = -1.0;
|
|
};
|
|
mediump vec3 tmpvar_22;
|
|
tmpvar_22 = (randomDir_17 * -(tmpvar_21));
|
|
highp vec3 tmpvar_23;
|
|
tmpvar_23 = (tmpvar_22 + (viewNorm_7 * 0.3));
|
|
randomDir_17 = tmpvar_23;
|
|
lowp vec4 tmpvar_24;
|
|
highp vec2 P_25;
|
|
P_25 = (tmpvar_2 + (randomDir_17.xy * scale_5));
|
|
tmpvar_24 = texture (_CameraDepthNormalsTexture, P_25);
|
|
sampleND_16 = tmpvar_24;
|
|
highp float tmpvar_26;
|
|
tmpvar_26 = clamp (((depth_6 -
|
|
(randomDir_17.z * _Params.x)
|
|
) - (
|
|
dot (sampleND_16.zw, vec2(1.0, 0.00392157))
|
|
* _ProjectionParams.z)), 0.0, 1.0);
|
|
if ((tmpvar_26 > _Params.y)) {
|
|
occ_4 = (occ_4 + pow ((1.0 - tmpvar_26), _Params.z));
|
|
};
|
|
};
|
|
highp float tmpvar_27;
|
|
tmpvar_27 = (occ_4 / 8.0);
|
|
occ_4 = tmpvar_27;
|
|
tmpvar_1 = (1.0 - tmpvar_27);
|
|
_glesFragData[0] = vec4(tmpvar_1);
|
|
}
|
|
|
|
|
|
// inputs: 2, stats: 41 alu 3 tex 4 flow
|