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,17 @@
{
"version" : 1,
"replacementkey" : "empty",
"group" : "colorize",
"passes" :
[
{
"material" : "materials/effects/empty.json"
}
],
"dependencies" :
[
"materials/effects/empty.json",
"shaders/effects/empty.frag",
"shaders/effects/empty.vert"
]
}

View File

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

View File

@@ -0,0 +1,9 @@
uniform sampler2D g_Texture0; // {"material":"framebuffer","label":"ui_editor_properties_framebuffer","hidden":true}
varying vec2 v_TexCoord;
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
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,20 @@
{
"version" : 1,
"replacementkey" : "blend",
"name" : "ui_editor_effect_blend_title",
"description" : "ui_editor_effect_blend_description",
"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,9 @@
{
"passes": [{
"shader": "effects/blend",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,18 @@
{
"name" : "Blend",
"description" : "Blend two images with various modes.",
"group" : "image",
//"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" : "Opacity",
"description" : "Adds an opacity mask to the image.",
"group" : "image",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/opacity.json"
}
],
"dependencies" :
[
"materials/effects/opacity.json",
"shaders/effects/opacity.frag",
"shaders/effects/opacity.vert"
]
}

View File

@@ -0,0 +1,18 @@
{
"name" : "Scroll",
"description" : "Scrolls the image horizontally or vertically.",
"group" : "image",
"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" : "Spin",
"description" : "Spin the image.",
"group" : "image",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/spin.json"
}
],
"dependencies" :
[
"materials/effects/spin.json",
"shaders/effects/spin.frag",
"shaders/effects/spin.vert"
]
}

View File

@@ -0,0 +1,18 @@
{
"name" : "Transform",
"description" : "Apply scaling, rotation and offsets to the image.",
"group" : "image",
"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" : [ "effectpreview" ]
}
]
}

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

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/spin",
"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,5 @@
{
"format" : "rgba8888",
"nomip" : true,
"nonpoweroftwo" : true
}

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" : "previewblend",
"type" : "scene"
}

View File

@@ -0,0 +1,115 @@
{
"camera" :
{
"center" : "-121.595 -15.576 -1.000",
"eye" : "-121.595 -15.576 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" : [ 15 ],
"depth" : 1,
"effects" :
[
{
"file" : "effects/blend/effect.json",
"passes" :
[
{
"combos" :
{
"BLENDMODE" : 23
},
"constantshadervalues" : null,
"textures" : [ null, "_rt_imageLayerComposite_15_a" ]
}
]
}
],
"id" : 38,
"image" : "models/effectpreview.json",
"name" : "",
"origin" : "128.000 128.000 0.000",
"scale" : "1.000 1.000 1.000"
},
{
"angles" : "0.000 0.000 0.000",
"depth" : 1,
"effects" :
[
{
"file" : "effects/transform/effect.json",
"passes" :
[
{
"combos" :
{
"CLAMP" : 1,
"MODE" : 0
},
"constantshadervalues" :
{
"Angle" : 0,
"Scale" : "3 3"
}
}
]
},
{
"file" : "effects/spin/effect.json",
"passes" :
[
{
"combos" :
{
"MODE" : 0
},
"constantshadervalues" : null
}
]
},
{
"file" : "effects/opacity/effect.json",
"passes" :
[
{
"combos" : null,
"constantshadervalues" : null,
"textures" : [ null, "masks/opacity_mask_ee0d9bbc6d0516b8583c8fb3e841485c0b7ec4e8" ]
}
]
}
],
"id" : 15,
"image" : "models/effectpreview.json",
"name" : "effectpreview",
"origin" : "-204.142 136.225 0.000",
"scale" : "1.000 1.000 1.000"
}
]
}

View File

