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

View File

@@ -0,0 +1,37 @@
{
"version" : 2,
"replacementkey" : "clouds",
"name" : "ui_editor_effect_clouds_title",
"description" : "ui_editor_effect_clouds_description",
"group" : "colorize",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/clouds.json"
}
],
"dependencies" :
[
"materials/effects/clouds.json",
"shaders/effects/clouds.frag",
"shaders/effects/clouds.vert"
],
"gizmos" :
[
{
"type" : "EffectPerspectiveUV",
"condition" :
{
"PERSPECTIVE" : 1
},
"vars" :
{
"p0" : "point0",
"p1" : "point1",
"p2" : "point2",
"p3" : "point3"
}
}
]
}

View File

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

View File

@@ -0,0 +1,45 @@
{
"name" : "ui_editor_effect_blur_precise_title",
"description" : "ui_editor_effect_blur_precise_description",
"group" : "blur",
"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" : "ui_editor_effect_clouds_title",
"description" : "ui_editor_effect_clouds_description",
"group" : "colorize",
//"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/clouds.json"
}
],
"dependencies" :
[
"materials/effects/clouds.json",
"shaders/effects/clouds.frag",
"shaders/effects/clouds.vert"
]
}

View File

@@ -0,0 +1,62 @@
{
"name" : "ui_editor_effect_motion_blur_title",
"description" : "ui_editor_effect_motion_blur_description",
"group" : "blur",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/motionblur_accumulation.json",
"target" : "_rt_FullCompoBuffer2",
"bind" :
[
{
"name" : "previous",
"index" : 0
},
{
"name" : "_rt_FullCompoBuffer1",
"index" : 1
}
]
},
{
"command" : "copy",
"target" : "_rt_FullCompoBuffer1",
"source" : "_rt_FullCompoBuffer2"
},
{
"material" : "materials/effects/motionblur_combine.json",
"bind" :
[
{
"name" : "_rt_FullCompoBuffer2",
"index" : 0
}
]
}
],
"fbos" :
[
{
"name" : "_rt_FullCompoBuffer1",
"scale" : 1,
"format" : "rgba8888",
"unique" : true
},
{
"name" : "_rt_FullCompoBuffer2",
"scale" : 1,
"format" : "rgba8888"
}
],
"dependencies" :
[
"materials/effects/motionblur_accumulation.json",
"materials/effects/motionblur_combine.json",
"shaders/effects/motionblur_accumulation.frag",
"shaders/effects/motionblur_accumulation.vert",
"shaders/effects/motionblur_combine.frag",
"shaders/effects/motionblur_combine.vert"
]
}

View File

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

View File

@@ -0,0 +1,18 @@
{
"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,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_precise_gaussian",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,152 @@
{
"camera" :
{
"center" : "-1.873 4.397 -1.000",
"eye" : "-1.873 4.397 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" : "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" : false,
"effects" :
[
{
"file" : "effects/tint/effect.json",
"passes" :
[
{
"combos" :
{
"BLENDMODE" : 0
},
"constantshadervalues" :
{
"ui_editor_properties_alpha" : 1,
"ui_editor_properties_color" : "1 1 1"
}
}
]
},
{
"file" : "effects/clouds/effect.json",
"passes" :
[
{
"combos" :
{
"BLENDMODE" : 2,
"SHADING" : 1
},
"constantshadervalues" :
{
"ui_editor_properties_alpha" : 1,
"ui_editor_properties_color_end" : "0.7647058823529411 0.8235294117647058 1",
"ui_editor_properties_color_start" : "1 1 1",
"ui_editor_properties_direction" : 4.0199999809265137,
"ui_editor_properties_feather" : 0.079999998211860657,
"ui_editor_properties_scale" : "2 1.3",
"ui_editor_properties_shading" : 1,
"ui_editor_properties_shading_direction" : 3.2699999809265137,
"ui_editor_properties_threshold" : 0.27000001072883606
},
"textures" : [ null, "util/clouds_256" ]
}
]
},
{
"file" : "effects/blurprecise/effect.json",
"passes" :
[
{
"combos" :
{
"KERNEL" : 1
},
"constantshadervalues" :
{
"ui_editor_properties_scale" : "1.16 1.16"
}
},
{
"combos" :
{
"KERNEL" : 1,
"VERTICAL" : 1
},
"constantshadervalues" :
{
"ui_editor_properties_scale" : "1.16 1.16"
}
}
]
},
{
"file" : "effects/motionblur/effect.json",
"passes" :
[
{
"constantshadervalues" :
{
"Accumulation rate" : 0.059999998658895493
},
"textures" : [ null, "_rt_FullCompoBuffer1_23_40" ]
},
{}
]
}
],
"id" : 23,
"image" : "models/util/composelayer.json",
"name" : "Compose",
"origin" : "128.000 127.535 0.000",
"parallaxDepth" : "1.000 1.000",
"scale" : "1.000 1.000 1.000",
"size" : "256.000 256.000",
"visible" : true
}
]
}

