This commit is contained in:
2025-04-29 13:39:02 -05:00
commit 9cbb583982
2257 changed files with 77258 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
{
"version" : 1,
"replacementkey" : "blur_precise",
"name" : "ui_editor_effect_blur_precise_title",
"description" : "ui_editor_effect_blur_precise_description",
"group" : "blur",
"performance" : "expensive",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/blur_precise_gaussian_x.json",
"target" : "_rt_FullCompoBuffer1"
},
{
"material" : "materials/effects/blur_precise_gaussian_y.json",
"bind" :
[
{
"name" : "_rt_FullCompoBuffer1",
"index" : 0
},
{
"name" : "previous",
"index" : 1
}
]
}
],
"fbos" :
[
{
"name" : "_rt_FullCompoBuffer1",
"format" : "rgba_backbuffer"
}
],
"dependencies" :
[
"materials/effects/blur_precise_gaussian_x.json",
"materials/effects/blur_precise_gaussian_y.json",
"shaders/effects/blur_precise_gaussian.frag",
"shaders/effects/blur_precise_gaussian.vert"
]
}

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/blur_precise_gaussian",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,13 @@
{
"passes": [{
"shader": "effects/blur_precise_gaussian",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull",
"combos": {
"VERTICAL" : 1,
"ENABLEMASK" : 1
}
}]
}

View File

@@ -0,0 +1,82 @@
{
"name" : "Blur",
"description" : "Apply gaussian blur to a section of the image.",
"group" : "composite",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/blur_downsample4.json",
"target" : "_rt_QuarterCompoBuffer1",
"bind" :
[
{
"name" : "previous",
"index" : 0
}
]
},
{
"material" : "materials/effects/blur_gaussian_x.json",
"target" : "_rt_QuarterCompoBuffer2",
"bind" :
[
{
"name" : "_rt_QuarterCompoBuffer1",
"index" : 0
}
]
},
{
"material" : "materials/effects/blur_gaussian_y.json",
"target" : "_rt_QuarterCompoBuffer1",
"bind" :
[
{
"name" : "_rt_QuarterCompoBuffer2",
"index" : 0
}
]
},
{
"material" : "materials/effects/blur_combine.json",
"bind" :
[
{
"name" : "_rt_QuarterCompoBuffer1",
"index" : 0
},
{
"name" : "previous",
"index" : 2
}
]
}
],
"fbos" :
[
{
"name" : "_rt_QuarterCompoBuffer1",
"scale" : 4,
"format" : "rgba8888"
},
{
"name" : "_rt_QuarterCompoBuffer2",
"scale" : 4,
"format" : "rgba8888"
}
],
"dependencies" :
[
"materials/effects/blur_downsample4.json",
"materials/effects/blur_gaussian_x.json",
"materials/effects/blur_gaussian_y.json",
"materials/effects/blur_combine.json",
"shaders/effects/blur_downsample4.frag",
"shaders/effects/blur_downsample4.vert",
"shaders/effects/blur_gaussian.frag",
"shaders/effects/blur_gaussian.vert",
"shaders/effects/blur_combine.frag",
"shaders/effects/blur_combine.vert"
]
}

View File

@@ -0,0 +1,45 @@
{
"name" : "Blur (precise)",
"description" : "Apply gaussian blur to the entire image in full resolution.",
"group" : "composite",
//"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/blur_precise_gaussian_x.json",
"target" : "_rt_FullCompoBuffer1",
"bind" :
[
{
"name" : "previous",
"index" : 0
}
]
},
{
"material" : "materials/effects/blur_precise_gaussian_y.json",
"bind" :
[
{
"name" : "_rt_FullCompoBuffer1",
"index" : 0
}
]
}
],
"fbos" :
[
{
"name" : "_rt_FullCompoBuffer1",
"scale" : 1,
"format" : "rgba8888"
}
],
"dependencies" :
[
"materials/effects/blur_precise_gaussian_x.json",
"materials/effects/blur_precise_gaussian_y.json",
"shaders/effects/blur_precise_gaussian.frag",
"shaders/effects/blur_precise_gaussian.vert"
]
}

View File

