This commit is contained in:
2025-02-07 17:04:43 -06:00
parent 33fd7ddf72
commit 8eec81c7f4
2249 changed files with 75331 additions and 685 deletions

View File

@@ -0,0 +1,20 @@
{
"version" : 1,
"replacementkey" : "pulse",
"name" : "ui_editor_effect_pulse_title",
"description" : "ui_editor_effect_pulse_description",
"group" : "animate",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/pulse.json"
}
],
"dependencies" :
[
"materials/effects/pulse.json",
"shaders/effects/pulse.frag",
"shaders/effects/pulse.vert"
]
}

View File

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

View File

@@ -0,0 +1,18 @@
{
"name" : "Blend",
"description" : "Blend two images or image layers with various blend modes.",
"group" : "colorize",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/blend.json"
}
],
"dependencies" :
[
"materials/effects/blend.json",
"shaders/effects/blend.frag",
"shaders/effects/blend.vert"
]
}

View File

@@ -0,0 +1,82 @@
{
"name" : "Blur",
"description" : "Apply coarse gaussian blur to the image. Supports an optional mask.",
"group" : "blur",
"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,18 @@
{
"name" : "Color Key",
"description" : "Mask a part of the image that matches a color of choice.",
"group" : "colorize",
//"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/colorkey.json"
}
],
"dependencies" :
[
"materials/effects/colorkey.json",
"shaders/effects/colorkey.frag",
"shaders/effects/colorkey.vert"
]
}

View File

@@ -0,0 +1,18 @@
{
"name" : "Fisheye",
"description" : "Adds a fisheye warp.",
"group" : "distort",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/fisheye.json"
}
],
"dependencies" :
[
"materials/effects/fisheye.json",
"shaders/effects/fisheye.frag",
"shaders/effects/fisheye.vert"
]
}

View File

@@ -0,0 +1,82 @@
{
"name" : "Local Contrast",
"description" : "Apply a local contrast enhancement to the image.",
"group" : "enhance",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/localcontrast_downsample4.json",
"target" : "_rt_QuarterCompoBuffer1",
"bind" :
[
{
"name" : "previous",
"index" : 0
}
]
},
{
"material" : "materials/effects/localcontrast_gaussian_x.json",
"target" : "_rt_QuarterCompoBuffer2",
"bind" :
[
{
"name" : "_rt_QuarterCompoBuffer1",
"index" : 0
}
]
},
{
"material" : "materials/effects/localcontrast_gaussian_y.json",
"target" : "_rt_QuarterCompoBuffer1",
"bind" :
[
{
"name" : "_rt_QuarterCompoBuffer2",
"index" : 0
}
]
},
{
"material" : "materials/effects/localcontrast_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/localcontrast_downsample4.json",
"materials/effects/localcontrast_gaussian_x.json",
"materials/effects/localcontrast_gaussian_y.json",
"materials/effects/localcontrast_combine.json",
"shaders/effects/localcontrast_downsample4.frag",
"shaders/effects/localcontrast_downsample4.vert",
"shaders/effects/localcontrast_gaussian.frag",
"shaders/effects/localcontrast_gaussian.vert",
"shaders/effects/localcontrast_combine.frag",
"shaders/effects/localcontrast_combine.vert"
]
}

View File

@@ -0,0 +1,18 @@
{
"name" : "Pulse",
"description" : "",
"group" : "animate",
//"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/pulse.json"
}
],
"dependencies" :
[
"materials/effects/pulse.json",
"shaders/effects/pulse.frag",
"shaders/effects/pulse.vert"
]
}

View File

@@ -0,0 +1,18 @@
{
"name" : "Tint",
"description" : "Tint the image with a color of choice.",
"group" : "colorize",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/tint.json"
}
],
"dependencies" :
[
"materials/effects/tint.json",
"shaders/effects/tint.frag",
"shaders/effects/tint.vert"
]
}

View File