View File

@@ -0,0 +1,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":"ui_editor_properties_framebuffer","hidden":true}
void main() {
#if KERNEL == 0
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.006299 +
texSample2D(g_Texture0, v_TexCoord[1]) * 0.017298 +
texSample2D(g_Texture0, v_TexCoord[2]) * 0.039533 +
texSample2D(g_Texture0, v_TexCoord[3]) * 0.075189 +
texSample2D(g_Texture0, v_TexCoord[4]) * 0.119007 +
texSample2D(g_Texture0, v_TexCoord[5]) * 0.156756 +
texSample2D(g_Texture0, v_TexCoord[6]) * 0.171834 +
texSample2D(g_Texture0, v_TexCoord[7]) * 0.156756 +
texSample2D(g_Texture0, v_TexCoord[8]) * 0.119007 +
texSample2D(g_Texture0, v_TexCoord[9]) * 0.075189 +
texSample2D(g_Texture0, v_TexCoord[10]) * 0.039533 +
texSample2D(g_Texture0, v_TexCoord[11]) * 0.017298 +
texSample2D(g_Texture0, v_TexCoord[12]) * 0.006299;
#endif
#if KERNEL == 1
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.071303 +
texSample2D(g_Texture0, v_TexCoord[1]) * 0.131514 +
texSample2D(g_Texture0, v_TexCoord[2]) * 0.189879 +
texSample2D(g_Texture0, v_TexCoord[3]) * 0.214607 +
texSample2D(g_Texture0, v_TexCoord[4]) * 0.189879 +
texSample2D(g_Texture0, v_TexCoord[5]) * 0.131514 +
texSample2D(g_Texture0, v_TexCoord[6]) * 0.071303;
#endif
#if KERNEL == 2
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.27901 +
texSample2D(g_Texture0, v_TexCoord[1]) * 0.44198 +
texSample2D(g_Texture0, v_TexCoord[2]) * 0.27901;
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,66 @@
// [COMBO] {"material":"ui_editor_properties_kernel_size","combo":"KERNEL","type":"options","default":2,"options":{"13x13":0,"7x7":1,"3x3":2}}
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec2 g_Scale; // {"material":"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() {
#if VERTICAL
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
#else
gl_Position = vec4(a_Position, 1.0);
#endif
#if VERTICAL
float offsetX = 0.0f;
float offsetY = g_Scale.y / g_Texture0Resolution.w;
#else
float offsetX = g_Scale.x / g_Texture0Resolution.z;
float offsetY = 0.0f;
#endif
#if KERNEL == 0
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX * 6.0, a_TexCoord.y - offsetY * 6.0);
v_TexCoord[1] = vec2(a_TexCoord.x - offsetX * 5.0, a_TexCoord.y - offsetY * 5.0);
v_TexCoord[2] = vec2(a_TexCoord.x - offsetX * 4.0, a_TexCoord.y - offsetY * 4.0);
v_TexCoord[3] = vec2(a_TexCoord.x - offsetX * 3.0, a_TexCoord.y - offsetY * 3.0);
v_TexCoord[4] = vec2(a_TexCoord.x - offsetX * 2.0, a_TexCoord.y - offsetY * 2.0);
v_TexCoord[5] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
v_TexCoord[6] = vec2(a_TexCoord.x, a_TexCoord.y);
v_TexCoord[7] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
v_TexCoord[8] = vec2(a_TexCoord.x + offsetX * 2.0, a_TexCoord.y + offsetY * 2.0);
v_TexCoord[9] = vec2(a_TexCoord.x + offsetX * 3.0, a_TexCoord.y + offsetY * 3.0);
v_TexCoord[10] = vec2(a_TexCoord.x + offsetX * 4.0, a_TexCoord.y + offsetY * 4.0);
v_TexCoord[11] = vec2(a_TexCoord.x + offsetX * 5.0, a_TexCoord.y + offsetY * 5.0);
v_TexCoord[12] = vec2(a_TexCoord.x + offsetX * 6.0, a_TexCoord.y + offsetY * 6.0);
#endif
#if KERNEL == 1
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX * 3.0, a_TexCoord.y - offsetY * 3.0);
v_TexCoord[1] = vec2(a_TexCoord.x - offsetX * 2.0, a_TexCoord.y - offsetY * 2.0);
v_TexCoord[2] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
v_TexCoord[3] = vec2(a_TexCoord.x, a_TexCoord.y);
v_TexCoord[4] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
v_TexCoord[5] = vec2(a_TexCoord.x + offsetX * 2.0, a_TexCoord.y + offsetY * 2.0);
v_TexCoord[6] = vec2(a_TexCoord.x + offsetX * 3.0, a_TexCoord.y + offsetY * 3.0);
#endif
#if KERNEL == 2
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
v_TexCoord[1] = vec2(a_TexCoord.x, a_TexCoord.y);
v_TexCoord[2] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
#endif
}