@@ -0,0 +1,18 @@
{
"name" : "Edge Detection",
"description" : "Detects edges of the image using the sobel filter.",
"group" : "image",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/edgedetection.json"
}
],
"dependencies" :
[
"materials/effects/edgedetection.json",
"shaders/effects/edgedetection.frag",
"shaders/effects/edgedetection.vert"
]
}

View File

@@ -0,0 +1,13 @@
{
"passes" :
[
{
"blending" : "translucent",
"cullmode" : "nocull",
"depthtest" : "disabled",
"depthwrite" : "disabled",
"shader" : "genericimage2",
"textures" : [ "effectpreview" ]
}
]
}

View File

@@ -0,0 +1,6 @@
{
"clampuvs" : true,
"format" : "rgba8888",
"nomip" : true,
"nonpoweroftwo" : true
}

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/blur_combine",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/blur_downsample4",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/blur_gaussian",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,12 @@
{
"passes": [{
"shader": "effects/blur_gaussian",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull",
"combos": {
"VERTICAL" : 1
}
}]
}

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/blur_precise_gaussian",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,12 @@
{
"passes": [{
"shader": "effects/blur_precise_gaussian",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull",
"combos": {
"VERTICAL" : 1
}
}]
}

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/edgedetection",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,4 @@
{
"autosize" : true,
"material" : "materials/effectpreview.json"
}

View File

@@ -0,0 +1,18 @@
{
"file" : "scene.json",
"general" :
{
"properties" :
{
"schemecolor" :
{
"order" : 0,
"text" : "ui_browse_properties_scheme_color",
"type" : "color",
"value" : "0 0 0"
}
}
},
"title" : "preview",
"type" : "scene"
}

View File

@@ -0,0 +1,69 @@
{
"camera" :
{
"center" : "0.000 0.000 -1.000",
"eye" : "0.000 0.000 0.000",
"up" : "0.000 1.000 0.000"
},
"general" :
{
"ambientcolor" : "0.3 0.3 0.3",
"bloom" : false,
"bloomstrength" : 2,
"bloomthreshold" : 0.64999997615814209,
"cameraparallax" : false,
"cameraparallaxamount" : 0.5,
"cameraparallaxdelay" : 0.10000000149011612,
"cameraparallaxmouseinfluence" : 0,
"camerapreview" : true,
"camerashake" : false,
"camerashakeamplitude" : 0.5,
"camerashakeroughness" : 1,
"camerashakespeed" : 3,
"clearcolor" : "0.7 0.7 0.7",
"orthogonalprojection" :
{
"height" : 256,
"width" : 256
},
"skylightcolor" : "0.3 0.3 0.3"
},
"objects" :
[
{
"angles" : "0.000 0.000 0.000",
"copybackground" : true,
"depth" : 1,
"effects" :
[
{
"file" : "effects/blurprecise/effect.json",
"passes" :
[
{
"combos" :
{
"KERNEL" : 0
}
},
{
"combos" :
{
"KERNEL" : 0,
"VERTICAL" : 1
}
}
]
}
],
"id" : 38,
"image" : "models/effectpreview.json",
"name" : "",
"origin" : "128.000 128.000 0.000",
"parallaxDepth" : "1.000 1.000",
"scale" : "1.000 1.000 1.000",
"size" : "256.000 256.000",
"visible" : true
}
]
}

View File

@@ -0,0 +1,14 @@
varying vec4 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Mask","mode":"opacitymask","default":"util/white"}
uniform sampler2D g_Texture2; // {"material":"Prev","hidden":true}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
vec4 albedoOld = texSample2D(g_Texture2, v_TexCoord.xy);
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
albedo = mix(albedoOld, albedo, mask);
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,16 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord.xy = a_TexCoord;
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture1Resolution.z / g_Texture1Resolution.x,
v_TexCoord.y * g_Texture1Resolution.w / g_Texture1Resolution.y);
}

View File

@@ -0,0 +1,12 @@
varying vec4 v_TexCoord01;
varying vec4 v_TexCoord23;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
void main() {
gl_FragColor = (texSample2D(g_Texture0, v_TexCoord01.xy) +
texSample2D(g_Texture0, v_TexCoord01.zw) +
texSample2D(g_Texture0, v_TexCoord23.xy) +
texSample2D(g_Texture0, v_TexCoord23.zw)) * 0.25;
}

View File