@@ -0,0 +1,15 @@
{
"passes" :
[
{
"blending" : "translucent",
"combos" : {},
"constantshadervalues" : {},
"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/blend",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

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/colorkey",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/tint",
"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,140 @@
{
"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",
"colorBlendMode" : 0,
"copybackground" : true,
"effects" :
[
{
"file" : "effects/colorkey/effect.json",
"passes" :
[
{
"combos" :
{
"INVERT" : 1
},
"constantshadervalues" :
{
"Color" : "0 0.435294 0.733333",
"Fuzziness" : 0.31999999284744263
}
}
]
},
{
"file" : "effects/tint/effect.json",
"passes" :
[
{
"combos" :
{
"BLENDMODE" : 0
},
"constantshadervalues" :
{
"Color" : "1 0 0"
}
}
]
},
{
"file" : "effects/pulse/effect.json",
"passes" :
[
{
"combos" :
{
"PULSEALPHA" : 1,
"PULSECOLOR" : 0
},
"constantshadervalues" :
{
"Noise amount" : 0,
"Power" : 1,
"Pulse speed" : 5.869999885559082,
"Tint high" : "1 1 1",
"Tint low" : "0 0 0"
},
"textures" : [ null, "util/noise" ]
}
]
}
],
"id" : 20,
"image" : "models/effectpreview.json",
"name" : "effectpreview",
"origin" : "-160.688 129.964 0.000",
"parallaxDepth" : "1.000 1.000",
"scale" : "1.000 1.000 1.000",
"size" : "256.000 256.000",
"visible" : true
},
{
"angles" : "0.000 0.000 0.000",
"colorBlendMode" : 0,
"copybackground" : true,
"dependencies" : [ 20 ],
"depth" : 1,
"effects" :
[
{
"file" : "effects/blend/effect.json",
"passes" :
[
{
"combos" :
{
"BLENDMODE" : 0
},
"constantshadervalues" :
{
"Multiply" : 2.130000114440918
},
"textures" : [ null, "_rt_imageLayerComposite_20_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",
"visible" : true
}
]
}

View File

@@ -0,0 +1,31 @@
// [COMBO] {"material":"Blend mode","combo":"BLENDMODE","type":"imageblending","default":2}
#include "common_blending.h"
varying vec4 v_TexCoord;
uniform float g_Multiply; // {"material":"Multiply","default":1,"range":[0.0, 10.0]}
#if OPACITYMASK == 1
varying vec2 v_TexCoordOpacity;
#endif
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Blend texture","mode":"rgbmask","default":"util/white"}
uniform sampler2D g_Texture2; // {"material":"Opacity mask","mode":"opacitymask","default":"util/white","combo":"OPACITYMASK"}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
vec4 mask = texSample2D(g_Texture1, v_TexCoord.zw);
float blend = mask.a * g_Multiply;
#if OPACITYMASK == 1
blend *= texSample2D(g_Texture2, v_TexCoordOpacity).r;
#endif
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, mask.rgb, blend);
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,26 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
#if OPACITYMASK == 1
uniform vec4 g_Texture2Resolution;
varying vec2 v_TexCoordOpacity;
#endif
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);
#if OPACITYMASK == 1
v_TexCoordOpacity = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
#endif
}

View File

@@ -0,0 +1,27 @@
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}
#ifdef HLSL_SM30
uniform vec4 g_Texture0Resolution;
#endif
void main() {
vec2 blurredCoords = v_TexCoord.xy;
#ifdef HLSL_SM30
blurredCoords += 0.75 / g_Texture0Resolution.zw;
#endif
vec4 blurred = texSample2D(g_Texture0, blurredCoords);
vec4 albedoOld = texSample2D(g_Texture2, v_TexCoord.xy);
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
blurred = mix(albedoOld, blurred, mask);
gl_FragColor = blurred;
}

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,19 @@
varying vec2 v_TexCoord[4];
uniform sampler2D g_Texture0; // {"material":"Framebuffer","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;
}

View File

@@ -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.zw;
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;
}

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,26 @@
// [COMBO] {"material":"Invert","combo":"INVERT","type":"options","default":0}
varying vec2 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform float g_KeyAlpha; // {"material":"Write alpha","default":0,"range":[0,1]}
uniform float g_KeyFuzz; // {"material":"Fuzziness","default":0,"range":[0,1]}
uniform float g_KeyTolerance; // {"material":"Tolerance","default":0.1,"range":[0,1]}
uniform vec3 g_KeyColor; // {"material":"Color", "type": "color", "default":"1 1 1"}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
float delta = length(g_KeyColor - albedo.rgb); // [0, SQRT_3]
float blend = smoothstep(0.001, 0.002 + g_KeyFuzz, delta - g_KeyTolerance);
#if INVERT == 1
blend = 1.0 - blend;
#endif
albedo.a *= mix(g_KeyAlpha, 1.0, blend);
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,12 @@
uniform mat4 g_ModelViewProjectionMatrix;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec2 v_TexCoord;
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord.xy = a_TexCoord;
}