View File

@@ -0,0 +1,60 @@
// [COMBO] {"material":"ui_editor_properties_shading","combo":"SHADING","type":"options","default":0}
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":0}
#include "common.h"
#include "common_blending.h"
varying vec4 v_TexCoord;
varying vec4 v_TexCoordClouds;
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"ui_editor_properties_albedo","default":"util/clouds_256"}
uniform sampler2D g_Texture2; // {"material":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"MASK"}
uniform float g_CloudsAlpha; // {"material":"ui_editor_properties_alpha","default":1.0,"range":[0.01, 1]}
uniform float g_CloudThreshold; // {"material":"ui_editor_properties_threshold","default":0.2,"range:":[0,1]}
uniform float g_CloudFeather; // {"material":"ui_editor_properties_feather","default":0.1,"range":[0,1]}
uniform float g_CloudShading; // {"material":"ui_editor_properties_shading","default":0.5,"range":[0,1]}
uniform float g_ShadingDirection; // {"material":"ui_editor_properties_shading_direction","default":0,"range":[0,6.28]}
uniform vec3 g_Color1; // {"material":"ui_editor_properties_color_start","default":"1 1 1","type":"color"}
uniform vec3 g_Color2; // {"material":"ui_editor_properties_color_end","default":"0 0 0","type":"color"}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
float cloud0 = texSample2D(g_Texture1, v_TexCoordClouds.xy).r;
float cloud1 = texSample2D(g_Texture1, v_TexCoordClouds.zw).r;
float cloudBlend = cloud0 * cloud1;
vec3 cloudColor = CAST3(1.0);
#if SHADING == 1
float light = 0.0;
vec2 cloudDeltas = vec2(ddx(cloudBlend), ddy(cloudBlend));
float shadingLength = length(cloudDeltas);
if (shadingLength > 0.001)
{
cloudDeltas /= shadingLength;
vec2 direction = rotateVec2(vec2(0, -1.0), g_ShadingDirection);
light = dot(direction, cloudDeltas) * 0.5 + 0.5;
}
light = mix(0.5, light, g_CloudShading);
cloudColor = mix(g_Color2, g_Color1, light);
#endif
cloudBlend = smoothstep(g_CloudThreshold, g_CloudThreshold + g_CloudFeather, cloudBlend);
float blend = cloudBlend * g_CloudsAlpha;
#if MASK == 1
blend *= texSample2D(g_Texture2, v_TexCoord.zw).r;
#endif
albedo.a = blend;
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, cloudColor, blend);
#if BLENDMODE == 0
albedo.a = 1.0;
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,33 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture0Resolution;
#if MASK == 1
uniform vec4 g_Texture2Resolution;
#endif
uniform float g_Time;
uniform vec2 g_CloudSpeeds; // {"material":"ui_editor_properties_speed","default":"0.01 -0.02"}
uniform vec2 g_CloudScales; // {"material":"ui_editor_properties_scale","default":"1.3 0.5"}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
varying vec4 v_TexCoordClouds;
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord = a_TexCoord.xyxy;
float aspect = g_Texture0Resolution.z / g_Texture0Resolution.w;
v_TexCoordClouds.xy = (a_TexCoord + g_Time * g_CloudSpeeds.x) * g_CloudScales.x;
v_TexCoordClouds.zw = (a_TexCoord + g_Time * g_CloudSpeeds.y) * g_CloudScales.y;
v_TexCoordClouds.zw = vec2(-v_TexCoordClouds.w, v_TexCoordClouds.z);
#if MASK == 1
v_TexCoord.zw = 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,21 @@
varying vec4 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Previous framebuffer","hidden":true}
uniform sampler2D g_Texture2; // {"material":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"MASK"}
uniform float g_Amount; // {"material":"Accumulation rate","default":0.8,"range":[0.01, 1]}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
vec4 pastAlbedo = texSample2D(g_Texture1, v_TexCoord.xy);
float rate = g_Amount;
#if MASK == 1
float mask = texSample2D(g_Texture2, v_TexCoord.zw).r;
rate = g_Amount + (1.0 - g_Amount) * (1.0 - mask);
#endif
gl_FragColor = mix(pastAlbedo, albedo, rate);
}

