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,100 @@
// [COMBO] {"material":"ui_editor_properties_quality","combo":"SAMPLES","type":"options","default":1,"options":{"4":0,"8":1,"15":2,"30":3}}
varying vec4 v_TexCoord01;
varying vec4 v_TexCoord23;
varying vec4 v_TexCoord45;
uniform sampler2D g_Texture0; // {"hidden":true}
uniform float g_Length; // {"material":"raylength","label":"ui_editor_properties_ray_length","default":0.1,"range":[0.01, 1]}
uniform float g_Intensity; // {"material":"rayintensity","label":"ui_editor_properties_ray_intensity","default":1,"range":[0.01, 2.0]}
uniform vec3 g_ColorRays; // {"material":"color","label":"ui_editor_properties_color","default":"1 1 1","type":"color"}
vec4 GatherDirection(vec2 texCoords, vec2 direction)
{
vec4 albedo = CAST4(0.0);
#if SAMPLES == 0
const int sampleCount = 4;
#endif
#if SAMPLES == 1
const int sampleCount = 8;
#endif
#if SAMPLES == 2
const int sampleCount = 15;
#endif
#if SAMPLES == 3
const int sampleCount = 30;
#endif
#if SAMPLES == 4
const int sampleCount = 50;
#endif
float dist = length(direction);
direction /= dist;
dist *= g_Length;
texCoords += direction * dist;
const float sampleDrop = sampleCount - 1;
direction = direction * dist / sampleDrop;
for (int i = 0; i < sampleCount; ++i)
{
vec4 sample = texSample2D(g_Texture0, texCoords);
texCoords -= direction;
albedo += sample * (i / sampleDrop);
}
return albedo;
}
void main() {
vec2 texCoords = v_TexCoord01.xy;
vec4 albedo = CAST4(0.0);
#if EDGES == 2
albedo += GatherDirection(texCoords, v_TexCoord01.zw);
albedo += GatherDirection(texCoords, -v_TexCoord01.zw);
#endif
#if EDGES == 3
albedo += GatherDirection(texCoords, v_TexCoord01.zw);
albedo += GatherDirection(texCoords, v_TexCoord23.xy);
albedo += GatherDirection(texCoords, v_TexCoord23.zw);
#endif
#if EDGES == 4
albedo += GatherDirection(texCoords, v_TexCoord01.zw);
albedo += GatherDirection(texCoords, -v_TexCoord01.zw);
albedo += GatherDirection(texCoords, v_TexCoord23.xy);
albedo += GatherDirection(texCoords, -v_TexCoord23.xy);
#endif
#if EDGES == 5
albedo += GatherDirection(texCoords, v_TexCoord01.zw);
albedo += GatherDirection(texCoords, v_TexCoord23.xy);
albedo += GatherDirection(texCoords, v_TexCoord23.zw);
albedo += GatherDirection(texCoords, v_TexCoord45.xy);
albedo += GatherDirection(texCoords, v_TexCoord45.zw);
#endif
#if SAMPLES == 0
const float sampleIntensity = 0.1 * (30 / 4.0);
#endif
#if SAMPLES == 1
const float sampleIntensity = 0.1 * (30 / 8.0);
#endif
#if SAMPLES == 2
const float sampleIntensity = 0.1 * (30 / 15.0);
#endif
#if SAMPLES == 3
const float sampleIntensity = 0.1;
#endif
#if SAMPLES == 4
const float sampleIntensity = 0.1 * (30 / 50.0);
#endif
albedo.rgb *= g_ColorRays;
gl_FragColor = vec4(g_Intensity * sampleIntensity * albedo.rgb, saturate(g_Intensity * sampleIntensity * albedo.a));
}

View File

