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,99 @@
{
"version" : 1,
"replacementkey" : "godrays",
"name" : "ui_editor_effect_godrays_title",
"description" : "ui_editor_effect_godrays_description",
"group" : "enhance",
"performance" : "expensive",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/godrays_downsample2.json",
"target" : "_rt_HalfCompoBuffer1",
"bind" :
[
{
"name" : "previous",
"index" : 0
}
]
},
{
"material" : "materials/effects/godrays_cast.json",
"target" : "_rt_HalfCompoBuffer2",
"bind" :
[
{
"name" : "_rt_HalfCompoBuffer1",
"index" : 0
}
]
},
{
"material" : "materials/effects/godrays_gaussian_x.json",
"target" : "_rt_HalfCompoBuffer1",
"bind" :
[
{
"name" : "_rt_HalfCompoBuffer2",
"index" : 0
}
]
},
{
"material" : "materials/effects/godrays_gaussian_y.json",
"target" : "_rt_HalfCompoBuffer2",
"bind" :
[
{
"name" : "_rt_HalfCompoBuffer1",
"index" : 0
}
]
},
{
"material" : "materials/effects/godrays_combine.json",
"bind" :
[
{
"name" : "_rt_HalfCompoBuffer2",
"index" : 0
},
{
"name" : "previous",
"index" : 1
}
]
}
],
"fbos" :
[
{
"name" : "_rt_HalfCompoBuffer1",
"scale" : 2,
"format" : "rgba_backbuffer"
},
{
"name" : "_rt_HalfCompoBuffer2",
"scale" : 2,
"format" : "rgba_backbuffer"
}
],
"dependencies" :
[
"materials/effects/godrays_downsample2.json",
"materials/effects/godrays_cast.json",
"materials/effects/godrays_gaussian_x.json",
"materials/effects/godrays_gaussian_y.json",
"materials/effects/godrays_combine.json",
"shaders/effects/godrays_downsample2.frag",
"shaders/effects/godrays_downsample2.vert",
"shaders/effects/godrays_cast.frag",
"shaders/effects/godrays_cast.vert",
"shaders/effects/godrays_gaussian.frag",
"shaders/effects/godrays_gaussian.vert",
"shaders/effects/godrays_combine.frag",
"shaders/effects/godrays_combine.vert"
]
}

View File

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

View File

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

View File

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

View File

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

View File

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

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,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,96 @@
{
"name" : "God Rays",
"description" : "Add directional or circular god rays.",
"group" : "enhance",
//"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/godrays_downsample2.json",
"target" : "_rt_HalfCompoBuffer1",
"bind" :
[
{
"name" : "previous",
"index" : 0
}
]
},
{
"material" : "materials/effects/godrays_cast.json",
"target" : "_rt_HalfCompoBuffer2",
"bind" :
[
{
"name" : "_rt_HalfCompoBuffer1",
"index" : 0
}
]
},
{
"material" : "materials/effects/godrays_gaussian_x.json",
"target" : "_rt_HalfCompoBuffer1",
"bind" :
[
{
"name" : "_rt_HalfCompoBuffer2",
"index" : 0
}
]
},
{
"material" : "materials/effects/godrays_gaussian_y.json",
"target" : "_rt_HalfCompoBuffer2",
"bind" :
[
{
"name" : "_rt_HalfCompoBuffer1",
"index" : 0
}
]
},
{
"material" : "materials/effects/godrays_combine.json",
"bind" :
[
{
"name" : "_rt_HalfCompoBuffer2",
"index" : 0
},
{
"name" : "previous",
"index" : 1
}
]
}
],
"fbos" :
[
{
"name" : "_rt_HalfCompoBuffer1",
"scale" : 2,
"format" : "rgba8888"
},
{
"name" : "_rt_HalfCompoBuffer2",
"scale" : 2,
"format" : "rgba8888"
}
],
"dependencies" :
[
"materials/effects/godrays_downsample2.json",
"materials/effects/godrays_cast.json",
"materials/effects/godrays_gaussian_x.json",
"materials/effects/godrays_gaussian_y.json",
"materials/effects/godrays_combine.json",
"shaders/effects/godrays_downsample2.frag",
"shaders/effects/godrays_downsample2.vert",
"shaders/effects/godrays_cast.frag",
"shaders/effects/godrays_cast.vert",
"shaders/effects/godrays_gaussian.frag",
"shaders/effects/godrays_gaussian.vert",
"shaders/effects/godrays_combine.frag",
"shaders/effects/godrays_combine.vert"
]
}

View File