View File

@@ -0,0 +1,19 @@
#if MASK == 1
uniform vec4 g_Texture2Resolution;
#endif
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
void main() {
gl_Position = vec4(a_Position, 1.0);
v_TexCoord.xyzw = a_TexCoord.xyxy;
#if MASK == 1
v_TexCoord.zw = 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,9 @@
varying vec2 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord);
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 = a_TexCoord;
}

View File

@@ -0,0 +1,15 @@
// [COMBO] {"material":"ui_editor_properties_repeat","combo":"REPEAT","type":"options","default":1}
varying vec3 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
void main() {
vec2 texCoord = v_TexCoord.xy / v_TexCoord.z;
#if REPEAT
texCoord = frac(texCoord);
#endif
gl_FragColor = texSample2D(g_Texture0, texCoord);
}

View File

@@ -0,0 +1,84 @@
// [COMBO] {"material":"ui_editor_properties_mode","combo":"MODE","type":"options","default":0,"options":{"Vertex":1,"UV":0}}
#include "common.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture0Resolution;
uniform float g_Top; // {"material":"ui_editor_properties_top","default":0,"range":[-0.49,0.49]}
uniform float g_Bottom; // {"material":"ui_editor_properties_bottom","default":0,"range":[-0.49,0.49]}
uniform float g_Left; // {"material":"ui_editor_properties_left","default":0,"range":[-0.49,0.49]}
uniform float g_Right; // {"material":"ui_editor_properties_right","default":0,"range":[-0.49,0.49]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec3 v_TexCoord;
void main() {
vec3 position = a_Position;
v_TexCoord.xy = a_TexCoord;
v_TexCoord.z = 1.0;
#if MODE == 1
position.x += mix(g_Texture0Resolution.z * g_Top * mix(-1.0, 1.0, step(a_TexCoord.x, 0.5)),
g_Texture0Resolution.z * g_Bottom * mix(-1.0, 1.0, step(a_TexCoord.x, 0.5)),
step(0.5, a_TexCoord.y));
position.y += mix(g_Texture0Resolution.w * -g_Left * mix(-1.0, 1.0, step(a_TexCoord.y, 0.5)),
g_Texture0Resolution.w * -g_Right * mix(-1.0, 1.0, step(a_TexCoord.y, 0.5)),
step(0.5, a_TexCoord.x));
#endif
vec2 p3 = vec2(g_Top, g_Left);
vec2 p2 = vec2(1 - g_Top, g_Right);
vec2 p1 = vec2(1 - g_Bottom, 1 - g_Right);
vec2 p0 = vec2(g_Bottom, 1 - g_Left);
float ax = p2.x - p0.x;
float ay = p2.y - p0.y;
float bx = p3.x - p1.x;
float by = p3.y - p1.y;
float cross = ax * by - ay * bx;
float cy = p0.y - p1.y;
float cx = p0.x - p1.x;
float s = (ax * cy - ay * cx) / cross;
float t = (bx * cy - by * cx) / cross;
float q0 = 1 / (1 - t);
float q1 = 1 / (1 - s);
float q2 = 1 / t;
float q3 = 1 / s;
float q = mix(
mix(q3, q2, a_TexCoord.x),
mix(q0, q1, a_TexCoord.x),
a_TexCoord.y
);
v_TexCoord.xy = a_TexCoord;
#if MODE == 0
v_TexCoord -= 0.5;
v_TexCoord.x *= 0.5 / (0.5 - mix(g_Top, g_Bottom, step(0.5, a_TexCoord.y)));
v_TexCoord.y *= 0.5 / (0.5 - mix(g_Left, g_Right, step(0.5, a_TexCoord.x)));
v_TexCoord += 0.5;
#endif
v_TexCoord.xy *= q;
v_TexCoord.z = q;
gl_Position = mul(vec4(position, 1.0), g_ModelViewProjectionMatrix);
}

