stuff
This commit is contained in:
85
modules/wallpaper-engine/effects/blur/effect.json
Normal file
85
modules/wallpaper-engine/effects/blur/effect.json
Normal file
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"version" : 1,
|
||||
"replacementkey" : "blur",
|
||||
"name" : "ui_editor_effect_blur_title",
|
||||
"description" : "ui_editor_effect_blur_description",
|
||||
"group" : "blur",
|
||||
"performance" : "expensive",
|
||||
"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" : "rgba_backbuffer"
|
||||
},
|
||||
{
|
||||
"name" : "_rt_QuarterCompoBuffer2",
|
||||
"scale" : 4,
|
||||
"format" : "rgba_backbuffer"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/blur_combine",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/blur_downsample4",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/blur_gaussian",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/blur_gaussian",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull",
|
||||
"combos": {
|
||||
"VERTICAL" : 1
|
||||
}
|
||||
}]
|
||||
}
|
||||
@@ -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" : "prev",
|
||||
"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" : "prev",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"blending" : "translucent",
|
||||
"cullmode" : "nocull",
|
||||
"depthtest" : "disabled",
|
||||
"depthwrite" : "disabled",
|
||||
"shader" : "genericimage2",
|
||||
"textures" : [ "effectpreview" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"clampuvs" : true,
|
||||
"format" : "rgba8888",
|
||||
"nomip" : true,
|
||||
"nonpoweroftwo" : true
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/blur_combine",
|
||||
"blending": "translucent",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/blur_downsample4",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/blur_gaussian",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/blur_gaussian",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull",
|
||||
"combos": {
|
||||
"VERTICAL" : 1
|
||||
}
|
||||
}]
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"clampuvs" : true,
|
||||
"format" : "rgba8888",
|
||||
"nomip" : true,
|
||||
"nonpoweroftwo" : true
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"autosize" : true,
|
||||
"material" : "materials/effectpreview.json"
|
||||
}
|
||||
18
modules/wallpaper-engine/effects/blur/preview/project.json
Normal file
18
modules/wallpaper-engine/effects/blur/preview/project.json
Normal 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" : "previewb",
|
||||
"type" : "scene"
|
||||
}
|
||||
80
modules/wallpaper-engine/effects/blur/preview/scene.json
Normal file
80
modules/wallpaper-engine/effects/blur/preview/scene.json
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"camera" :
|
||||
{
|
||||
"center" : "-12.815 -28.307 -1.000",
|
||||
"eye" : "-12.815 -28.307 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",
|
||||
"dependencies" : [ 38 ],
|
||||
"depth" : 1,
|
||||
"effects" :
|
||||
[
|
||||
{
|
||||
"file" : "effects/blur/effect.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"combos" : null,
|
||||
"constantshadervalues" : null
|
||||
},
|
||||
{
|
||||
"combos" : null,
|
||||
"constantshadervalues" : null
|
||||
},
|
||||
{
|
||||
"combos" :
|
||||
{
|
||||
"VERTICAL" : 1
|
||||
},
|
||||
"constantshadervalues" : null
|
||||
},
|
||||
{
|
||||
"combos" : null,
|
||||
"constantshadervalues" : null,
|
||||
"textures" :
|
||||
[
|
||||
null,
|
||||
"masks/blur_combine_mask_681d95af21112ea41fc4cd51aa49d9c553ef1173",
|
||||
"_rt_imageLayerComposite_38_a"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "FX Preview",
|
||||
"type": "scene2d"
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
// [COMBO] {"material":"ui_editor_properties_composite","combo":"COMPOSITE","type":"options","default":0,"options":{"ui_editor_properties_normal":0,"ui_editor_properties_blend":1,"ui_editor_properties_under":2,"ui_editor_properties_cutout":3}}
|
||||
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":0}
|
||||
// [COMBO] {"material":"ui_editor_properties_monochrome","combo":"COMPOSITEMONO","type":"options","default":0}
|
||||
// [COMBO] {"material":"ui_editor_properties_blur_alpha","combo":"BLURALPHA","type":"options","default":1}
|
||||
|
||||
#include "common_composite.h"
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","combo":"MASK","paintdefaultcolor":"0 0 0 1"}
|
||||
uniform sampler2D g_Texture2; // {"hidden":true}
|
||||
|
||||
uniform vec4 g_Texture0Resolution;
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 blurredCoords = v_TexCoord.xy;
|
||||
|
||||
#ifdef HLSL_SM30
|
||||
blurredCoords += 0.75 / g_Texture0Resolution.zw;
|
||||
#endif
|
||||
|
||||
vec4 blurred = texSample2D(g_Texture0, ApplyCompositeOffset(blurredCoords, g_Texture0Resolution.xy));
|
||||
vec4 albedoOld = texSample2D(g_Texture2, v_TexCoord.xy);
|
||||
|
||||
#if MASK
|
||||
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
|
||||
#else
|
||||
float mask = 1.0;
|
||||
#endif
|
||||
|
||||
float div = mix(blurred.a, 1, step(blurred.a, 0));
|
||||
blurred = ApplyComposite(albedoOld, vec4(blurred.rgb / div, blurred.a));
|
||||
blurred = mix(albedoOld, blurred, mask);
|
||||
|
||||
#if BLURALPHA == 0
|
||||
blurred.a = albedoOld.a;
|
||||
#endif
|
||||
|
||||
gl_FragColor = blurred;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
varying vec2 v_TexCoord[4];
|
||||
|
||||
uniform sampler2D g_Texture0; // {"hidden":true}
|
||||
|
||||
void main() {
|
||||
|
||||
float weight = 0.0;
|
||||
vec4 result = CAST4(0.0);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
vec4 sample = texSample2D(g_Texture0, v_TexCoord[i]);
|
||||
result += sample * sample.a;
|
||||
weight += sample.a;
|
||||
}
|
||||
|
||||
gl_FragColor.rgb = result.rgb / max(0.001, weight);
|
||||
gl_FragColor.a = result.a / 4.0;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoord[4];
|
||||
|
||||
uniform vec4 g_Texture0Resolution;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(a_Position, 1.0);
|
||||
|
||||
vec2 offsets = 1.0 / g_Texture0Resolution.xy;
|
||||
v_TexCoord[0] = a_TexCoord - offsets;
|
||||
v_TexCoord[1] = a_TexCoord + vec2(offsets.x, -offsets.y);
|
||||
v_TexCoord[2] = a_TexCoord + vec2(-offsets.x, offsets.y);
|
||||
v_TexCoord[3] = a_TexCoord + offsets;
|
||||
}
|
||||
@@ -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; // {"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;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
// [COMBO] {"material":"ui_editor_properties_kernel_size","combo":"KERNEL","type":"options","default":0,"options":{"13x13":0,"7x7":1,"3x3":2}}
|
||||
|
||||
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;
|
||||
|
||||
#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
|
||||
}
|
||||
Reference in New Issue
Block a user