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" : "waterwaves",
"name" : "ui_editor_effect_water_waves_title",
"description" : "ui_editor_effect_water_waves_description",
"group" : "animate",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/waterwaves.json"
}
],
"dependencies" :
[
"materials/effects/waterwaves.json",
"shaders/effects/waterwaves.frag",
"shaders/effects/waterwaves.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/waterwaves",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,18 @@
{
"name" : "Water Waves",
"description" : "Adds a simple wave effect using sines.",
"group" : "image",
//"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/waterwaves.json"
}
],
"dependencies" :
[
"materials/effects/waterwaves.json",
"shaders/effects/waterwaves.frag",
"shaders/effects/waterwaves.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,8 @@
{
"passes": [{
"shader": "effects/waterwaves",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled"
}]
}

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,4 @@
{
"file" : "scene.json",
"title" : "preview"
}

View File

@@ -0,0 +1,65 @@
{
"camera" :
{
"center" : "0.000 0.000 -1.000",
"eye" : "0.000 0.000 0.000",
"up" : "0.000 1.000 0.000"
},
"general" :
{
"ambientcolor" : "0.3 0.3 0.3",
"bloom" : false,
"bloomstrength" : 2,
"bloomthreshold" : 0.64999997615814209,
"cameraparallax" : false,
"cameraparallaxamount" : 0.5,
"cameraparallaxdelay" : 0.10000000149011612,
"cameraparallaxmouseinfluence" : 0,
"camerapreview" : true,
"camerashake" : false,
"camerashakeamplitude" : 0.5,
"camerashakeroughness" : 1,
"camerashakespeed" : 3,
"clearcolor" : "0.7 0.7 0.7",
"orthogonalprojection" :
{
"height" : 256,
"width" : 256
},
"skylightcolor" : "0.3 0.3 0.3"
},
"objects" :
[
{
"angles" : "0.000 0.000 0.000",
"depth" : 1,
"effects" :
[
{
"file" : "effects/waterwaves/effect.json",
"passes" :
[
{
"constantshadervalues" :
{
"Scale" : 106.68000030517578,
"Speed" : 7.3400001525878906,
"Strength" : 0.2199999988079071
},
"textures" :
[
null,
"masks/waterwaves_mask_ee0d9bbc6d0516b8583c8fb3e841485c0b7ec4e8"
]
}
]
}
],
"id" : 37,
"image" : "models/effectpreview.json",
"name" : "",
"origin" : "128.000 128.000 0.000",
"scale" : "1.000 1.000 1.000"
}
]
}

View File

@@ -0,0 +1,22 @@
varying vec4 v_TexCoord;
varying vec2 v_Direction;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Mask","mode":"opacitymask","default":"util/white"}
uniform float g_Time;
uniform float g_Speed; // {"material":"Speed","default":5,"range":[0.01,50]}
uniform float g_Scale; // {"material":"Scale","default":200,"range":[0.01,1000]}
uniform float g_Strength; // {"material":"Strength","default":0.1,"range":[0.01,1]}
void main() {
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
vec2 texCoord = v_TexCoord.xy;
float distance = g_Time * g_Speed + dot(texCoord, v_Direction) * g_Scale;
vec2 offset = vec2(v_Direction.y, -v_Direction.x);
texCoord += sin(distance) * offset * g_Strength * g_Strength * mask;
gl_FragColor = texSample2D(g_Texture0, texCoord);
}

View File

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

View File

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

View File

@@ -0,0 +1,85 @@
#include "common.h"
varying vec4 v_TexCoord;
varying vec2 v_Direction;
#if PERSPECTIVE == 1
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 sampler2D g_Texture2; // {"combo":"TIMEOFFSET","default":"util/black","label":"ui_editor_properties_time_offset","mode":"opacitymask"}
uniform float g_Time;
uniform float g_Speed; // {"material":"speed","label":"ui_editor_properties_speed","default":5,"range":[0.01,50],"group":"ui_editor_properties_wave"}
uniform float g_Scale; // {"material":"scale","label":"ui_editor_properties_scale","default":200,"range":[0.01,1000],"group":"ui_editor_properties_wave"}
uniform float g_Exponent; // {"material":"exponent","label":"ui_editor_properties_exponent","default":1,"range":[0.51,4],"group":"ui_editor_properties_wave"}
uniform float g_Strength; // {"material":"strength","label":"ui_editor_properties_strength","default":0.1,"range":[0.01,1]}
#if DUALWAVES == 1
varying vec2 v_Direction2;
uniform float g_Speed2; // {"material":"speed2","label":"ui_editor_properties_speed","default":3,"range":[0.01,50],"group":"ui_editor_properties_wave_2"}
uniform float g_Scale2; // {"material":"scale2","label":"ui_editor_properties_scale","default":66,"range":[0.01,1000],"group":"ui_editor_properties_wave_2"}
uniform float g_Offset2; // {"material":"offset2","label":"ui_editor_properties_offset","default":0,"range":[-5,5],"group":"ui_editor_properties_wave_2"}
uniform float g_Exponent2; // {"material":"exponent2","label":"ui_editor_properties_exponent","default":1,"range":[0.51,4],"group":"ui_editor_properties_wave_2"}
#endif
void main() {
#if MASK
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
#else
float mask = 1.0;
#endif
vec2 texCoord = v_TexCoord.xy;
vec2 texCoordMotion = texCoord;
#if PERSPECTIVE == 1
texCoordMotion = v_TexCoordPerspective.xy / v_TexCoordPerspective.z;
#endif
float pos = abs(dot((texCoordMotion - 0.5), v_Direction));
float distance = g_Time * g_Speed + dot(texCoordMotion, v_Direction) * g_Scale;
#if DUALWAVES == 1
float distance2 = (g_Time + g_Offset2) * g_Speed2 + dot(texCoordMotion, v_Direction2) * g_Scale2;
#endif
#if PERSPECTIVE == 1
distance *= step(0.0, v_TexCoordPerspective.z);
#if DUALWAVES == 1
distance2 *= step(0.0, v_TexCoordPerspective.z);
#endif
#endif
#if TIMEOFFSET
float timeOffset = texSample2D(g_Texture2, v_TexCoord.zw).r * M_PI_2;
distance += timeOffset;
#if DUALWAVES == 1
distance2 += timeOffset;
#endif
#endif
float strength = g_Strength * g_Strength;
vec2 offset = vec2(v_Direction.y, -v_Direction.x);
float val1 = sin(distance);
float s1 = sign(val1);
val1 = pow(abs(val1), g_Exponent);
#if DUALWAVES == 1
vec2 offset2 = vec2(v_Direction2.y, -v_Direction2.x);
float val2 = sin(distance2);
float s2 = sign(val2);
val2 = pow(abs(val2), g_Exponent2);
texCoord += val1 * s1 * val2 * s2 * offset * strength * mask;
#else
texCoord += val1 * s1 * offset * strength * mask;
#endif
gl_FragColor = texSample2D(g_Texture0, texCoord);
}

View File

@@ -0,0 +1,58 @@
// [COMBO] {"material":"ui_editor_properties_perspective","combo":"PERSPECTIVE","type":"options","default":0}
// [COMBO] {"material":"ui_editor_properties_dual_waves","combo":"DUALWAVES","type":"options","default":0}
#include "common.h"
#include "common_perspective.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform float g_Time;
uniform vec4 g_Texture1Resolution;
uniform vec4 g_Texture2Resolution;
uniform float g_Direction; // {"material":"direction","label":"ui_editor_properties_direction","default":0,"direction":true,"group":"ui_editor_properties_wave"}
#if DUALWAVES == 1
uniform float g_Direction2; // {"material":"direction2","label":"direction2","default":0,"direction":true,"group":"ui_editor_properties_wave_2"}
varying vec2 v_Direction2;
#endif
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
varying vec2 v_Direction;
#if PERSPECTIVE == 1
uniform vec2 g_Point0; // {"default":"0 0","label":"p0","material":"point0"}
uniform vec2 g_Point1; // {"default":"1 0","label":"p1","material":"point1"}
uniform vec2 g_Point2; // {"default":"1 1","label":"p2","material":"point2"}
uniform vec2 g_Point3; // {"default":"0 1","label":"p3","material":"point3"}
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;
#else
#if TIMEOFFSET
v_TexCoord.z *= g_Texture2Resolution.z / g_Texture2Resolution.x;
v_TexCoord.w *= g_Texture2Resolution.w / g_Texture2Resolution.y;
#endif
#endif
v_Direction = rotateVec2(vec2(0, 1), g_Direction);
#if DUALWAVES == 1
v_Direction2 = rotateVec2(vec2(0, 1), g_Direction2);
#endif
#if PERSPECTIVE == 1
mat3 xform = inverse(squareToQuad(g_Point0, g_Point1, g_Point2, g_Point3));
v_TexCoordPerspective.xyz = mul(vec3(a_TexCoord.xy, 1.0), xform);
#endif
}