@@ -0,0 +1,18 @@
{
"name" : "Scroll",
"description" : "Scrolls the image horizontally or vertically.",
"group" : "animate",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/scroll.json"
}
],
"dependencies" :
[
"materials/effects/scroll.json",
"shaders/effects/scroll.frag",
"shaders/effects/scroll.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,18 @@
{
"name" : "Transform",
"description" : "Apply scaling, rotation and offsets to the image.",
"group" : "distort",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/transform.json"
}
],
"dependencies" :
[
"materials/effects/transform.json",
"shaders/effects/transform.frag",
"shaders/effects/transform.vert"
]
}

View File

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

View File

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

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

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/scroll",
"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,9 @@
{
"passes": [{
"shader": "effects/transform",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

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

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,200 @@
{
"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,
"depth" : 1,
"id" : 38,
"image" : "models/effectpreview.json",
"name" : "",
"origin" : "128.000 128.000 0.000",
"parallaxDepth" : "1.000 1.000",
"scale" : "0.608 0.608 1.000",
"size" : "256.000 256.000",
"visible" : true
},
{
"angles" : "0.000 0.000 0.000",
"colorBlendMode" : 0,
"copybackground" : true,
"effects" :
[
{
"file" : "effects/scroll/effect.json",
"passes" :
[
{
"constantshadervalues" :
{
"Speed X" : -0.34999999403953552,
"Speed Y" : -0.61000001430511475
}
}
]
},
{
"file" : "effects/transform/effect.json",
"passes" :
[
{
"constantshadervalues" :
{
"Angle" : 0.75,
"Scale" : "0.5 0.5"
}
}
]
}
],
"id" : 68,
"image" : "models/clouds.json",
"name" : "clouds",
"origin" : "-180.120 -130.583 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" : [ 68 ],
"effects" :
[
{
"file" : "effects/scroll/effect.json",
"passes" :
[
{
"constantshadervalues" :
{
"Speed X" : 0.50999999046325684,
"Speed Y" : 0.61000001430511475
}
}
]
},
{
"file" : "effects/blend/effect.json",
"passes" :
[
{
"combos" :
{
"BLENDMODE" : 9
},
"textures" : [ null, "_rt_imageLayerComposite_68_a" ]
}
]
}
],
"id" : 49,
"image" : "models/clouds.json",
"name" : "clouds",
"origin" : "-182.542 134.042 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,
"config" :
{
"passthrough" : true
},
"copybackground" : true,
"dependencies" : [ 49, 203 ],
"effects" :
[
{
"file" : "effects/godrays/effect.json",
"passes" :
[
{
"constantshadervalues" :
{
"Ray threshold" : 0.73000001907348633
},
"textures" : [ null, "_rt_imageLayerComposite_49_a" ]
},
{
"constantshadervalues" :
{
"Color end" : "1 1 1",
"Color start" : "0 0.294118 1",
"Ray intensity" : 2,
"Ray length" : 0.82999998331069946
}
},
{
"combos" :
{
"KERNEL" : 2
},
"constantshadervalues" :
{
"Blur scale" : "1 1"
}
},
{
"combos" :
{
"KERNEL" : 2,
"VERTICAL" : 1
},
"constantshadervalues" :
{
"Blur scale" : "1 1"
}
},
{
"textures" : [ null, "_rt_imageLayerComposite_203_a" ]
}
]
}
],
"id" : 203,
"image" : "models/util/composelayer.json",
"name" : "Compose",
"origin" : "127.190 131.439 0.000",
"parallaxDepth" : "1.000 1.000",
"scale" : "0.581 0.581 1.000",
"size" : "512.000 512.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,31 @@
// [COMBO] {"material":"Invert","combo":"INVERT","type":"options","default":0}
// [COMBO] {"material":"Flatten","combo":"FLATTEN","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,3]}
uniform float g_KeyTolerance; // {"material":"Tolerance","default":0.1,"range":[0,3]}
uniform vec3 g_KeyColor; // {"material":"Color", "type": "color", "default":"1 1 1"}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
float delta = dot(abs(g_KeyColor - albedo.rgb), vec3(1, 1, 1));
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);
#if FLATTEN == 1
albedo.rgb *= albedo.a;
#endif
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,48 @@
// [COMBO] {"material":"Caster","combo":"CASTER","type":"options","default":0,"options":{"Radial":0,"Directional":1}}
#include "common.h"
varying vec2 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform float g_Length; // {"material":"Ray length","default":0.5,"range":[0.01, 1]}
uniform float g_Intensity; // {"material":"Ray intensity","default":1,"range":[0.01, 2.0]}
uniform vec3 g_Color1; // {"material":"Color start","default":"1 1 1","type":"color"}
uniform vec3 g_Color2; // {"material":"Color end","default":"1 1 1","type":"color"}
#if CASTER == 0
uniform vec2 g_Center; // {"material":"Center","default":"0.5 0.5"}
#else
uniform float g_Direction; // {"material":"Direction","default":0,"range":[0,6.28]}
#endif
void main() {
vec2 texCoords = v_TexCoord;
vec4 albedo = CAST4(0.0);
#if CASTER == 0
vec2 direction = g_Center - texCoords;
#else
vec2 direction = rotateVec2(vec2(0, -0.5), g_Direction);
#endif
float dist = length(direction);
direction /= dist;
dist = min(dist, dist * g_Length);
texCoords += direction * dist;
direction = direction * dist / 29.0;
for (int i = 0; i < 30; ++i)
{
vec4 sample = texSample2D(g_Texture0, texCoords);
texCoords -= direction;
sample.rgb *= mix(g_Color2, g_Color1, i/29.0);
albedo += sample * (i / 29.0);
}
gl_FragColor = albedo * g_Intensity * 0.1;
}

View File

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

View File

@@ -0,0 +1,24 @@
// [COMBO] {"material":"Blend mode","combo":"BLENDMODE","type":"imageblending","default":9}
#include "common_blending.h"
varying vec4 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Prev","hidden":true}
void main() {
vec4 rays = texSample2D(g_Texture0, v_TexCoord.zw);
vec4 albedo = texSample2D(g_Texture1, v_TexCoord.xy);
#if BLENDMODE == 0
albedo = rays;
#else
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, rays.rgb, rays.a);
albedo.a += rays.a;
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,22 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
#ifdef HLSL_SM30
uniform vec4 g_Texture0Resolution;
#endif
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord = a_TexCoord.xyxy;
#ifdef HLSL_SM30
v_TexCoord.zw += 0.5 / g_Texture0Resolution.xy;
#endif
}

View File

@@ -0,0 +1,15 @@
varying vec4 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Mask","mode":"opacitymask","default":"util/white"}
uniform float g_Threshold; // {"material":"Ray threshold","default":0.5,"range":[0, 1]}
void main() {
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
vec4 sample = texSample2D(g_Texture0, v_TexCoord.xy);
sample.rgb *= sample.a;
sample.a = 1.0;
gl_FragColor = sample * mask * step(g_Threshold, dot(vec3(0.11, 0.59, 0.3), sample.rgb));
}

View File

@@ -0,0 +1,20 @@
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
uniform vec4 g_Texture0Resolution;
void main() {
gl_Position = vec4(a_Position, 1.0);
v_TexCoord.xy = a_TexCoord;
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture0Resolution.z / g_Texture0Resolution.x,
v_TexCoord.y * g_Texture0Resolution.w / g_Texture0Resolution.y);
#ifdef HLSL_SM30
vec2 offsets = 0.5 / g_Texture0Resolution.xy;
v_TexCoord.xy += offsets;
#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.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":1,"options":{"13x13":0,"7x7":1,"3x3":2}}
uniform vec2 g_Scale; // {"material":"Blur 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,10 @@
varying vec2 v_TexCoord;
varying vec2 v_Scroll;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
void main() {
vec2 texCoord = frac(v_TexCoord + v_Scroll);
gl_FragColor = texSample2D(g_Texture0, texCoord);
}

View File

@@ -0,0 +1,21 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform float g_Time;
uniform float g_ScrollX; // {"material":"Speed X","default":0.2,"range":[-2,2]}
uniform float g_ScrollY; // {"material":"Speed Y","default":0.2,"range":[-2,2]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec2 v_TexCoord;
varying vec2 v_Scroll;
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord = a_TexCoord;
vec2 scroll = vec2(g_ScrollX, g_ScrollY);
scroll = sign(scroll) * pow(vec2(g_ScrollX, g_ScrollY), CAST2(2.0));
v_Scroll = scroll * g_Time;
}

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,14 @@
// [COMBO] {"material":"Repeat","combo":"CLAMP","type":"options","default":1}
varying vec2 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
void main() {
vec2 texCoord = v_TexCoord;
#if CLAMP
texCoord = frac(texCoord);
#endif
gl_FragColor = texSample2D(g_Texture0, texCoord);
}

View File

@@ -0,0 +1,35 @@
// [COMBO] {"material":"Mode","combo":"MODE","type":"options","default":0,"options":{"Vertex":1,"UV":0}}
#include "common.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec2 g_Offset; // {"material":"Offset","default":"0 0"}
uniform vec2 g_Scale; // {"material":"Scale","default":"1 1"}
uniform float g_Direction; // {"material":"Angle","default":0,"range":[0,6.28]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec2 v_TexCoord;
vec2 applyFx(vec2 v) {
v = rotateVec2(v - CAST2(0.5), g_Direction);
return (v + g_Offset) * g_Scale + CAST2(0.5);
}
void main() {
vec3 position = a_Position;
#if MODE == 1
position.xy = applyFx(position.xy);
#endif
gl_Position = mul(vec4(position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord = a_TexCoord;
#if MODE == 0
v_TexCoord = applyFx(v_TexCoord);
#endif
}

View File

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

View File

@@ -0,0 +1,58 @@
// [COMBO] {"material":"ui_editor_properties_cast_type","combo":"CASTER","type":"options","default":0,"options":{"Radial":0,"Directional":1}}
// [COMBO] {"material":"ui_editor_properties_quality","combo":"SAMPLES","type":"options","default":0,"options":{"30":0,"50":1}}
#include "common.h"
varying vec2 v_TexCoord;
uniform sampler2D g_Texture0; // {"hidden":true}
uniform float g_Length; // {"material":"raylength","label":"ui_editor_properties_ray_length","default":0.5,"range":[0.01, 1]}
uniform float g_Intensity; // {"material":"rayintensity","label":"ui_editor_properties_ray_intensity","default":1,"range":[0.01, 2.0]}
uniform vec3 g_ColorRays; // {"material":"color","label":"ui_editor_properties_color","default":"1 1 1","type":"color"}
#if CASTER == 0
uniform vec2 g_Center; // {"material":"center","label":"ui_editor_properties_center","default":"0.5 0.5","position":true}
#else
uniform float g_Direction; // {"material":"direction","label":"ui_editor_properties_direction","default":3.14159265358,"direction":true,"conversion":"rad2deg"}
#endif
void main() {
vec2 texCoords = v_TexCoord;
vec4 albedo = CAST4(0.0);
#if CASTER == 0
vec2 direction = g_Center - texCoords;
#else
vec2 direction = rotateVec2(vec2(0, -0.5), g_Direction - M_PI);
#endif
float dist = length(direction);
direction /= dist;
dist *= g_Length;
texCoords += direction * dist;
#if SAMPLES == 0
const int sampleCount = 30;
const float sampleIntensity = 0.1;
#endif
#if SAMPLES == 1
const int sampleCount = 50;
const float sampleIntensity = 0.1 * (30 / 50.0);
#endif
const float sampleDrop = sampleCount - 1;
direction = direction * dist / sampleDrop;
for (int i = 0; i < sampleCount; ++i)
{
vec4 sample = texSample2D(g_Texture0, texCoords);
texCoords -= direction;
albedo += sample * (i / sampleDrop);
}
albedo.rgb *= g_ColorRays;
gl_FragColor = vec4(g_Intensity * sampleIntensity * albedo.rgb, saturate(g_Intensity * sampleIntensity * albedo.a));
}

View File

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

View File

@@ -0,0 +1,37 @@
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":9}
// [COMBO] {"material":"ui_editor_properties_copy_background","combo":"COPYBG","type":"options"}
#include "common_blending.h"
varying vec4 v_TexCoord;
#if COPYBG
varying vec3 v_ScreenCoord;
uniform sampler2D g_Texture2; // {"hidden":true,"default":"_rt_FullFrameBuffer"}
#endif
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture1; // {"hidden":true}
void main() {
vec4 rays = texSample2D(g_Texture0, v_TexCoord.zw);
vec4 albedo = texSample2D(g_Texture1, v_TexCoord.xy);
#if COPYBG
vec2 screenCoord = v_ScreenCoord.xy / v_ScreenCoord.z * vec2(0.5, 0.5) + 0.5;
vec4 bg = texSample2D(g_Texture2, screenCoord.xy);
albedo.rgb = mix(bg.rgb, albedo.rgb, albedo.a);
#endif
#if BLENDMODE == 0
albedo = rays;
#else
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, rays.rgb, rays.a);
albedo.a = saturate(albedo.a + rays.a);
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,35 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
#if COPYBG
uniform mat4 g_EffectModelViewProjectionMatrix;
varying vec3 v_ScreenCoord;
#endif
#ifdef HLSL_SM30
uniform vec4 g_Texture0Resolution;
#endif
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord = a_TexCoord.xyxy;
#ifdef HLSL_SM30
v_TexCoord.zw += 0.5 / g_Texture0Resolution.xy;
#endif
#if COPYBG
v_ScreenCoord = mul(vec4((a_Position), 1.0), g_EffectModelViewProjectionMatrix).xyw;
#if HLSL
v_ScreenCoord.y = -v_ScreenCoord.y;
#endif
#endif
}

View File

@@ -0,0 +1,40 @@
// [COMBO] {"material":"ui_editor_properties_noise","combo":"NOISE","type":"options","default":1}
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 float g_Threshold; // {"material":"raythreshold","label":"ui_editor_properties_ray_threshold","default":0.5,"range":[0, 1]}
#if NOISE == 1
varying vec4 v_NoiseTexCoord;
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_noise","default":"util/clouds_256"}
uniform float g_NoiseAmount; // {"material":"noiseamount","label":"ui_editor_properties_noise_amount","default":0.4,"range":[0.01, 1]}
uniform float g_NoiseSmoothness; // {"material":"noisesmoothness","label":"ui_editor_properties_noise_smoothness","default":0.2,"range":[0.01, 0.5]}
#endif
void main() {
#if MASK
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
#else
float mask = 1.0;
#endif
vec4 sample = texSample2D(g_Texture0, v_TexCoord.xy);
#if NOISE
float noiseSample = texSample2D(g_Texture2, v_NoiseTexCoord.xy).r * texSample2D(g_Texture2, v_NoiseTexCoord.zw).r;
noiseSample = mix(sample.a, sample.a * noiseSample, g_NoiseAmount);
#endif
sample.rgb *= sample.a;
sample.a = 1.0;
gl_FragColor = sample * mask * step(g_Threshold, dot(vec3(0.11, 0.59, 0.3), sample.rgb));
#if NOISE
gl_FragColor.a *= smoothstep(0.5 - g_NoiseSmoothness, 0.5 + g_NoiseSmoothness, noiseSample);
#endif
}

View File

@@ -0,0 +1,37 @@
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
uniform vec4 g_Texture0Resolution;
uniform vec4 g_Texture1Resolution;
#if NOISE == 1
varying vec4 v_NoiseTexCoord;
#endif
uniform float g_Time;
uniform float g_NoiseSpeed; // {"material":"noisespeed","label":"ui_editor_properties_noise_speed","default":0.15,"range":[0.01, 1]}
uniform float g_NoiseScale; // {"material":"noisescale","label":"ui_editor_properties_noise_scale","default":3,"range":[0.01, 10]}
void main() {
gl_Position = vec4(a_Position, 1.0);
v_TexCoord = a_TexCoord.xyxy;
#if MASK
v_TexCoord.z *= g_Texture1Resolution.z / g_Texture1Resolution.x;
v_TexCoord.w *= g_Texture1Resolution.w / g_Texture1Resolution.y;
#endif
#ifdef HLSL_SM30
vec2 offsets = 0.5 / g_Texture0Resolution.xy;
v_TexCoord.xy += offsets;
#endif
#if NOISE == 1
v_NoiseTexCoord.xy = a_TexCoord + g_Time * g_NoiseSpeed;
v_NoiseTexCoord.wz = vec2(a_TexCoord.y, -a_TexCoord.x) * 0.633 + vec2(-g_Time, g_Time) * 0.5 * g_NoiseSpeed;
v_NoiseTexCoord *= g_NoiseScale;
#endif
}

View File

@@ -0,0 +1,18 @@
uniform sampler2D g_Texture0; // {"hidden":true}
#include "common_blur.h"
varying vec4 v_TexCoord;
void main() {
#if KERNEL == 0
gl_FragColor = blur13a(v_TexCoord.xy, v_TexCoord.zw);
#endif
#if KERNEL == 1
gl_FragColor = blur7a(v_TexCoord.xy, v_TexCoord.zw);
#endif
#if KERNEL == 2
gl_FragColor = blur3a(v_TexCoord.xy, v_TexCoord.zw);
#endif
}

View File

@@ -0,0 +1,25 @@
// [COMBO] {"material":"ui_editor_properties_kernel_size","combo":"KERNEL","type":"options","default":1,"options":{"13x13":0,"7x7":1,"3x3":2}}
uniform vec2 g_Scale; // {"material":"blurscale","label":"ui_editor_properties_blur_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;
void main() {
gl_Position = vec4(a_Position, 1.0);
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
}