@@ -0,0 +1,18 @@
// [COMBO] {"material":"Blend mode","combo":"BLENDMODE","type":"imageblending","default":2}
#include "common_blending.h"
varying vec4 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Color mask","mode":"rgbmask","default":"util/white"}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
vec4 mask = texSample2D(g_Texture1, v_TexCoord.zw);
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, mask.rgb, mask.a);
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,15 @@
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,13 @@
varying vec4 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Mask","mode":"opacitymask","default":"util/white"}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
albedo.a *= mask;
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,15 @@
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,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,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,29 @@
// [COMBO] {"material":"Mode","combo":"MODE","type":"options","default":0,"options":{"Vertex":1,"UV":0}}
#include "common.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform float g_Time;
uniform float g_Speed; // {"material":"Speed","default":1.0,"range":[-5,5]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec2 v_TexCoord;
void main() {
vec3 position = a_Position;
#if MODE == 1
position.xy = rotateVec2(position.xy - CAST2(0.5), g_Speed * g_Time) + CAST2(0.5);
#endif
gl_Position = mul(vec4(position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord = a_TexCoord;
#if MODE == 0
v_TexCoord = rotateVec2(v_TexCoord - CAST2(0.5), g_Speed * g_Time) + CAST2(0.5);
#endif
}

View File

@@ -0,0 +1,14 @@
// [COMBO] {"material":"Repeat","combo":"CLAMP","type":"options","default":0}
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,127 @@
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":2}
// [COMBO] {"material":"ui_editor_properties_transform","combo":"TRANSFORMUV","type":"options","default":0}
// [COMBO] {"material":"ui_editor_properties_transform_repeat","combo":"TRANSFORMREPEAT","type":"options","default":0,"options":{"ui_editor_properties_clip":0,"ui_editor_properties_repeat":1,"ui_editor_properties_clamp_uvs":2},"require":{"TRANSFORMUV":1}}
// [COMBO] {"material":"ui_editor_properties_write_alpha","combo":"WRITEALPHA","type":"options","default":0}
// [COMBO] {"material":"ui_editor_properties_number_of_textures","combo":"NUMBLENDTEXTURES","type":"options","default":1,"options":{"1":1,"2":2,"3":3,"4":4,"5":5,"6":6}}
#include "common_blending.h"
varying vec4 v_TexCoord;
#if NUMBLENDTEXTURES >= 2
varying vec4 v_TexCoord23;
#endif
#if NUMBLENDTEXTURES >= 4
varying vec4 v_TexCoord45;
#endif
#if NUMBLENDTEXTURES >= 6
varying vec2 v_TexCoord6;
#endif
uniform float g_Multiply; // {"material":"multiply","label":"ui_editor_properties_blend_amount","default":1,"range":[0.0, 2.0]}
uniform float g_Multiply2; // {"material":"multiply2","label":"ui_editor_properties_blend_amount_2","default":1,"range":[0.0, 2.0]}
uniform float g_Multiply3; // {"material":"multiply3","label":"ui_editor_properties_blend_amount_3","default":1,"range":[0.0, 2.0]}
uniform float g_Multiply4; // {"material":"multiply4","label":"ui_editor_properties_blend_amount_4","default":1,"range":[0.0, 2.0]}
uniform float g_Multiply5; // {"material":"multiply5","label":"ui_editor_properties_blend_amount_5","default":1,"range":[0.0, 2.0]}
uniform float g_Multiply6; // {"material":"multiply6","label":"ui_editor_properties_blend_amount_6","default":1,"range":[0.0, 2.0]}
uniform float g_AlphaMultiply; // {"material":"alpha","label":"ui_editor_properties_alpha","default":1,"range":[0.0, 1.0]}
#if OPACITYMASK == 1
varying vec2 v_TexCoordOpacity;
#endif
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture7; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"OPACITYMASK","paintdefaultcolor":"0 0 0 1"}
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
#if NUMBLENDTEXTURES >= 2
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
#endif
#if NUMBLENDTEXTURES >= 3
uniform sampler2D g_Texture3; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
#endif
#if NUMBLENDTEXTURES >= 4
uniform sampler2D g_Texture4; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
#endif
#if NUMBLENDTEXTURES >= 5
uniform sampler2D g_Texture5; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
#endif
#if NUMBLENDTEXTURES >= 6
uniform sampler2D g_Texture6; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
#endif
float GetUVBlend(vec2 uv)
{
#if TRANSFORMUV == 1 && TRANSFORMREPEAT == 0
return step(0.99, dot(step(CAST2(0.0), uv) * step(uv, CAST2(1.0)), CAST2(0.5)));
#endif
return 1.0;
}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
vec2 blendUV = v_TexCoord.zw;
#if TRANSFORMUV == 1 && TRANSFORMREPEAT == 1
blendUV = frac(blendUV);
#endif
vec4 blendColors = texSample2D(g_Texture1, blendUV);
float blend = 1.0;
#if OPACITYMASK == 1
blend *= texSample2D(g_Texture7, v_TexCoordOpacity).r;
#endif
float blendAlpha = GetUVBlend(blendUV) * blend * g_Multiply * blendColors.a;
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, blendAlpha);
#if NUMBLENDTEXTURES >= 2
blendUV = frac(v_TexCoord23.xy);
blendColors = texSample2D(g_Texture2, blendUV);
blendAlpha *= blendColors.a * g_Multiply2;
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, GetUVBlend(blendUV) * blend * g_Multiply2 * blendColors.a);
#endif
#if NUMBLENDTEXTURES >= 3
blendUV = frac(v_TexCoord23.zw);
blendColors = texSample2D(g_Texture3, blendUV);
blendAlpha *= blendColors.a * g_Multiply3;
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, GetUVBlend(blendUV) * blend * g_Multiply3 * blendColors.a);
#endif
#if NUMBLENDTEXTURES >= 4
blendUV = frac(v_TexCoord45.xy);
blendColors = texSample2D(g_Texture4, blendUV);
blendAlpha *= blendColors.a * g_Multiply4;
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, GetUVBlend(blendUV) * blend * g_Multiply4 * blendColors.a);
#endif
#if NUMBLENDTEXTURES >= 5
blendUV = frac(v_TexCoord45.zw);
blendColors = texSample2D(g_Texture5, blendUV);
blendAlpha *= blendColors.a * g_Multiply5;
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, GetUVBlend(blendUV) * blend * g_Multiply5 * blendColors.a);
#endif
#if NUMBLENDTEXTURES >= 6
blendUV = frac(v_TexCoord6.xy);
blendColors = texSample2D(g_Texture6, blendUV);
blendAlpha *= blendColors.a * g_Multiply6;
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, GetUVBlend(blendUV) * blend * g_Multiply6 * blendColors.a);
#endif
#if WRITEALPHA
albedo.a = blendColors.a * g_AlphaMultiply;
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,91 @@
#include "common.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
uniform vec4 g_Texture2Resolution;
uniform vec4 g_Texture3Resolution;
uniform vec4 g_Texture4Resolution;
uniform vec4 g_Texture5Resolution;
uniform vec4 g_Texture6Resolution;
#if OPACITYMASK == 1
uniform vec4 g_Texture7Resolution;
varying vec2 v_TexCoordOpacity;
#endif
#if TRANSFORMUV == 1
uniform vec4 g_Texture0Resolution;
#endif
uniform vec2 g_BlendOffset; // {"material":"blendoffset","label":"ui_editor_properties_offset","default":"0 0"}
uniform float g_BlendAngle; // {"material":"blendangle","label":"ui_editor_properties_angle","default":0,"range":[0,6.28]}
uniform float g_BlendScale; // {"material":"blendscale","label":"ui_editor_properties_scale","default":1,"range":[0.01,2]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
#if NUMBLENDTEXTURES >= 2
varying vec4 v_TexCoord23;
#endif
#if NUMBLENDTEXTURES >= 4
varying vec4 v_TexCoord45;
#endif
#if NUMBLENDTEXTURES >= 6
varying vec2 v_TexCoord6;
#endif
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 NUMBLENDTEXTURES >= 2
v_TexCoord23.xy = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
v_TexCoord23.zw = CAST2(0.0);
#endif
#if NUMBLENDTEXTURES >= 3
v_TexCoord23.zw = vec2(v_TexCoord.x * g_Texture3Resolution.z / g_Texture3Resolution.x,
v_TexCoord.y * g_Texture3Resolution.w / g_Texture3Resolution.y);
#endif
#if NUMBLENDTEXTURES >= 4
v_TexCoord45.xy = vec2(v_TexCoord.x * g_Texture4Resolution.z / g_Texture4Resolution.x,
v_TexCoord.y * g_Texture4Resolution.w / g_Texture4Resolution.y);
v_TexCoord45.zw = CAST2(0.0);
#endif
#if NUMBLENDTEXTURES >= 5
v_TexCoord45.zw = vec2(v_TexCoord.x * g_Texture5Resolution.z / g_Texture5Resolution.x,
v_TexCoord.y * g_Texture5Resolution.w / g_Texture5Resolution.y);
#endif
#if NUMBLENDTEXTURES >= 6
v_TexCoord6.xy = vec2(v_TexCoord.x * g_Texture6Resolution.z / g_Texture6Resolution.x,
v_TexCoord.y * g_Texture6Resolution.w / g_Texture6Resolution.y);
#endif
#if TRANSFORMUV == 1
vec2 scaleA = g_Texture0Resolution.zw / g_Texture1Resolution.zw;
//vec2 scaleB = g_Texture0Resolution.wz / g_Texture1Resolution.wz;
//vec2 dir = abs(rotateVec2(vec2(1, 0), g_BlendAngle));
v_TexCoord.zw -= (g_BlendOffset - (g_Texture0Resolution.zw - g_Texture1Resolution.zw) * 0.5) / g_Texture0Resolution.zw;
v_TexCoord.zw -= CAST2(0.5);
v_TexCoord.zw = rotateVec2(v_TexCoord.zw, g_BlendAngle);
// Too tired now to get this right, maybe look later at this again
//v_TexCoord.zw *= scaleA * dot(dir, vec2(1, 0)) + scaleB * dot(dir, vec2(0, 1));
//v_TexCoord.zw *= mix(scaleA, scaleB, abs(sin(g_BlendAngle))) / g_BlendScale;
v_TexCoord.zw *= scaleA / g_BlendScale;
//v_TexCoord.zw *= scaleA * abs(cos(g_BlendAngle)) + scaleB * abs(sin(g_BlendAngle));
v_TexCoord.zw += CAST2(0.5);
#endif
#if OPACITYMASK == 1
v_TexCoordOpacity = vec2(v_TexCoord.x * g_Texture7Resolution.z / g_Texture7Resolution.x,
v_TexCoord.y * g_Texture7Resolution.w / g_Texture7Resolution.y);
#endif
}