@@ -0,0 +1,60 @@
// [COMBO] {"material":"ui_editor_properties_edges","combo":"EDGES","type":"options","default":4,"options":{"2":2,"3":3,"4":4,"5":5}}
#include "common.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture0Resolution;
uniform float g_Time;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
uniform float g_Direction; // {"material":"direction","label":"ui_editor_properties_direction","default":0,"direction":true}
uniform float g_Speed; // {"material":"speed","label":"ui_editor_properties_speed","default":0,"range":[-1,1]}
varying vec4 v_TexCoord01;
varying vec4 v_TexCoord23;
varying vec4 v_TexCoord45;
void main() {
gl_Position = vec4(a_Position, 1.0);
v_TexCoord01.xy = a_TexCoord;
vec2 baseDirection = rotateVec2(vec2(0, 0.5), g_Time * g_Speed);
float ratio = g_Texture0Resolution.x / g_Texture0Resolution.y;
#if EDGES == 2
v_TexCoord01.zw = rotateVec2(baseDirection, g_Direction);
v_TexCoord23.xy = CAST2(0.0);
v_TexCoord23.zw = CAST2(0.0);
v_TexCoord45.xy = CAST2(0.0);
v_TexCoord45.zw = CAST2(0.0);
#endif
#if EDGES == 3
v_TexCoord01.zw = rotateVec2(baseDirection, g_Direction);
v_TexCoord23.xy = rotateVec2(baseDirection, g_Direction + M_PI_2 * 0.3333);
v_TexCoord23.zw = rotateVec2(baseDirection, g_Direction + M_PI_2 * 0.6666);
v_TexCoord45.xy = CAST2(0.0);
v_TexCoord45.zw = CAST2(0.0);
#endif
#if EDGES == 4
v_TexCoord01.zw = rotateVec2(baseDirection, g_Direction);
v_TexCoord23.xy = rotateVec2(vec2(-baseDirection.y, baseDirection.x), g_Direction);
v_TexCoord23.zw = CAST2(0.0);
v_TexCoord45.xy = CAST2(0.0);
v_TexCoord45.zw = CAST2(0.0);
#endif
#if EDGES == 5
v_TexCoord01.zw = rotateVec2(baseDirection, g_Direction);
v_TexCoord23.xy = rotateVec2(baseDirection, g_Direction + M_PI_2 * 0.2);
v_TexCoord23.zw = rotateVec2(baseDirection, g_Direction + M_PI_2 * 0.4);
v_TexCoord45.xy = rotateVec2(baseDirection, g_Direction + M_PI_2 * 0.6);
v_TexCoord45.zw = rotateVec2(baseDirection, g_Direction + M_PI_2 * 0.8);
#endif
v_TexCoord01.w *= ratio;
v_TexCoord23.yw *= ratio;
v_TexCoord45.yw *= ratio;
}

View File

@@ -0,0 +1,37 @@
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":9}
// [COMBO] {"material":"ui_editor_properties_copy_background","combo":"COPYBG","type":"options"}
#include "common_blending.h"
varying vec4 v_TexCoord;
#if COPYBG
varying vec3 v_ScreenCoord;
uniform sampler2D g_Texture2; // {"hidden":true,"default":"_rt_FullFrameBuffer"}
#endif
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture1; // {"hidden":true}
void main() {
vec4 rays = texSample2D(g_Texture0, v_TexCoord.zw);
vec4 albedo = texSample2D(g_Texture1, v_TexCoord.xy);
#if COPYBG
vec2 screenCoord = v_ScreenCoord.xy / v_ScreenCoord.z * vec2(0.5, 0.5) + 0.5;
vec4 bg = texSample2D(g_Texture2, screenCoord.xy);
albedo.rgb = mix(bg.rgb, albedo.rgb, albedo.a);
#endif
#if BLENDMODE == 0
albedo = rays;
#else
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, rays.rgb, rays.a);
albedo.a = saturate(albedo.a + rays.a);
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,35 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
#if COPYBG
uniform mat4 g_EffectModelViewProjectionMatrix;
varying vec3 v_ScreenCoord;
#endif
#ifdef HLSL_SM30
uniform vec4 g_Texture0Resolution;
#endif
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord = a_TexCoord.xyxy;
#ifdef HLSL_SM30
v_TexCoord.zw += 0.5 / g_Texture0Resolution.xy;
#endif
#if COPYBG
v_ScreenCoord = mul(vec4((a_Position), 1.0), g_EffectModelViewProjectionMatrix).xyw;
#if HLSL
v_ScreenCoord.y = -v_ScreenCoord.y;
#endif
#endif
}