@@ -0,0 +1,18 @@
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord01;
varying vec4 v_TexCoord23;
uniform vec4 g_Texture0Resolution;
void main() {
gl_Position = vec4(a_Position, 1.0);
vec2 offsets = 1.0 / g_Texture0Resolution.zw;
v_TexCoord01.xy = a_TexCoord - offsets;
v_TexCoord01.zw = a_TexCoord + vec2(offsets.x, -offsets.y);
v_TexCoord23.xy = a_TexCoord + vec2(-offsets.x, offsets.y);
v_TexCoord23.zw = a_TexCoord + offsets;
}

View File

@@ -0,0 +1,46 @@
#if KERNEL == 0
varying vec2 v_TexCoord[13];
#endif
#if KERNEL == 1
varying vec2 v_TexCoord[7];
#endif
#if KERNEL == 2
varying vec2 v_TexCoord[3];
#endif
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
void main() {
#if KERNEL == 0
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.006299 +
texSample2D(g_Texture0, v_TexCoord[1]) * 0.017298 +
texSample2D(g_Texture0, v_TexCoord[2]) * 0.039533 +
texSample2D(g_Texture0, v_TexCoord[3]) * 0.075189 +
texSample2D(g_Texture0, v_TexCoord[4]) * 0.119007 +
texSample2D(g_Texture0, v_TexCoord[5]) * 0.156756 +
texSample2D(g_Texture0, v_TexCoord[6]) * 0.171834 +
texSample2D(g_Texture0, v_TexCoord[7]) * 0.156756 +
texSample2D(g_Texture0, v_TexCoord[8]) * 0.119007 +
texSample2D(g_Texture0, v_TexCoord[9]) * 0.075189 +
texSample2D(g_Texture0, v_TexCoord[10]) * 0.039533 +
texSample2D(g_Texture0, v_TexCoord[11]) * 0.017298 +
texSample2D(g_Texture0, v_TexCoord[12]) * 0.006299;
#endif
#if KERNEL == 1
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.071303 +
texSample2D(g_Texture0, v_TexCoord[1]) * 0.131514 +
texSample2D(g_Texture0, v_TexCoord[2]) * 0.189879 +
texSample2D(g_Texture0, v_TexCoord[3]) * 0.214607 +
texSample2D(g_Texture0, v_TexCoord[4]) * 0.189879 +
texSample2D(g_Texture0, v_TexCoord[5]) * 0.131514 +
texSample2D(g_Texture0, v_TexCoord[6]) * 0.071303;
#endif
#if KERNEL == 2
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.25 +
texSample2D(g_Texture0, v_TexCoord[1]) * 0.5 +
texSample2D(g_Texture0, v_TexCoord[2]) * 0.25;
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,61 @@
// [COMBO] {"material":"Kernel size","combo":"KERNEL","type":"options","default":0,"options":{"13x13":0,"7x7":1,"3x3":2}}
uniform vec2 g_Scale; // {"material":"Scale","default":"1 1","linked":true,"range":[0.01, 2.0]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
#if KERNEL == 0
varying vec2 v_TexCoord[13];
#endif
#if KERNEL == 1
varying vec2 v_TexCoord[7];
#endif
#if KERNEL == 2
varying vec2 v_TexCoord[3];
#endif
uniform vec4 g_Texture0Resolution;
void main() {
gl_Position = vec4(a_Position, 1.0);
#if VERTICAL
float offsetX = 0.0f;
float offsetY = g_Scale.y / g_Texture0Resolution.w;
#else
float offsetX = g_Scale.x / g_Texture0Resolution.z;
float offsetY = 0.0f;
#endif
#if KERNEL == 0
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX * 6.0, a_TexCoord.y - offsetY * 6.0);
v_TexCoord[1] = vec2(a_TexCoord.x - offsetX * 5.0, a_TexCoord.y - offsetY * 5.0);
v_TexCoord[2] = vec2(a_TexCoord.x - offsetX * 4.0, a_TexCoord.y - offsetY * 4.0);
v_TexCoord[3] = vec2(a_TexCoord.x - offsetX * 3.0, a_TexCoord.y - offsetY * 3.0);
v_TexCoord[4] = vec2(a_TexCoord.x - offsetX * 2.0, a_TexCoord.y - offsetY * 2.0);
v_TexCoord[5] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
v_TexCoord[6] = vec2(a_TexCoord.x, a_TexCoord.y);
v_TexCoord[7] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
v_TexCoord[8] = vec2(a_TexCoord.x + offsetX * 2.0, a_TexCoord.y + offsetY * 2.0);
v_TexCoord[9] = vec2(a_TexCoord.x + offsetX * 3.0, a_TexCoord.y + offsetY * 3.0);
v_TexCoord[10] = vec2(a_TexCoord.x + offsetX * 4.0, a_TexCoord.y + offsetY * 4.0);
v_TexCoord[11] = vec2(a_TexCoord.x + offsetX * 5.0, a_TexCoord.y + offsetY * 5.0);
v_TexCoord[12] = vec2(a_TexCoord.x + offsetX * 6.0, a_TexCoord.y + offsetY * 6.0);
#endif
#if KERNEL == 1
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX * 3.0, a_TexCoord.y - offsetY * 3.0);
v_TexCoord[1] = vec2(a_TexCoord.x - offsetX * 2.0, a_TexCoord.y - offsetY * 2.0);
v_TexCoord[2] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
v_TexCoord[3] = vec2(a_TexCoord.x, a_TexCoord.y);
v_TexCoord[4] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
v_TexCoord[5] = vec2(a_TexCoord.x + offsetX * 2.0, a_TexCoord.y + offsetY * 2.0);
v_TexCoord[6] = vec2(a_TexCoord.x + offsetX * 3.0, a_TexCoord.y + offsetY * 3.0);
#endif
#if KERNEL == 2
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
v_TexCoord[1] = vec2(a_TexCoord.x, a_TexCoord.y);
v_TexCoord[2] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
#endif
}