View File

@@ -0,0 +1,46 @@
// [COMBO] {"material":"Background","combo":"BACKGROUND","type":"options","default":1}
#include "common.h"
varying vec2 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform float g_Size; // {"material":"Size","default":1,"range":[0.01, 1]}
uniform float g_Scale; // {"material":"Distortion","default":1,"range":[0, 2.5]}
uniform vec2 g_Center; // {"material":"Center","default":"0.5 0.5"}
void main() {
//vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
float aperture = 178.0;
float apertureHalf = 0.5 * aperture * (M_PI / 180.0);
float maxFactor = sin(apertureHalf);
vec2 uv;
vec2 xy = (v_TexCoord.xy - g_Center) * 2.0 / g_Size;
float d = length(xy);
float alpha = 1.0;
if (d < (2.0 - maxFactor))
{
d = length(xy * maxFactor);
float z = sqrt(1.0 - d * d);
float r = atan2(d, z) / M_PI;
float phi = atan2(xy.y, xy.x);
uv.x = r * cos(phi) * g_Size + g_Center.x;
uv.y = r * sin(phi) * g_Size + g_Center.y;
}
else
{
uv = v_TexCoord.xy;
#if BACKGROUND == 0
alpha = 0.0;
#endif
}
vec4 albedo = texSample2D(g_Texture0, mix(v_TexCoord.xy, uv, g_Scale));
albedo.a *= alpha;
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,12 @@
uniform mat4 g_ModelViewProjectionMatrix;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec2 v_TexCoord;
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord.xy = a_TexCoord;
}

View File

@@ -0,0 +1,37 @@
// [COMBO] {"material":"Greyscale","combo":"GREYSCALE","type":"options","default":0}
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}
#ifdef HLSL_SM30
uniform vec4 g_Texture0Resolution;
#endif
uniform float g_Amount; // {"material":"Strength","default":1.0,"range":[0.01, 5]}
void main() {
vec2 blurredCoords = v_TexCoord.xy;
#ifdef HLSL_SM30
blurredCoords += 0.75 / g_Texture0Resolution.zw;
#endif
vec4 blurred = texSample2D(g_Texture0, blurredCoords);
vec4 albedo = texSample2D(g_Texture2, v_TexCoord.xy);
vec3 delta = albedo.rgb - blurred.rgb;
#if GREYSCALE == 1
delta = CAST3(dot(vec3(0.11, 0.59, 0.3), delta));
#endif
vec3 enhanced = albedo.rgb + delta * g_Amount;
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
albedo.rgb = mix(albedo.rgb, enhanced.rgb, 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,19 @@
varying vec2 v_TexCoord[4];
uniform sampler2D g_Texture0; // {"material":"Framebuffer","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;
}

View File

@@ -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.zw;
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;
}

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,48 @@
// [COMBO] {"material":"Blend mode","combo":"BLENDMODE","type":"imageblending","default":9}
// [COMBO] {"material":"Pulse alpha","combo":"PULSEALPHA","type":"options","default":0}
// [COMBO] {"material":"Pulse color","combo":"PULSECOLOR","type":"options","default":1}
#include "common_blending.h"
varying vec2 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Noise","default":"util/noise"}
uniform float g_Time;
uniform float g_PulseSpeed; // {"material":"Pulse speed","default":3,"range":[0,10]}
uniform float g_PulseAmount; // {"material":"Pulse amount","default":1,"range":[0,2]}
uniform vec2 g_PulseThresholds; // {"material":"Pulse bounds","default":"0 1"}
uniform float g_NoiseSpeed; // {"material":"Noise speed","default":0.1,"range":[0,0.5]}
uniform float g_NoiseAmount; // {"material":"Noise amount","default":0,"range":[0,2]}
uniform float g_Power; // {"material":"Power","default":1,"range":[0,4]}
uniform vec3 g_TintColor1; // {"material":"Tint low", "type": "color", "default":"1 1 1"}
uniform vec3 g_TintColor2; // {"material":"Tint high", "type": "color", "default":"1 1 1"}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
//float delta = length(g_KeyColor - albedo.rgb); // [0, SQRT_3]
//float blend = smoothstep(0.001, 0.002 + g_KeyFuzz, delta - g_KeyTolerance);
//albedo.a *= mix(g_KeyAlpha, 1.0, blend);
float pulse = smoothstep(g_PulseThresholds.x, g_PulseThresholds.y, sin(g_Time * g_PulseSpeed) * 0.5 + 0.5) * g_PulseAmount;
float noise = texSample2D(g_Texture1, vec2(g_Time, g_Time * 0.333) * g_NoiseSpeed).r * g_NoiseAmount;
pulse += noise;
pulse = pow(pulse, g_Power);
#if PULSECOLOR
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb * g_TintColor1, albedo.rgb * g_TintColor2, pulse);
#endif
#if PULSEALPHA
albedo.a *= pulse;
#endif
gl_FragColor = saturate(albedo);
}