View File

@@ -0,0 +1,39 @@
// [COMBO] {"material":"ui_editor_properties_noise","combo":"NOISE","type":"options","default":1}
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_Threshold; // {"material":"raythreshold","label":"ui_editor_properties_ray_threshold","default":0.5,"range":[0, 1]}
#if NOISE == 1
varying vec4 v_NoiseTexCoord;
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_albedo","default":"util/clouds_256"}
uniform float g_NoiseAmount; // {"material":"noiseamount","label":"ui_editor_properties_noise_amount","default":0.4,"range":[0.01, 1]}
#endif
void main() {
#if MASK
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
#else
float mask = 1.0;
#endif
vec4 sample = texSample2D(g_Texture0, v_TexCoord.xy);
#if NOISE
float noiseSample = texSample2D(g_Texture2, v_NoiseTexCoord.xy).r * texSample2D(g_Texture2, v_NoiseTexCoord.zw).r;
noiseSample = mix(sample.a, sample.a * noiseSample, g_NoiseAmount);
#endif
sample.rgb *= sample.a;
sample.a = 1.0;
gl_FragColor = sample * mask * step(g_Threshold, dot(vec3(0.11, 0.59, 0.3), sample.rgb));
#if NOISE
gl_FragColor.a *= noiseSample;
#endif
}

View File

@@ -0,0 +1,35 @@
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
uniform vec4 g_Texture0Resolution;
uniform vec4 g_Texture1Resolution;
#if NOISE == 1
varying vec4 v_NoiseTexCoord;
#endif
uniform float g_Time;
uniform float g_NoiseSpeed; // {"material":"noisespeed","label":"ui_editor_properties_noise_speed","default":0.15,"range":[0.01, 1]}
uniform float g_NoiseScale; // {"material":"noisescale","label":"ui_editor_properties_noise_scale","default":3,"range":[0.01, 10]}
void main() {
gl_Position = vec4(a_Position, 1.0);
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);
#ifdef HLSL_SM30
vec2 offsets = 0.5 / g_Texture0Resolution.xy;
v_TexCoord.xy += offsets;
#endif
#if NOISE == 1
v_NoiseTexCoord.xy = a_TexCoord + g_Time * g_NoiseSpeed;
v_NoiseTexCoord.wz = vec2(a_TexCoord.y, -a_TexCoord.x) * 0.633 + vec2(-g_Time, g_Time) * 0.5 * g_NoiseSpeed;
v_NoiseTexCoord *= g_NoiseScale;
#endif
}

View File

@@ -0,0 +1,18 @@
#include "common_blur.h"
varying vec4 v_TexCoord;
uniform sampler2D g_Texture0; // {"hidden":true}
void main() {
#if KERNEL == 0
gl_FragColor = blur13a(v_TexCoord.xy, v_TexCoord.zw);
#endif
#if KERNEL == 1
gl_FragColor = blur7a(v_TexCoord.xy, v_TexCoord.zw);
#endif
#if KERNEL == 2
gl_FragColor = blur3a(v_TexCoord.xy, v_TexCoord.zw);
#endif
}

View File

@@ -0,0 +1,25 @@
// [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_blur_scale","default":"1 1","linked":true,"range":[0.01, 2.0]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
uniform vec4 g_Texture0Resolution;
void main() {
gl_Position = vec4(a_Position, 1.0);
v_TexCoord.xy = a_TexCoord;
#if VERTICAL
v_TexCoord.z = 0;
v_TexCoord.w = g_Scale.y / g_Texture0Resolution.w;
#else
v_TexCoord.z = g_Scale.x / g_Texture0Resolution.z;
v_TexCoord.w = 0;
#endif
}