View File

@@ -0,0 +1,46 @@
#if KERNEL == 0
varying vec2 v_TexCoord[13];
#endif
#if KERNEL == 1
varying vec2 v_TexCoord[7];
#endif
#if KERNEL == 2
varying vec2 v_TexCoord[3];
#endif
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
void main() {
#if KERNEL == 0
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.006299 +
texSample2D(g_Texture0, v_TexCoord[1]) * 0.017298 +
texSample2D(g_Texture0, v_TexCoord[2]) * 0.039533 +
texSample2D(g_Texture0, v_TexCoord[3]) * 0.075189 +
texSample2D(g_Texture0, v_TexCoord[4]) * 0.119007 +
texSample2D(g_Texture0, v_TexCoord[5]) * 0.156756 +
texSample2D(g_Texture0, v_TexCoord[6]) * 0.171834 +
texSample2D(g_Texture0, v_TexCoord[7]) * 0.156756 +
texSample2D(g_Texture0, v_TexCoord[8]) * 0.119007 +
texSample2D(g_Texture0, v_TexCoord[9]) * 0.075189 +
texSample2D(g_Texture0, v_TexCoord[10]) * 0.039533 +
texSample2D(g_Texture0, v_TexCoord[11]) * 0.017298 +
texSample2D(g_Texture0, v_TexCoord[12]) * 0.006299;
#endif
#if KERNEL == 1
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.071303 +
texSample2D(g_Texture0, v_TexCoord[1]) * 0.131514 +
texSample2D(g_Texture0, v_TexCoord[2]) * 0.189879 +
texSample2D(g_Texture0, v_TexCoord[3]) * 0.214607 +
texSample2D(g_Texture0, v_TexCoord[4]) * 0.189879 +
texSample2D(g_Texture0, v_TexCoord[5]) * 0.131514 +
texSample2D(g_Texture0, v_TexCoord[6]) * 0.071303;
#endif
#if KERNEL == 2
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.27901 +
texSample2D(g_Texture0, v_TexCoord[1]) * 0.44198 +
texSample2D(g_Texture0, v_TexCoord[2]) * 0.27901;
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,66 @@
// [COMBO] {"material":"Kernel size","combo":"KERNEL","type":"options","default":2,"options":{"13x13":0,"7x7":1,"3x3":2}}
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec2 g_Scale; // {"material":"Scale","default":"1 1","linked":true,"range":[0.01, 2.0]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
#if KERNEL == 0
varying vec2 v_TexCoord[13];
#endif
#if KERNEL == 1
varying vec2 v_TexCoord[7];
#endif
#if KERNEL == 2
varying vec2 v_TexCoord[3];
#endif
uniform vec4 g_Texture0Resolution;
void main() {
#if VERTICAL
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
#else
gl_Position = vec4(a_Position, 1.0);
#endif
#if VERTICAL
float offsetX = 0.0f;
float offsetY = g_Scale.y / g_Texture0Resolution.w;
#else
float offsetX = g_Scale.x / g_Texture0Resolution.z;
float offsetY = 0.0f;
#endif
#if KERNEL == 0
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX * 6.0, a_TexCoord.y - offsetY * 6.0);
v_TexCoord[1] = vec2(a_TexCoord.x - offsetX * 5.0, a_TexCoord.y - offsetY * 5.0);
v_TexCoord[2] = vec2(a_TexCoord.x - offsetX * 4.0, a_TexCoord.y - offsetY * 4.0);
v_TexCoord[3] = vec2(a_TexCoord.x - offsetX * 3.0, a_TexCoord.y - offsetY * 3.0);
v_TexCoord[4] = vec2(a_TexCoord.x - offsetX * 2.0, a_TexCoord.y - offsetY * 2.0);
v_TexCoord[5] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
v_TexCoord[6] = vec2(a_TexCoord.x, a_TexCoord.y);
v_TexCoord[7] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
v_TexCoord[8] = vec2(a_TexCoord.x + offsetX * 2.0, a_TexCoord.y + offsetY * 2.0);
v_TexCoord[9] = vec2(a_TexCoord.x + offsetX * 3.0, a_TexCoord.y + offsetY * 3.0);
v_TexCoord[10] = vec2(a_TexCoord.x + offsetX * 4.0, a_TexCoord.y + offsetY * 4.0);
v_TexCoord[11] = vec2(a_TexCoord.x + offsetX * 5.0, a_TexCoord.y + offsetY * 5.0);
v_TexCoord[12] = vec2(a_TexCoord.x + offsetX * 6.0, a_TexCoord.y + offsetY * 6.0);
#endif
#if KERNEL == 1
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX * 3.0, a_TexCoord.y - offsetY * 3.0);
v_TexCoord[1] = vec2(a_TexCoord.x - offsetX * 2.0, a_TexCoord.y - offsetY * 2.0);
v_TexCoord[2] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
v_TexCoord[3] = vec2(a_TexCoord.x, a_TexCoord.y);
v_TexCoord[4] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
v_TexCoord[5] = vec2(a_TexCoord.x + offsetX * 2.0, a_TexCoord.y + offsetY * 2.0);
v_TexCoord[6] = vec2(a_TexCoord.x + offsetX * 3.0, a_TexCoord.y + offsetY * 3.0);
#endif
#if KERNEL == 2
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
v_TexCoord[1] = vec2(a_TexCoord.x, a_TexCoord.y);
v_TexCoord[2] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
#endif
}