View File

@@ -0,0 +1,20 @@
{
"version" : 1,
"replacementkey" : "blendgradient",
"name" : "ui_editor_effect_blend_gradient_title",
"description" : "ui_editor_effect_blend_gradient_description",
"group" : "colorize",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/blendgradient.json"
}
],
"dependencies" :
[
"materials/effects/blendgradient.json",
"shaders/effects/blendgradient.frag",
"shaders/effects/blendgradient.vert"
]
}

View File

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

View File

@@ -0,0 +1,20 @@
{
"version" : 1,
"replacementkey" : "blendgradient",
"name" : "ui_editor_effect_blend_gradient_title",
"description" : "ui_editor_effect_blend_gradient_description",
"group" : "colorize",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/blendgradient.json"
}
],
"dependencies" :
[
"materials/effects/blendgradient.json",
"shaders/effects/blendgradient.frag",
"shaders/effects/blendgradient.vert"
]
}

View File

@@ -0,0 +1,20 @@
{
"version" : 1,
"replacementkey" : "tint",
"name" : "ui_editor_effect_tint_title",
"description" : "ui_editor_effect_tint_description",
"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,20 @@
{
"version" : 1,
"replacementkey" : "vhs",
"name" : "ui_editor_effect_vhs_title",
"description" : "ui_editor_effect_vhs_description",
"group" : "colorize",
"preview" : "previewvhs/project.json",
"passes" :
[
{
"material" : "materials/effects/vhs.json"
}
],
"dependencies" :
[
"materials/effects/vhs.json",
"shaders/effects/vhs.frag",
"shaders/effects/vhs.vert"
]
}

View File

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

View File

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

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/blendgradient",
"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/vhs",
"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,19 @@
{
"file" : "scene.json",
"general" :
{
"properties" :
{
"schemecolor" :
{
"order" : 0,
"text" : "ui_browse_properties_scheme_color",
"type" : "color",
"value" : "0 0 0"
}
}
},
"title" : "preview",
"type" : "scene",
"version" : 0
}

View File

@@ -0,0 +1,213 @@
{
"camera" :
{
"center" : "0.00000 0.00000 -1.00000",
"eye" : "0.00000 0.00000 0.00000",
"up" : "0.00000 1.00000 0.00000"
},
"general" :
{
"ambientcolor" : "0.30000 0.30000 0.30000",
"bloom" : false,
"bloomhdrfeather" : 0.1,
"bloomhdriterations" : 8,
"bloomhdrscatter" : 1.619,
"bloomhdrstrength" : 2.0,
"bloomhdrthreshold" : 1.0,
"bloomstrength" : 2.0,
"bloomthreshold" : 0.64999998,
"camerafade" : true,
"cameraparallax" : false,
"cameraparallaxamount" : 0.5,
"cameraparallaxdelay" : 0.1,
"cameraparallaxmouseinfluence" : 0.0,
"camerapreview" : true,
"camerashake" : false,
"camerashakeamplitude" : 0.5,
"camerashakeroughness" : 1.0,
"camerashakespeed" : 3.0,
"clearcolor" : "0.70000 0.70000 0.70000",
"clearenabled" : true,
"farz" : 10000.0,
"fov" : 50.0,
"hdr" : false,
"nearz" : 0.0099999998,
"orthogonalprojection" :
{
"height" : 256,
"width" : 256
},
"skylightcolor" : "0.30000 0.30000 0.30000",
"zoom" : 1.0
},
"objects" :
[
{
"alignment" : "center",
"alpha" : 1.0,
"angles" : "0.00000 0.00000 0.00000",
"brightness" : 1.0,
"color" : "1.00000 1.00000 1.00000",
"colorBlendMode" : 0,
"copybackground" : true,
"effects" :
[
{
"file" : "effects/tint/effect.json",
"id" : 28,
"name" : "",
"passes" :
[
{
"constantshadervalues" :
{
"alpha" : 1.0,
"color" : "1 0 0"
},
"id" : 29
}
],
"visible" : true
},
{
"file" : "effects/vhs/effect.json",
"id" : 35,
"name" : "",
"passes" :
[
{
"constantshadervalues" :
{
"artifacts" : 3,
"chromatic" : 0,
"distortionspeed" : 2,
"distortionstrength" : 10,
"distortionwidth" : 2,
"scale" : 0.03,
"strength" : 2
},
"id" : 36,
"textures" : [ null, "util/noise" ]
}
],
"visible" : true
}
],
"id" : 26,
"image" : "models/effectpreview.json",
"ledsource" : false,
"locktransforms" : false,
"name" : "effectpreview",
"origin" : "128.00000 128.00000 0.00000",
"parallaxDepth" : "1.00000 1.00000",
"perspective" : false,
"scale" : "1.00000 1.00000 1.00000",
"size" : "256.00000 256.00000",
"solid" : true,
"visible" : false
},
{
"alignment" : "center",
"alpha" : 1.0,
"angles" : "0.00000 0.00000 0.00000",
"brightness" : 1.0,
"color" : "1.00000 1.00000 1.00000",
"colorBlendMode" : 0,
"copybackground" : true,
"dependencies" : [ 26 ],
"depth" : 1,
"effects" :
[
{
"file" : "effects/blendgradient/effect.json",
"id" : 18,
"name" : "",
"passes" :
[
{
"combos" :
{
"EDGEGLOW" : 1
},
"constantshadervalues" :
{
"edgebrightness" : 1.0,
"edgecolor" : "0 0 0",
"gradientscale" : 0.05,
"multiply" :
{
"animation" :
{
"c0" :
[
{
"back" :
{
"enabled" : true,
"x" : -1,
"y" : 0
},
"frame" : 0,
"front" :
{
"enabled" : true,
"x" : 1,
"y" : 0
},
"lockangle" : true,
"locklength" : true,
"value" : 1
},
{
"back" :
{
"enabled" : true,
"x" : -1,
"y" : 0
},
"frame" : 30,
"front" :
{
"enabled" : true,
"x" : 1,
"y" : 0
},
"lockangle" : true,
"locklength" : true,
"value" : 0
}
],
"options" :
{
"fps" : 15,
"length" : 30,
"mode" : "mirror",
"wraploop" : null
}
},
"value" : 1
}
},
"id" : 19,
"textures" : [ null, "_rt_imageLayerComposite_26_a", "util/clouds_256" ]
}
],
"visible" : true
}
],
"id" : 38,
"image" : "models/effectpreview.json",
"ledsource" : false,
"locktransforms" : false,
"name" : "",
"origin" : "128.00000 128.00000 0.00000",
"parallaxDepth" : "1.00000 1.00000",
"perspective" : false,
"scale" : "1.00000 1.00000 1.00000",
"size" : "256.00000 256.00000",
"solid" : true,
"visible" : true
}
],
"version" : 0
}

View File

@@ -0,0 +1,75 @@
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":0}
// [COMBO] {"material":"ui_editor_properties_transform","combo":"TRANSFORMUV","type":"options","default":0}
// [COMBO] {"material":"ui_editor_properties_transform_repeat","combo":"TRANSFORMREPEAT","type":"options","default":0,"options":{"ui_editor_properties_clip":0,"ui_editor_properties_repeat":1,"ui_editor_properties_clamp_uvs":2}}
// [COMBO] {"material":"ui_editor_properties_write_alpha","combo":"WRITEALPHA","type":"options","default":0}
// [COMBO] {"material":"ui_editor_properties_edge_glow","combo":"EDGEGLOW","type":"options","default":0}
#include "common_blending.h"
varying vec4 v_TexCoord;
uniform float g_Multiply; // {"material":"multiply","label":"ui_editor_properties_blend_amount","default":1,"range":[0.0, 1.0]}
uniform float g_GradientScale; // {"material":"gradientscale","label":"ui_editor_properties_gradient_scale","default":0.05,"range":[0.01, 0.25]}
uniform float g_AlphaMultiply; // {"material":"alpha","label":"ui_editor_properties_alpha","default":1,"range":[0.0, 1.0]}
uniform float g_EdgeBrightness; // {"material":"edgebrightness","label":"ui_editor_properties_edge_brightness","default":1,"range":[0.0, 5.0]}
uniform vec3 g_EdgeColor; // {"material":"edgecolor","label":"ui_editor_properties_edge_color","default":"1 0.75 0","type":"color"}
#if OPACITYMASK == 1
varying vec2 v_TexCoordOpacity;
#endif
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_gradient_mask","mode":"opacitymask","default":"util/clouds_256","paintdefaultcolor":"0 0 0 1"}
uniform sampler2D g_Texture3; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"OPACITYMASK","paintdefaultcolor":"0 0 0 1"}
float GetUVBlend(vec2 uv)
{
#if TRANSFORMUV == 1 && TRANSFORMREPEAT == 0
return step(0.99, dot(step(CAST2(0.0), uv) * step(uv, CAST2(1.0)), CAST2(0.5)));
#endif
return 1.0;
}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
vec2 blendUV = v_TexCoord.zw;
#if TRANSFORMUV == 1 && TRANSFORMREPEAT == 1
blendUV = frac(blendUV);
#endif
vec4 blendColors = texSample2D(g_Texture1, blendUV);
float blend = 1.0;
float gradient = texSample2D(g_Texture2, blendUV).r;
blend = smoothstep(saturate(gradient - g_GradientScale), saturate(gradient + g_GradientScale), g_Multiply);
#if OPACITYMASK == 1
float mask = texSample2D(g_Texture3, v_TexCoordOpacity).r;
blend *= mask;
#endif
float blendAlpha = GetUVBlend(blendUV) * blend * blendColors.a;
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, blendAlpha);
#if EDGEGLOW
float burnWidth = g_GradientScale * 0.5;
float burnAmount = step(gradient - burnWidth, g_Multiply) *
step(g_Multiply, gradient + burnWidth) *
step(0.01, g_Multiply) *
step(g_Multiply, 0.999);
#if OPACITYMASK == 1
burnAmount *= mask;
#endif
albedo.rgb = max(CAST3(0.0), mix(albedo.rgb, g_EdgeColor, burnAmount * g_EdgeBrightness));
#endif
#if WRITEALPHA
albedo.a = blendColors.a * g_AlphaMultiply;
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,52 @@
#include "common.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
uniform vec4 g_Texture2Resolution;
uniform vec4 g_Texture3Resolution;
uniform vec4 g_Texture4Resolution;
uniform vec4 g_Texture5Resolution;
uniform vec4 g_Texture6Resolution;
#if OPACITYMASK == 1
uniform vec4 g_Texture7Resolution;
varying vec2 v_TexCoordOpacity;
#endif
#if TRANSFORMUV == 1
uniform vec4 g_Texture0Resolution;
#endif
uniform vec2 g_BlendOffset; // {"material":"blendoffset","label":"ui_editor_properties_offset","default":"0 0"}
uniform float g_BlendAngle; // {"material":"blendangle","label":"ui_editor_properties_angle","default":0,"range":[0,6.28]}
uniform float g_BlendScale; // {"material":"blendscale","label":"ui_editor_properties_scale","default":1,"range":[0.01,2]}
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 TRANSFORMUV == 1
vec2 scaleA = g_Texture0Resolution.zw / g_Texture1Resolution.zw;
v_TexCoord.zw -= (g_BlendOffset - (g_Texture0Resolution.zw - g_Texture1Resolution.zw) * 0.5) / g_Texture0Resolution.zw;
v_TexCoord.zw -= CAST2(0.5);
v_TexCoord.zw = rotateVec2(v_TexCoord.zw, g_BlendAngle);
v_TexCoord.zw *= scaleA / g_BlendScale;
v_TexCoord.zw += CAST2(0.5);
#endif
#if OPACITYMASK == 1
v_TexCoordOpacity = vec2(v_TexCoord.x * g_Texture7Resolution.z / g_Texture7Resolution.x,
v_TexCoord.y * g_Texture7Resolution.w / g_Texture7Resolution.y);
#endif
}