View File

@@ -0,0 +1,13 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec2 v_TexCoord;
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord.xy = a_TexCoord;
}

View File

@@ -0,0 +1,19 @@
// [COMBO] {"material":"Blend mode","combo":"BLENDMODE","type":"imageblending","default":2}
#include "common_blending.h"
varying vec2 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform float g_BlendAlpha; // {"material":"Alpha","default":1,"range":[0,1]}
uniform vec3 g_TintColor; // {"material":"Color", "type": "color", "default":"1 1 1"}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, g_TintColor, g_BlendAlpha);
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,12 @@
uniform mat4 g_ModelViewProjectionMatrix;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec2 v_TexCoord;
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord.xy = a_TexCoord;
}

View File

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

View File

@@ -0,0 +1,59 @@
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":9}
// [COMBO] {"material":"ui_editor_properties_pulse_alpha","combo":"PULSEALPHA","type":"options","default":0}
// [COMBO] {"material":"ui_editor_properties_pulse_color","combo":"PULSECOLOR","type":"options","default":1}
#include "common_blending.h"
varying vec4 v_TexCoord;
varying float v_Pulse;
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_noise","default":"util/noise"}
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","combo":"MASK","paintdefaultcolor":"0 0 0 1"}
uniform float g_Time;
uniform float g_PulseSpeed; // {"material":"speed","label":"ui_editor_properties_pulse_speed","default":3,"range":[0,10]}
uniform float g_PulsePhase; // {"material":"phase","label":"ui_editor_properties_pulse_phase","default":0,"range":[0,6.282]}
uniform float g_PulseAmount; // {"material":"amount","label":"ui_editor_properties_pulse_amount","default":1,"range":[0,2]}
uniform vec2 g_PulseThresholds; // {"material":"bounds","label":"ui_editor_properties_pulse_bounds","default":"0 1"}
uniform float g_NoiseSpeed; // {"material":"noisespeed","label":"ui_editor_properties_noise_speed","default":0.5,"range":[0,1.0]}
uniform float g_NoiseAmount; // {"material":"noiseamount","label":"ui_editor_properties_noise_amount","default":0,"range":[0,2]}
uniform float g_Power; // {"material":"power","label":"ui_editor_properties_power","default":1,"range":[0,4]}
uniform vec3 g_TintColor1; // {"material":"tintlow","label":"ui_editor_properties_tint_low", "type": "color", "default":"1 1 1"}
uniform vec3 g_TintColor2; // {"material":"tinthigh","label":"ui_editor_properties_tint_high", "type": "color", "default":"1 1 1"}
void main() {
vec4 sample = texSample2D(g_Texture0, v_TexCoord.xy);
vec4 albedo = sample;
float pulse = 0.0;
pulse = v_Pulse;
#if AUDIOPROCESSING == 0
pulse = smoothstep(g_PulseThresholds.x, g_PulseThresholds.y, sin(g_Time * g_PulseSpeed + (g_PulsePhase - 1.57079632679)) * 0.5 + 0.5) * g_PulseAmount;
float noise = texSample2D(g_Texture1, vec2(g_Time * 0.08333333, g_Time * 0.02777777) * g_NoiseSpeed).r * g_NoiseAmount;
pulse += noise;
pulse = pow(pulse, g_Power);
#endif
#if PULSECOLOR
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb * g_TintColor1, albedo.rgb * g_TintColor2, pulse);
#endif
#if PULSEALPHA
albedo.a *= pulse;
#endif
#if MASK
float mask = texSample2D(g_Texture2, v_TexCoord.zw).r;
albedo = mix(sample, albedo, mask);
#endif
gl_FragColor = vec4(max(CAST3(0), albedo.rgb), albedo.a);
}

