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,22 @@
{
"version" : 1,
"replacementkey" : "waterflow",
"name" : "ui_editor_effect_water_flow_title",
"description" : "ui_editor_effect_water_flow_description",
"group" : "animate",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/waterflow.json"
}
],
"dependencies" :
[
"materials/effects/waterflow.json",
"materials/effects/waterflowphase.png",
"materials/effects/waterflowphase.tex-json",
"shaders/effects/waterflow.frag",
"shaders/effects/waterflow.vert"
]
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

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

View File

@@ -0,0 +1,20 @@
{
"name" : "Water Flow",
"description" : "Adds a flow animation. The direction can be controlled with a flow mask that you can paint in the editor.",
"group" : "image",
//"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/waterflow.json"
}
],
"dependencies" :
[
"materials/effects/waterflow.json",
"materials/effects/waterflowphase.png",
"materials/effects/waterflowphase.tex-json",
"shaders/effects/waterflow.frag",
"shaders/effects/waterflow.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/waterflow",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"textures" : [null, null, "effects/waterflowphase"]
}]
}

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

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/waterflow/effect.json",
"passes" :
[
{
"constantshadervalues" :
{
"Speed" : 1,
"Strength" : 1
},
"textures" :
[
null,
"masks/waterflow_mask_ee0d9bbc6d0516b8583c8fb3e841485c0b7ec4e8",
"effects/waterflowphase"
]
}
]
}
],
"id" : 38,
"image" : "models/effectpreview.json",
"name" : "",
"origin" : "128.000 128.000 0.000",
"scale" : "1.000 1.000 1.000"
}
]
}

View File

@@ -0,0 +1,32 @@
varying vec4 v_TexCoord;
varying vec2 v_Scroll;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"Flow map","mode":"flowmask","default":"util/noflow"}
uniform sampler2D g_Texture2; // {"material":"Flow phase"}
uniform float g_Time;
uniform float g_FlowSpeed; // {"material":"Speed","default":1,"range":[0.01, 1]}
uniform float g_FlowAmp; // {"material":"Strength","default":1,"range":[0.01, 1]}
void main() {
float flowPhase = (texSample2D(g_Texture2, v_TexCoord.xy).r - 0.5) * 2.0;
vec2 flowColors = texSample2D(g_Texture1, v_TexCoord.zw).rg;
vec2 flowMask = (flowColors.rg - vec2(0.5, 0.5)) * 2.0;
vec2 cycles = vec2( frac(g_Time * g_FlowSpeed),
frac(g_Time * g_FlowSpeed + 0.5));
float blend = 2 * abs(cycles.x - 0.5);
blend = smoothstep(max(0, flowPhase), min(1, 1 + flowPhase), blend);
vec2 flowUVOffset1 = flowMask * g_FlowAmp * 0.1 * (cycles.x - 0.5);
vec2 flowUVOffset2 = flowMask * g_FlowAmp * 0.1 * (cycles.y - 0.5);
vec4 albedo = mix(texSample2D(g_Texture0, v_TexCoord.xy + flowUVOffset1),
texSample2D(g_Texture0, v_TexCoord.xy + flowUVOffset2),
blend);
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,4 @@
{
"name": "FX Preview",
"type": "scene2d"
}

View File

@@ -0,0 +1,46 @@
// [OFF_COMBO] {"material":"ui_editor_properties_position","combo":"POSITION","type":"options","default":0,"options":{"Center":0,"Post":1,"Pre":2}}
varying vec4 v_TexCoord;
varying vec2 v_Scroll;
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_flow_map","mode":"flowmask","default":"util/noflow"}
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_time_offset"}
uniform float g_Time;
uniform float g_FlowSpeed; // {"material":"speed","label":"ui_editor_properties_speed","default":1,"range":[0.01, 2]}
uniform float g_FlowAmp; // {"material":"strength","label":"ui_editor_properties_strength","default":1,"range":[0.01, 1]}
uniform float g_FlowPhaseScale; // {"material":"phasescale","label":"ui_editor_properties_phase_scale","default":2,"range":[0.01, 10]}
void main() {
float flowPhase = texSample2D(g_Texture2, v_TexCoord.xy * g_FlowPhaseScale).r;
vec2 flowColors = texSample2D(g_Texture1, v_TexCoord.zw).rg;
vec2 flowMask = (flowColors.rg - vec2(0.498, 0.498)) * 2.0;
float flowAmount = length(flowMask);
vec4 cycles = vec4(frac(g_Time * g_FlowSpeed),
frac(g_Time * g_FlowSpeed + 0.5),
frac(0.25 + g_Time * g_FlowSpeed),
frac(0.25 + g_Time * g_FlowSpeed + 0.5));
float blend = 2 * abs(cycles.x - 0.5);
float blend2 = 2 * abs(cycles.z - 0.5);
cycles = cycles - CAST4(0.5);
vec4 flowUVOffset = CAST4(flowMask.xyxy * g_FlowAmp * 0.1) * cycles.xxyy;
vec4 flowUVOffset2 = CAST4(flowMask.xyxy * g_FlowAmp * 0.1) * cycles.zzww;
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
vec4 flowAlbedo = mix(texSample2D(g_Texture0, v_TexCoord.xy + flowUVOffset.xy),
texSample2D(g_Texture0, v_TexCoord.xy + flowUVOffset.zw),
blend);
vec4 flowAlbedo2 = mix(texSample2D(g_Texture0, v_TexCoord.xy + flowUVOffset2.xy),
texSample2D(g_Texture0, v_TexCoord.xy + flowUVOffset2.zw),
blend2);
flowAlbedo = mix(flowAlbedo, flowAlbedo2, smoothstep(0.2, 0.8, flowPhase));
gl_FragColor = mix(albedo, flowAlbedo, flowAmount);
}

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