View File

@@ -0,0 +1,29 @@
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":30}
#include "common_blending.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 float g_BlendAlpha; // {"material":"alpha", "label":"ui_editor_properties_alpha","default":1,"range":[0,1]}
uniform vec3 g_TintColor; // {"material":"color", "label":"ui_editor_properties_color", "type": "color", "default":"1 0 0"}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
float mask = g_BlendAlpha;
#if MASK
mask *= texSample2D(g_Texture1, v_TexCoord.zw).r;
#endif
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, g_TintColor, mask);
#if BLENDMODE == 0
albedo.a = 1.0;
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,21 @@
uniform mat4 g_ModelViewProjectionMatrix;
#if MASK
uniform vec4 g_Texture1Resolution;
#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 = a_TexCoord.xyxy;
#if MASK
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture1Resolution.z / g_Texture1Resolution.x,
v_TexCoord.y * g_Texture1Resolution.w / g_Texture1Resolution.y);
#endif
}

View File

@@ -0,0 +1,78 @@
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":12}
// [COMBO] {"material":"ui_editor_properties_greyscale","combo":"GREYSCALE","type":"options","default":0}
// [COMBO] {"material":"ui_editor_properties_artifacts_negated","combo":"INVERTARTIFACTS","type":"options","default":1}
#include "common.h"
#include "common_blending.h"
varying vec4 v_TexCoord;
varying vec2 v_TexCoordGlitchBase;
varying vec4 v_TexCoordGlitch;
varying vec4 v_TexCoordNoise;
varying vec4 v_TexCoordVHSNoise;
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","paintdefaultcolor":"0 0 0 1","combo":"MASK"}
uniform float g_Time;
uniform float g_NoiseScale; // {"material":"scale","label":"ui_editor_properties_scale","default":0.3,"range":[0.01, 1.0]}
uniform float g_NoiseAlpha; // {"material":"strength","label":"ui_editor_properties_alpha","default":1.0,"range":[0.0, 2.0]}
uniform float g_DistortionStrength; // {"material":"distortionstrength","label":"ui_editor_properties_distortion_strength","default":1.0,"range":[0.0, 2.0]}
uniform float g_DistortionSpeed; // {"material":"distortionspeed","label":"ui_editor_properties_distortion_speed","default":1,"range":[0.0, 2.0]}
uniform float g_DistortionWidth; // {"material":"distortionwidth","label":"ui_editor_properties_distortion_width","default":1.0,"range":[0.0, 2.0]}
uniform float g_ArtifactsScale; // {"material":"artifacts","label":"ui_editor_properties_artifacts","default":1.5,"range":[0.0, 3.0]}
void main() {
float dblend = sin(g_Time);
dblend = sign(dblend) * pow(abs(max(0.00001, dblend)), 4.0);
vec2 distortion = vec2(dblend *
g_DistortionStrength * 0.02 *
smoothstep(0.01 * g_DistortionWidth, 0.0, abs(frac(g_Time * g_DistortionSpeed) - v_TexCoord.y)),
0.0);
distortion *= g_NoiseAlpha;
vec4 albedo;
float vhsBlend = 1.0;
#if MASK == 1
vhsBlend *= texSample2D(g_Texture2, v_TexCoord.zw).r;
vec4 orig = texSample2D(g_Texture0, v_TexCoord.xy + distortion * vhsBlend);
albedo.ga = texSample2D(g_Texture0, v_TexCoordGlitchBase + distortion * vhsBlend).ga;
#else
vec4 orig = texSample2D(g_Texture0, v_TexCoord.xy + distortion);
albedo.ga = orig.ga;
#endif
albedo.r = texSample2D(g_Texture0, v_TexCoordGlitch.xy + distortion).r;
albedo.b = texSample2D(g_Texture0, v_TexCoordGlitch.zw + distortion).b;
vec3 noise = texSample2D(g_Texture1, v_TexCoordNoise.xy).rgb;
vec3 noise2 = texSample2D(g_Texture1, v_TexCoordNoise.zw).gbr;
#if GREYSCALE == 1
noise = CAST3(greyscale(noise));
noise2 = CAST3(greyscale(noise2));
#endif
noise = saturate(noise * noise2);
float blend = 0.1;
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, noise, blend);
albedo.rgb = BlendOpacity(albedo.rgb, smoothstep(0.7, 1.0, noise), BlendLinearDodge, blend);
vec2 vhsNoise = texSample2D(g_Texture1, v_TexCoordVHSNoise.xy).rg;
vec2 vhsNoise2 = texSample2D(g_Texture1, v_TexCoordVHSNoise.zw).rg;
float artifactLimiter = pow(max(g_ArtifactsScale, 0.0001), 0.2);
float artifactsAlpha = step(0.001, g_NoiseScale) * step(0.9, vhsNoise.x * artifactLimiter) * step(0.9, vhsNoise2.x * artifactLimiter) * vhsNoise.y * vhsNoise2.y;
#if INVERTARTIFACTS
albedo.rgb = mix(albedo.rgb, CAST3(1.0 - albedo.rgb), artifactsAlpha);
#else
albedo.rgb += CAST3(artifactsAlpha);
#endif
gl_FragColor = mix(orig, albedo, g_NoiseAlpha * vhsBlend);
}