View File

@@ -0,0 +1,40 @@
// [COMBO] {"material":"Blend mode","combo":"BLENDMODE","type":"imageblending","default":0}
#include "common.h"
#include "common_blending.h"
varying vec2 v_TexCoordKernel[9];
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform float g_BlendAlpha; // {"material":"Alpha","default":1,"range":[0.01,1]}
uniform vec3 g_OutlineColor1; // {"material":"Outline color","default":"0 0 0","type":"color"}
uniform vec3 g_OutlineColor2; // {"material":"Outline background","default":"1 1 1","type":"color"}
uniform float g_DetectionThreshold; // {"material":"Detection threshold","default":0.5,"range":[0,5]}
uniform float g_DetectionMultiply; // {"material":"Detection multiply","default":1,"range":[0,5]}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoordKernel[4]);
vec3 sample00 = texSample2D(g_Texture0, v_TexCoordKernel[0]).rgb;
vec3 sample10 = texSample2D(g_Texture0, v_TexCoordKernel[1]).rgb;
vec3 sample20 = texSample2D(g_Texture0, v_TexCoordKernel[2]).rgb;
vec3 sample01 = texSample2D(g_Texture0, v_TexCoordKernel[3]).rgb;
vec3 sample21 = texSample2D(g_Texture0, v_TexCoordKernel[5]).rgb;
vec3 sample02 = texSample2D(g_Texture0, v_TexCoordKernel[6]).rgb;
vec3 sample12 = texSample2D(g_Texture0, v_TexCoordKernel[7]).rgb;
vec3 sample22 = texSample2D(g_Texture0, v_TexCoordKernel[8]).rgb;
vec3 gx = sample20 - sample00 + (sample21 - sample01) * 2 + sample22 - sample02;
vec3 gy = sample00 - sample02 + (sample10 - sample12) * 2 + sample20 - sample22;
float g = abs(greyscale(gx)) + abs(greyscale(gy));
vec3 combinedColor = mix(g_OutlineColor2, g_OutlineColor1,
min(1.0, max(0.0, g - g_DetectionThreshold) * g_DetectionMultiply));
gl_FragColor.a = albedo.a;
gl_FragColor.rgb = ApplyBlending(BLENDMODE, albedo.rgb, combinedColor, g_BlendAlpha);
}