View File

@@ -0,0 +1,29 @@
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":2}
#include "common_blending.h"
varying vec4 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"MASK"}
uniform float g_BlendAlpha; // {"material":"ui_editor_properties_alpha","default":1,"range":[0,1]}
uniform vec3 g_TintColor; // {"material":"ui_editor_properties_color", "type": "color", "default":"1 1 1"}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
float mask = g_BlendAlpha;
#if MASK
mask = texSample2D(g_Texture1, v_TexCoord.zw);
#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,4 @@
{
"name": "FX Preview",
"type": "scene2d"
}

View File

@@ -0,0 +1,101 @@
// [COMBO] {"material":"ui_editor_properties_shading","combo":"SHADING","type":"options","default":7}
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":0}
// [COMBO] {"material":"ui_editor_properties_write_alpha","combo":"WRITEALPHA","type":"options","default":0}
#include "common.h"
#include "common_blending.h"
varying vec4 v_TexCoord;
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_albedo","default":"util/clouds_256"}
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","combo":"MASK","paintdefaultcolor":"0 0 0 1"}
uniform float g_CloudsAlpha; // {"material":"alpha","label":"ui_editor_properties_alpha","default":1.0,"range":[0.01, 1]}
uniform float g_CloudThreshold; // {"material":"threshold","label":"ui_editor_properties_threshold","default":0,"range:":[0,1]}
uniform float g_CloudFeather; // {"material":"feather","label":"ui_editor_properties_feather","default":0.5,"range":[0,1]}
uniform float g_CloudLOD; // {"material":"smoothness","label":"ui_editor_properties_smoothness","default":0.0,"range":[0, 5]}
uniform vec3 g_Color1; // {"material":"colorstart","label":"ui_editor_properties_color_start","default":"1 1 1","type":"color"}
uniform vec3 g_Color2; // {"material":"colorend","label":"ui_editor_properties_color_end","default":"1 1 1","type":"color"}
#if SHADING == 100
uniform float g_CloudShading; // {"material":"shadingamount","label":"ui_editor_properties_shading_amount","default":50,"range":[0,100]}
uniform float g_ShadingDirection; // {"material":"shadingdirection","label":"ui_editor_properties_shading_direction","default":3.141,"range":[0,6.28]}
#endif
#if PERSPECTIVE == 0
varying vec4 v_TexCoordClouds;
#else
uniform float g_Time;
uniform vec4 g_CloudSpeeds; // {"material":"speed","label":"ui_editor_properties_speed","default":"0.01 0.01 -0.02 -0.02"}
uniform vec4 g_CloudScales; // {"material":"scale","label":"ui_editor_properties_scale","default":"1.3 1.3 0.5 0.5"}
varying vec3 v_TexCoordPerspective;
#endif
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
vec4 cloudTexCoods;
#if PERSPECTIVE == 0
cloudTexCoods = v_TexCoordClouds;
#else
vec2 perspectiveCoords = v_TexCoordPerspective.xy / v_TexCoordPerspective.z;
cloudTexCoods.xyzw = perspectiveCoords.xyxy;
cloudTexCoods.xy = (cloudTexCoods.xy + g_Time * g_CloudSpeeds.xy) * g_CloudScales.xy;
cloudTexCoods.zw = (cloudTexCoods.zw + g_Time * g_CloudSpeeds.zw) * g_CloudScales.zw;
//cloudTexCoods.xz *= aspect;
cloudTexCoods.zw = vec2(-cloudTexCoods.w, cloudTexCoods.z);
#endif
//float cloud0 = texSample2D(g_Texture1, v_TexCoordClouds.xy).r;
//float cloud1 = texSample2D(g_Texture1, v_TexCoordClouds.zw).r;
float cloud0 = texSample2DLod(g_Texture1, cloudTexCoods.xy, g_CloudLOD).r;
float cloud1 = texSample2DLod(g_Texture1, cloudTexCoods.zw, g_CloudLOD).r;
float cloudBlend = cloud0 * cloud1;
vec3 cloudColor = CAST3(1.0);
#if SHADING == 1
//float light = 0.5;
//vec2 cloudDeltas = vec2(ddx(cloudBlend), ddy(cloudBlend));
//float shadingLength = length(cloudDeltas);
//if (shadingLength > 0.001)
//{
// cloudDeltas *= g_CloudShading;
// vec2 direction = rotateVec2(vec2(0, -1.0), g_ShadingDirection);
// light = saturate(dot(direction, cloudDeltas) * 0.5 + 0.5);
//}
//cloudColor = mix(g_Color2, g_Color1, light);
#endif
cloudBlend = smoothstep(g_CloudThreshold, g_CloudThreshold + g_CloudFeather, cloudBlend);
float blend = cloudBlend * g_CloudsAlpha;
#if PERSPECTIVE == 1
blend *= step(0.0, v_TexCoordPerspective.z);
#endif
#if SHADING == 0
cloudColor = mix(g_Color2, g_Color1, blend);
#else
cloudColor = mix(g_Color2, g_Color1, blend) * cloud0 * cloud1;
#endif
#if MASK
blend *= texSample2D(g_Texture2, v_TexCoord.zw).r;
#endif
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, cloudColor, blend);
#if WRITEALPHA
//albedo.a = 1.0;
albedo.a = blend;
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,52 @@
// [COMBO] {"material":"ui_editor_properties_perspective","combo":"PERSPECTIVE","type":"options","default":0}
#include "common_perspective.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture0Resolution;
#if MASK == 1
uniform vec4 g_Texture2Resolution;
#endif
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
#if PERSPECTIVE == 0
varying vec4 v_TexCoordClouds;
uniform float g_Time;
uniform vec2 g_CloudSpeeds; // {"material":"speed","label":"ui_editor_properties_speed","default":"0.01 -0.02"}
uniform vec4 g_CloudScales; // {"material":"scale","label":"ui_editor_properties_scale","default":"1.3 1.3 0.5 0.5"}
#else
uniform vec2 g_Point0; // {"material":"point0","label":"p0","default":"0 0"}
uniform vec2 g_Point1; // {"material":"point1","label":"p1","default":"1 0"}
uniform vec2 g_Point2; // {"material":"point2","label":"p2","default":"1 1"}
uniform vec2 g_Point3; // {"material":"point3","label":"p3","default":"0 1"}
varying vec3 v_TexCoordPerspective;
#endif
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord = a_TexCoord.xyxy;
#if PERSPECTIVE == 0
float aspect = g_Texture0Resolution.z / g_Texture0Resolution.w;
v_TexCoordClouds.xy = (a_TexCoord + g_Time * g_CloudSpeeds.x) * g_CloudScales.xy;
v_TexCoordClouds.zw = (a_TexCoord + g_Time * g_CloudSpeeds.y) * g_CloudScales.zw;
v_TexCoordClouds.xz *= aspect;
v_TexCoordClouds.zw = vec2(-v_TexCoordClouds.w, v_TexCoordClouds.z);
#else
mat3 xform = inverse(squareToQuad(g_Point0, g_Point1, g_Point2, g_Point3));
v_TexCoordPerspective = mul(vec3(a_TexCoord.xy, 1.0), xform);
#endif
#if MASK == 1
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
#endif
}