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" : 1,
"replacementkey" : "reflection",
"name" : "ui_editor_effect_reflection_title",
"description" : "ui_editor_effect_reflection_description",
"group" : "colorize",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/reflection.json"
}
],
"dependencies" :
[
"materials/effects/reflection.json",
"shaders/effects/reflection.frag",
"shaders/effects/reflection.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/reflection",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,18 @@
{
"name" : "Reflection",
"description" : "Adds a reflection effect to the image. Draw a mask to define where the reflection should appear.",
"group" : "image",
//"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/reflection.json"
}
],
"dependencies" :
[
"materials/effects/reflection.json",
"shaders/effects/reflection.frag",
"shaders/effects/reflection.vert"
]
}

View File

@@ -0,0 +1,20 @@
{
"name" : "Water Ripple",
"description" : "Adds a ripple animation. Draw a mask to limit the animation to a specific area of the image.",
"group" : "image",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/waterripple.json"
}
],
"dependencies" :
[
"materials/effects/waterripple.json",
"materials/effects/waterripplenormal.png",
"materials/effects/waterripplenormal.tex-json",
"shaders/effects/waterripple.frag",
"shaders/effects/waterripple.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/reflection",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,10 @@
{
"passes": [{
"shader": "effects/waterripple",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull",
"textures": [null, "effects/waterripplenormal"]
}]
}

View File

@@ -0,0 +1,4 @@
{
"format" : "rgba8888",
"nomip" : true
}

View File

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

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

View File

@@ -0,0 +1,94 @@
{
"camera" :
{
"center" : "0.000 0.000 0.000",
"eye" : "0.000 0.000 1.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",
"depth" : 1,
"id" : 38,
"image" : "models/effectpreview.json",
"name" : "",
"origin" : "128.675 193.939 0.000",
"scale" : "0.405 0.405 1.000"
},
{
"angles" : "0.000 0.000 0.000",
"depth" : 1,
"effects" :
[
{
"file" : "effects/reflection/effect.json",
"passes" :
[
{
"combos" : null,
"constantshadervalues" :
{
"Additive" : 0,
"Offset" : 0.070000000298023224
},
"textures" :
[
null,
"masks/reflection_mask_ee0d9bbc6d0516b8583c8fb3e841485c0b7ec4e8"
]
}
]
},
{
"file" : "effects/waterripple/effect.json",
"passes" :
[
{
"combos" : null,
"constantshadervalues" :
{
"Ripple strength" : 0.070000000298023224,
"Scroll speed" : 0.23000000417232513
},
"textures" :
[
null,
"effects/waterripplenormal",
"masks/waterripple_mask_ee0d9bbc6d0516b8583c8fb3e841485c0b7ec4e8"
]
}
]
}
],
"id" : 15,
"image" : "models/util/fullscreenlayer.json",
"name" : "Fullscreen",
"origin" : "0.000 0.000 0.000",
"scale" : "0.802 0.802 1.000"
}
]
}

View File

@@ -0,0 +1,16 @@
varying vec4 v_TexCoord;
varying vec2 v_ReflectedCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Mask","mode":"opacitymask","default":"util/black"}
uniform float g_Additive; // {"material":"Additive","default":1,"range":[0,1]}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
vec4 reflected = texSample2D(g_Texture0, v_ReflectedCoord);
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
gl_FragColor = mix(mix(albedo, reflected, mask), albedo + reflected * mask, g_Additive);
}

View File

@@ -0,0 +1,29 @@
#include "common.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
uniform float g_Direction; // {"material":"Direction","default":0,"range":[0,6.28]}
uniform float g_ReflectionOffset; // {"material":"Offset","default":0.0,"range":[-1,1]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
varying vec2 v_ReflectedCoord;
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);
vec2 center = vec2(0.5, 0.5);
vec2 delta = a_TexCoord - center;
delta.y += g_ReflectionOffset;
delta.y = -delta.y;
delta = rotateVec2(delta, g_Direction);
v_ReflectedCoord = center + delta;
}

View File

@@ -0,0 +1,26 @@
varying vec4 v_TexCoord;
varying vec2 v_Scroll;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Water normal"}
uniform sampler2D g_Texture2; // {"material":"Mask","mode":"opacitymask","default":"util/white"}
uniform float g_Strength; // {"material":"Ripple strength","default":0.1,"range":[0,1]}
varying vec4 v_TexCoordRipple;
void main() {
vec2 texCoord = v_TexCoord.xy;
float mask = texSample2D(g_Texture2, v_TexCoord.zw).r;
vec3 n1 = texSample2D(g_Texture1, v_TexCoordRipple.xy).xyz * 2 - 1;
vec3 n2 = texSample2D(g_Texture1, v_TexCoordRipple.zw).xyz * 2 - 1;
vec3 normal = normalize(vec3(n1.xy + n2.xy, n1.z));
texCoord.xy += normal.xy * g_Strength * g_Strength * mask;
gl_FragColor = texSample2D(g_Texture0, texCoord);
}