View File

@@ -0,0 +1,56 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture0Resolution;
#if MASK == 1
uniform vec4 g_Texture2Resolution;
#endif
uniform float g_Time;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
varying vec2 v_TexCoordGlitchBase;
varying vec4 v_TexCoordGlitch;
varying vec4 v_TexCoordNoise;
varying vec4 v_TexCoordVHSNoise;
uniform float g_NoiseScale; // {"material":"scale","label":"ui_editor_properties_scale","default":0.3,"range":[0.01, 1.0]}
uniform float g_Chromatic; // {"material":"chromatic","label":"ui_editor_properties_chromatic_aberration","default":0.1,"range":[0.0, 1.0]}
uniform float g_ArtifactsScale; // {"material":"artifacts","label":"ui_editor_properties_artifacts","default":1.5,"range":[0.0, 3.0]}
uniform float g_NoiseAlpha; // {"material":"strength","label":"ui_editor_properties_alpha","default":1.0,"range":[0.0, 2.0]}
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
float aspect = g_Texture0Resolution.z / g_Texture0Resolution.w;
float t = frac(g_Time);
v_TexCoord = a_TexCoord.xyxy;
v_TexCoordNoise.xy = (a_TexCoord.xy + t) * g_NoiseScale;
v_TexCoordNoise.zw = (a_TexCoord.xy - t * 2.5) * g_NoiseScale * 0.52;
v_TexCoordNoise *= vec4(aspect, 1.0, aspect, 1.0);
#if MASK == 1
v_TexCoord.zw = vec2(a_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
a_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
#endif
v_TexCoordVHSNoise.xy = v_TexCoordNoise.xy * vec2(0.1, 10) * g_ArtifactsScale;
v_TexCoordVHSNoise.zw = v_TexCoordNoise.zw * vec2(0.01, 2) * g_ArtifactsScale;
v_TexCoordGlitch = v_TexCoord.xyxy;
vec3 glitchOffset = g_Chromatic * smoothstep(0, 2, 1 + 0.5 * sin(g_Time * vec3(11, 7, 13) * 2)) * vec3(0.0019, 0.0021, 0.0017);
v_TexCoordGlitch.y += 0.004 * g_Chromatic + glitchOffset.x;
v_TexCoordGlitch.xz += glitchOffset.xy + vec2(0.005, -0.0005) * g_Chromatic;
v_TexCoordGlitch.z -= glitchOffset.z + 0.006 * g_Chromatic;
v_TexCoordGlitch.w -= 0.0045 * g_Chromatic;
v_TexCoordGlitchBase.x = v_TexCoord.x + glitchOffset.z * min(1.0, g_NoiseAlpha);
v_TexCoordGlitchBase.y = v_TexCoord.y - glitchOffset.z * min(1.0, g_NoiseAlpha);
}

