varying mediump vec2 var_texcoord0;
uniform lowp sampler2D texture_sampler;
uniform lowp vec4 tint;
varying vec2 blurCoordinates[9];
void main()
{
vec4 sum = vec4(0.0);
sum += texture2D(texture_sampler, blurCoordinates[0]) * 4.0;
sum += texture2D(texture_sampler, blurCoordinates[1]) * 2.0;
sum += texture2D(texture_sampler, blurCoordinates[2]) * 2.0;
sum += texture2D(texture_sampler, blurCoordinates[3]) * 2.0;
sum += texture2D(texture_sampler, blurCoordinates[4]) * 2.0;
sum += texture2D(texture_sampler, blurCoordinates[5]) * 1.0;
sum += texture2D(texture_sampler, blurCoordinates[6]) * 1.0;
sum += texture2D(texture_sampler, blurCoordinates[7]) * 1.0;
sum += texture2D(texture_sampler, blurCoordinates[8]) * 1.0;
sum /= 16.0;
gl_FragColor = sum;
}
スクリプト
function init(self)
local width = 128;
local height = 128;
model.set_constant("gameobject の url", "u_texelOffset", vmath.vector4(0.5/width , 0.5/height, 0, 0))
end