View File

@@ -0,0 +1,83 @@
// [COMBO] {"material":"ui_editor_properties_audio_response","combo":"AUDIOPROCESSING","type":"audioprocessingoptions","default":0}
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
#if MASK
uniform vec4 g_Texture2Resolution;
#endif
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
varying float v_Pulse;
uniform float g_Time;
uniform vec2 g_PulseThresholds; // {"material":"bounds","label":"ui_editor_properties_pulse_bounds","default":"0 1"}
uniform float g_PulseSpeed; // {"material":"speed","label":"ui_editor_properties_pulse_speed","default":3,"range":[0,10]}
uniform float g_PulsePhase; // {"material":"phase","label":"ui_editor_properties_time_offset","default":0,"range":[0,1]}
uniform float g_PulseAmount; // {"material":"amount","label":"ui_editor_properties_pulse_amount","default":1,"range":[0,2]}
#if AUDIOPROCESSING
uniform float g_AudioSpectrum16Left[16];
uniform float g_AudioSpectrum16Right[16];
uniform float g_AudioFrequencyMin; // {"material":"frequencymin","label":"ui_editor_properties_frequency_min","default":0,"int":true,"range":[0,15]}
uniform float g_AudioFrequencyMax; // {"material":"frequencymax","label":"ui_editor_properties_frequency_max","default":1,"int":true,"range":[0,15]}
uniform float g_AudioPower; // {"material":"audioexponent","label":"ui_editor_properties_audio_exponent","default":1.0,"range":[0,4]}
uniform vec2 g_AudioBounds; // {"material":"audiobounds","label":"ui_editor_properties_audio_bounds","default":"0.5 1.0"}
uniform float g_AudioMultiply; // {"material":"audioamount","label":"ui_editor_properties_audio_amount","default":1,"range":[0,2]}
float CreateAudioResponse(float bufferLeft[16], float bufferRight[16])
{
float audioFrequencyEnd = max(g_AudioFrequencyMin, g_AudioFrequencyMax);
float audioResponse = 0.0;
#if AUDIOPROCESSING == 1
for (int a = int(g_AudioFrequencyMin); a <= int(g_AudioFrequencyMax); ++a)
{
audioResponse += bufferLeft[a];
}
audioResponse /= (g_AudioFrequencyMax - g_AudioFrequencyMin + 1.0);
#endif
#if AUDIOPROCESSING == 2
for (int a = int(g_AudioFrequencyMin); a <= int(g_AudioFrequencyMax); ++a)
{
audioResponse += bufferRight[a];
}
audioResponse /= (g_AudioFrequencyMax - g_AudioFrequencyMin + 1.0);
#endif
#if AUDIOPROCESSING == 3
for (int a = int(g_AudioFrequencyMin); a <= int(g_AudioFrequencyMax); ++a)
{
audioResponse += bufferLeft[a];
audioResponse += bufferRight[a];
}
audioResponse /= (g_AudioFrequencyMax - g_AudioFrequencyMin + 1.0) * 2.0;
#endif
audioResponse = smoothstep(g_AudioBounds.x, g_AudioBounds.y, audioResponse);
audioResponse = saturate(pow(audioResponse, g_AudioPower)) * g_AudioMultiply;
return audioResponse;
}
#endif
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord = a_TexCoord.xyxy;
#if MASK
v_TexCoord.zw = vec2(a_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
a_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
#endif
#if AUDIOPROCESSING
v_Pulse = CreateAudioResponse(g_AudioSpectrum16Left, g_AudioSpectrum16Right);
#else
v_Pulse = smoothstep(g_PulseThresholds.x, g_PulseThresholds.y,
sin(g_Time * g_PulseSpeed + (g_PulsePhase - 0.25) * 6.28318530718) * 0.5 + 0.5) * g_PulseAmount;
#endif
}