View File

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

View File

@@ -0,0 +1,75 @@
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":0}
// [COMBO] {"material":"ui_editor_properties_transform","combo":"TRANSFORMUV","type":"options","default":0}
// [COMBO] {"material":"ui_editor_properties_transform_repeat","combo":"TRANSFORMREPEAT","type":"options","default":0,"options":{"ui_editor_properties_clip":0,"ui_editor_properties_repeat":1,"ui_editor_properties_clamp_uvs":2},"require":{"TRANSFORMUV":1}}
// [COMBO] {"material":"ui_editor_properties_write_alpha","combo":"WRITEALPHA","type":"options","default":0}
// [COMBO] {"material":"ui_editor_properties_edge_glow","combo":"EDGEGLOW","type":"options","default":0}
#include "common_blending.h"
varying vec4 v_TexCoord;
uniform float g_Multiply; // {"material":"multiply","label":"ui_editor_properties_blend_amount","default":1,"range":[0.0, 1.0]}
uniform float g_GradientScale; // {"material":"gradientscale","label":"ui_editor_properties_gradient_scale","default":0.05,"range":[0.01, 0.25]}
uniform float g_AlphaMultiply; // {"material":"alpha","label":"ui_editor_properties_alpha","default":1,"range":[0.0, 1.0]}
uniform float g_EdgeBrightness; // {"material":"edgebrightness","label":"ui_editor_properties_edge_brightness","default":1,"range":[0.0, 5.0]}
uniform vec3 g_EdgeColor; // {"material":"edgecolor","label":"ui_editor_properties_edge_color","default":"1 0.75 0","type":"color"}
#if OPACITYMASK == 1
varying vec2 v_TexCoordOpacity;
#endif
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_gradient_mask","mode":"opacitymask","default":"util/clouds_256","paintdefaultcolor":"0 0 0 1"}
uniform sampler2D g_Texture3; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"OPACITYMASK","paintdefaultcolor":"0 0 0 1"}
float GetUVBlend(vec2 uv)
{
#if TRANSFORMUV == 1 && TRANSFORMREPEAT == 0
return step(0.99, dot(step(CAST2(0.0), uv) * step(uv, CAST2(1.0)), CAST2(0.5)));
#endif
return 1.0;
}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
vec2 blendUV = v_TexCoord.zw;
#if TRANSFORMUV == 1 && TRANSFORMREPEAT == 1
blendUV = frac(blendUV);
#endif
vec4 blendColors = texSample2D(g_Texture1, blendUV);
float blend = 1.0;
float gradient = texSample2D(g_Texture2, blendUV).r;
blend = smoothstep(saturate(gradient - g_GradientScale), saturate(gradient + g_GradientScale), g_Multiply);
#if OPACITYMASK == 1
float mask = texSample2D(g_Texture3, v_TexCoordOpacity).r;
blend *= mask;
#endif
float blendAlpha = GetUVBlend(blendUV) * blend * blendColors.a;
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, blendAlpha);
#if EDGEGLOW
float burnWidth = g_GradientScale * 0.5;
float burnAmount = step(gradient - burnWidth, g_Multiply) *
step(g_Multiply, gradient + burnWidth) *
step(0.01, g_Multiply) *
step(g_Multiply, 0.999);
#if OPACITYMASK == 1
burnAmount *= mask;
#endif
albedo.rgb = max(CAST3(0.0), mix(albedo.rgb, g_EdgeColor, burnAmount * g_EdgeBrightness));
#endif
#if WRITEALPHA
albedo.a = blendColors.a * g_AlphaMultiply;
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,52 @@
#include "common.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
uniform vec4 g_Texture2Resolution;
uniform vec4 g_Texture3Resolution;
uniform vec4 g_Texture4Resolution;
uniform vec4 g_Texture5Resolution;
uniform vec4 g_Texture6Resolution;
#if OPACITYMASK == 1
uniform vec4 g_Texture7Resolution;
varying vec2 v_TexCoordOpacity;
#endif
#if TRANSFORMUV == 1
uniform vec4 g_Texture0Resolution;
#endif
uniform vec2 g_BlendOffset; // {"material":"blendoffset","label":"ui_editor_properties_offset","default":"0 0"}
uniform float g_BlendAngle; // {"material":"blendangle","label":"ui_editor_properties_angle","default":0,"range":[0,6.28]}
uniform float g_BlendScale; // {"material":"blendscale","label":"ui_editor_properties_scale","default":1,"range":[0.01,2]}
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 TRANSFORMUV == 1
vec2 scaleA = g_Texture0Resolution.zw / g_Texture1Resolution.zw;
v_TexCoord.zw -= (g_BlendOffset - (g_Texture0Resolution.zw - g_Texture1Resolution.zw) * 0.5) / g_Texture0Resolution.zw;
v_TexCoord.zw -= CAST2(0.5);
v_TexCoord.zw = rotateVec2(v_TexCoord.zw, g_BlendAngle);
v_TexCoord.zw *= scaleA / g_BlendScale;
v_TexCoord.zw += CAST2(0.5);
#endif
#if OPACITYMASK == 1
v_TexCoordOpacity = vec2(v_TexCoord.x * g_Texture7Resolution.z / g_Texture7Resolution.x,
v_TexCoord.y * g_Texture7Resolution.w / g_Texture7Resolution.y);
#endif
}

View 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"
]
}

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,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"
]
}

View File

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

View File

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

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/blur_combine",
"blending": "translucent",
"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,6 @@
{
"clampuvs" : true,
"format" : "rgba8888",
"nomip" : true,
"nonpoweroftwo" : true
}

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" : "previewb",
"type" : "scene"
}

View 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"
}
]
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,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,4 @@
{
"name": "FX Preview",
"type": "scene2d"
}

View File

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

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; // {"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.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;
}

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; // {"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":"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
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More