View File

@@ -0,0 +1,26 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture0Resolution;
uniform float g_DetectionSize; // {"material":"Detection size","default":1,"range":[0,5]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec2 v_TexCoordKernel[9];
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
vec2 texelSize = vec2(1.0 / g_Texture0Resolution.z, 1.0 / g_Texture0Resolution.w) * g_DetectionSize;
v_TexCoordKernel[0] = a_TexCoord - texelSize;
v_TexCoordKernel[1] = a_TexCoord - vec2(0.0, texelSize.y);
v_TexCoordKernel[2] = a_TexCoord + vec2(texelSize.x, -texelSize.y);
v_TexCoordKernel[3] = a_TexCoord - vec2(texelSize.x, 0.0);
v_TexCoordKernel[4] = a_TexCoord;
v_TexCoordKernel[5] = a_TexCoord + vec2(texelSize.x, 0.0);
v_TexCoordKernel[6] = a_TexCoord + vec2(-texelSize.x, texelSize.y);
v_TexCoordKernel[7] = a_TexCoord + vec2(0.0, texelSize.y);
v_TexCoordKernel[8] = a_TexCoord + texelSize;
}

View File

@@ -0,0 +1,4 @@
{
"name": "FX Preview",
"type": "scene2d"
}

View File

@@ -0,0 +1,40 @@
// [COMBO] {"material":"ui_editor_properties_blur_alpha","combo":"BLURALPHA","type":"options","default":1}
#include "common_blur.h"
varying vec4 v_TexCoord;
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture1; // {"hidden":true}
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","combo":"MASK","paintdefaultcolor":"0 0 0 1","require":{"ENABLEMASK":1}}
#if MASK
varying vec2 v_TexCoordMask;
#endif
void main() {
#if KERNEL == 0
vec4 albedo = blur13a(v_TexCoord.xy, v_TexCoord.zw);
#endif
#if KERNEL == 1
vec4 albedo = blur7a(v_TexCoord.xy, v_TexCoord.zw);
#endif
#if KERNEL == 2
vec4 albedo = blur3a(v_TexCoord.xy, v_TexCoord.zw);
#endif
#if MASK || BLURALPHA == 0
vec4 prev = texSample2D(g_Texture1, v_TexCoord.xy);
#endif
#if MASK
albedo = mix(prev, albedo, texSample2D(g_Texture2, v_TexCoordMask.xy).r);
#endif
#if BLURALPHA == 0
albedo.a = prev.a;
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,40 @@
// [COMBO] {"material":"ui_editor_properties_kernel_size","combo":"KERNEL","type":"options","default":0,"options":{"13x13":0,"7x7":1,"3x3":2}}
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec2 g_Scale; // {"material":"scale","label":"ui_editor_properties_scale","default":"1 1","linked":true,"range":[0.01, 2.0]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
uniform vec4 g_Texture0Resolution;
#if MASK
uniform vec4 g_Texture2Resolution;
varying vec2 v_TexCoordMask;
#endif
void main() {
#if VERTICAL
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
#else
gl_Position = vec4(a_Position, 1.0);
#endif
v_TexCoord.xy = a_TexCoord;
#if VERTICAL
v_TexCoord.z = 0;
v_TexCoord.w = g_Scale.y / g_Texture0Resolution.w;
#else
v_TexCoord.z = g_Scale.x / g_Texture0Resolution.z;
v_TexCoord.w = 0;
#endif
#if MASK
v_TexCoordMask.xy = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
#endif
}