View File

@@ -0,0 +1,41 @@
#include "common.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform float g_Time;
uniform vec4 g_Texture0Resolution;
uniform vec4 g_Texture2Resolution;
uniform float g_AnimationSpeed; // {"material":"Animation speed","default":0.15,"range":[0,0.5]}
uniform float g_Scale; // {"material":"Ripple scale","default":1,"range":[0,10]}
uniform float g_ScrollSpeed; // {"material":"Scroll speed","default":0,"range":[0,0.5]}
uniform float g_Direction; // {"material":"Scroll direction","default":0,"range":[0,6.28]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
varying vec4 v_TexCoordRipple;
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord.xy = a_TexCoord;
float piFrac = 0.78539816339744830961566084581988 * 0.5;
float pi = 3.141;
vec2 coordsRotated = v_TexCoord.xy;
vec2 coordsRotated2 = v_TexCoord.xy * 1.333;
vec2 scroll = rotateVec2(vec2(0, -1), g_Direction) * g_ScrollSpeed * g_ScrollSpeed * g_Time;
v_TexCoordRipple.xy = coordsRotated + g_Time * g_AnimationSpeed * g_AnimationSpeed + scroll;
v_TexCoordRipple.zw = coordsRotated2 - g_Time * g_AnimationSpeed * g_AnimationSpeed + scroll;
v_TexCoordRipple *= g_Scale;
float rippleTextureAdjustment = (g_Texture0Resolution.x / g_Texture0Resolution.y);
v_TexCoordRipple.xz *= rippleTextureAdjustment;
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
}

View File

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

View File

@@ -0,0 +1,46 @@
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":9}
#include "common.h"
#include "common_blending.h"
varying vec4 v_TexCoord;
#if PERSPECTIVE == 0
varying vec2 v_ReflectedCoord;
#else
varying vec3 v_TexCoordPerspective;
#endif
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_ReflectionAlpha; // {"material":"alpha","label":"ui_editor_properties_alpha","default":1.0,"range":[0.0, 1]}
void main() {
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
#if MASK
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
#else
float mask = 1.0;
#endif
vec2 reflectedCoord;
#if PERSPECTIVE == 0
reflectedCoord = v_ReflectedCoord;
#else
reflectedCoord = v_TexCoordPerspective.xy / v_TexCoordPerspective.z;
reflectedCoord.y = 1.0 - reflectedCoord.y;
mask *= step(abs(reflectedCoord.x - 0.5), 0.5);
mask *= step(abs(reflectedCoord.y - 0.5), 0.5);
#endif
vec4 reflected = texSample2D(g_Texture0, reflectedCoord);
//gl_FragColor = mix(mix(albedo, reflected, mask), albedo + reflected * mask, g_Additive);
gl_FragColor.rgb = ApplyBlending(BLENDMODE, albedo.rgb, reflected.rgb, mask * g_ReflectionAlpha);
gl_FragColor.a = min(1.0, albedo.a + reflected.a * mask * g_ReflectionAlpha);
}

View File

@@ -0,0 +1,50 @@
// [COMBO] {"material":"ui_editor_properties_perspective","combo":"PERSPECTIVE","type":"options","default":0}
#include "common.h"
#include "common_perspective.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
#if PERSPECTIVE == 0
varying vec2 v_ReflectedCoord;
uniform float g_Direction; // {"material":"direction","label":"ui_editor_properties_direction","default":0,"range":[0,6.28],"direction":true}
uniform float g_ReflectionOffset; // {"material":"offset","label":"ui_editor_properties_offset","default":0.0,"range":[-1,1]}
#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 MASK
v_TexCoord.z *= g_Texture1Resolution.z / g_Texture1Resolution.x;
v_TexCoord.w *= g_Texture1Resolution.w / g_Texture1Resolution.y;
#endif
#if PERSPECTIVE == 0
vec2 center = vec2(0.5, 0.5);
vec2 delta = a_TexCoord - center;
delta.y += g_ReflectionOffset;
delta.y = -delta.y;
delta = rotateVec2(delta, g_Direction);
v_ReflectedCoord = center + delta;
#else
mat3 xform = inverse(squareToQuad(g_Point0, g_Point1, g_Point2, g_Point3));
v_TexCoordPerspective = mul(vec3(a_TexCoord.xy, 1.0), xform);
#endif
}