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,19 @@
{
"version" : 1,
"name" : "ui_editor_effect_vhs_title",
"description" : "ui_editor_effect_vhs_description",
"group" : "colorize",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/vhs.json"
}
],
"dependencies" :
[
"materials/effects/vhs.json",
"shaders/effects/vhs.frag",
"shaders/effects/vhs.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,9 @@
{
"passes": [{
"shader": "effects/vhs",
"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" : "previewvhs",
"type" : "scene"
}

View File

@@ -0,0 +1,83 @@
{
"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.300 0.300 0.300",
"bloom" : false,
"bloomstrength" : 2.0,
"bloomthreshold" : 0.64999997615814209,
"camerafade" : true,
"cameraparallax" : false,
"cameraparallaxamount" : 0.5,
"cameraparallaxdelay" : 0.10000000149011612,
"cameraparallaxmouseinfluence" : 0.0,
"camerapreview" : true,
"camerashake" : false,
"camerashakeamplitude" : 0.5,
"camerashakeroughness" : 1.0,
"camerashakespeed" : 3.0,
"clearcolor" : "0.700 0.700 0.700",
"clearenabled" : true,
"farz" : 10000.0,
"fov" : 50.0,
"nearz" : 0.0099999997764825821,
"orthogonalprojection" :
{
"height" : 256,
"width" : 256
},
"skylightcolor" : "0.300 0.300 0.300"
},
"objects" :
[
{
"angles" : "0.000 0.000 0.000",
"colorBlendMode" : 0,
"copybackground" : true,
"depth" : 1,
"effects" :
[
{
"file" : "effects/vhs/effect.json",
"id" : 22,
"name" : "",
"passes" :
[
{
"constantshadervalues" :
{
"artifacts" : 5,
"chromatic" : 0.42999999999999999,
"distortionspeed" : 1.4299999999999999,
"distortionstrength" : 1.3500000000000001,
"distortionwidth" : 1.21,
"scale" : 0.11,
"strength" : 1.29
},
"id" : 23,
"textures" : [ null, "util/noise" ]
}
],
"visible" : true
}
],
"id" : 38,
"image" : "models/effectpreview.json",
"ledsource" : false,
"locktransforms" : false,
"name" : "",
"origin" : "128.000 128.000 0.000",
"parallaxDepth" : "1.000 1.000",
"perspective" : false,
"scale" : "1.000 1.000 1.000",
"size" : "256.000 256.000",
"solid" : true,
"visible" : true
}
]
}

View File

@@ -0,0 +1,72 @@
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":12}
// [COMBO] {"material":"ui_editor_properties_greyscale","combo":"GREYSCALE","type":"options","default":0}
// [COMBO] {"material":"ui_editor_properties_artifacts_negated","combo":"INVERTARTIFACTS","type":"options","default":1}
#include "common.h"
#include "common_blending.h"
varying vec4 v_TexCoord;
varying vec4 v_TexCoordGlitch;
varying vec4 v_TexCoordNoise;
varying vec4 v_TexCoordVHSNoise;
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"ui_editor_properties_noise","default":"util/noise"}
uniform sampler2D g_Texture2; // {"material":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"MASK"}
uniform float g_Time;
uniform float g_NoiseAlpha; // {"material":"strength","label":"ui_editor_properties_alpha","default":1.0,"range":[0.0, 2.0]}
uniform float g_DistortionStrength; // {"material":"distortionstrength","label":"ui_editor_properties_distortion_strength","default":1.0,"range":[0.0, 2.0]}
uniform float g_DistortionSpeed; // {"material":"distortionspeed","label":"ui_editor_properties_distortion_speed","default":1,"range":[0.0, 2.0]}
uniform float g_DistortionWidth; // {"material":"distortionwidth","label":"ui_editor_properties_distortion_width","default":1.0,"range":[0.0, 2.0]}
uniform float g_ArtifactsScale; // {"material":"artifacts","label":"ui_editor_properties_artifacts","default":1.5,"range":[0.0, 3.0]}
void main() {
float dblend = sin(g_Time);
dblend = sign(dblend) * pow(abs(max(0.00001, dblend)), 4.0);
vec2 distortion = vec2(dblend *
g_DistortionStrength * 0.02 *
smoothstep(0.01 * g_DistortionWidth, 0.0, abs(frac(g_Time * g_DistortionSpeed) - v_TexCoord.y)),
0.0);
distortion *= g_NoiseAlpha;
vec4 orig = texSample2D(g_Texture0, v_TexCoord.xy + distortion);
vec4 albedo;
albedo.ga = orig.ga;
albedo.r = texSample2D(g_Texture0, v_TexCoordGlitch.xy + distortion).r;
albedo.b = texSample2D(g_Texture0, v_TexCoordGlitch.zw + distortion).b;
vec3 noise = texSample2D(g_Texture1, v_TexCoordNoise.xy).rgb;
vec3 noise2 = texSample2D(g_Texture1, v_TexCoordNoise.zw).gbr;
#if GREYSCALE == 1
noise = CAST3(greyscale(noise));
noise2 = CAST3(greyscale(noise2));
#endif
noise = saturate(noise * noise2);
float blend = 0.1;
#if MASK == 1
blend *= texSample2D(g_Texture2, v_TexCoord.zw).r;
#endif
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, noise, blend);
albedo.rgb = BlendOpacity(albedo.rgb, smoothstep(0.7, 1.0, noise), BlendLinearDodge, blend);
vec2 vhsNoise = texSample2D(g_Texture1, v_TexCoordVHSNoise.xy).rg;
vec2 vhsNoise2 = texSample2D(g_Texture1, v_TexCoordVHSNoise.zw).rg;
float artifactLimiter = pow(g_ArtifactsScale, 0.2);
float artifactsAlpha = step(0.9, vhsNoise.x * artifactLimiter) * step(0.9, vhsNoise2.x * artifactLimiter) * vhsNoise.y * vhsNoise2.y;
#if INVERTARTIFACTS
albedo.rgb = mix(albedo.rgb, CAST3(1.0 - albedo.rgb), artifactsAlpha);
#else
albedo.rgb += CAST3(artifactsAlpha);
#endif
gl_FragColor = mix(orig, albedo, g_NoiseAlpha);
}

View File

@@ -0,0 +1,55 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture0Resolution;
#if MASK == 1
uniform vec4 g_Texture2Resolution;
#endif
uniform float g_Time;
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
varying vec4 v_TexCoordGlitch;
varying vec4 v_TexCoordNoise;
varying vec4 v_TexCoordVHSNoise;
uniform float g_NoiseScale; // {"material":"scale","label":"ui_editor_properties_scale","default":0.3,"range":[0.01, 1.0]}
uniform float g_Chromatic; // {"material":"chromatic","label":"ui_editor_properties_chromatic_aberration","default":0.1,"range":[0.0, 1.0]}
uniform float g_ArtifactsScale; // {"material":"artifacts","label":"ui_editor_properties_artifacts","default":1.5,"range":[0.0, 3.0]}
uniform float g_NoiseAlpha; // {"material":"strength","label":"ui_editor_properties_alpha","default":1.0,"range":[0.0, 2.0]}
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
float aspect = g_Texture0Resolution.z / g_Texture0Resolution.w;
float t = frac(g_Time);
v_TexCoord = a_TexCoord.xyxy;
v_TexCoordNoise.xy = (a_TexCoord.xy + t) * g_NoiseScale;
v_TexCoordNoise.zw = (a_TexCoord.xy - t * 2.5) * g_NoiseScale * 0.52;
v_TexCoordNoise *= vec4(aspect, 1.0, aspect, 1.0);
#if MASK == 1
v_TexCoord.zw = vec2(a_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
a_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
#endif
v_TexCoordVHSNoise.xy = v_TexCoordNoise.xy * vec2(0.1, 10) * g_ArtifactsScale;
v_TexCoordVHSNoise.zw = v_TexCoordNoise.zw * vec2(0.01, 2) * g_ArtifactsScale;
v_TexCoordGlitch = v_TexCoord.xyxy;
vec3 glitchOffset = g_Chromatic * smoothstep(0, 2, 1 + 0.5 * sin(g_Time * vec3(11, 7, 13) * 2)) * vec3(0.007, 0.008, 0.0075);
v_TexCoordGlitch.y += 0.004 * g_Chromatic + glitchOffset.x;
v_TexCoordGlitch.xz += glitchOffset.xy + vec2(0.005, -0.0005) * g_Chromatic;
v_TexCoordGlitch.z -= glitchOffset.z + 0.006 * g_Chromatic;
v_TexCoordGlitch.w -= 0.0045 * g_Chromatic;
v_TexCoord.x += glitchOffset.z * min(1.0, g_NoiseAlpha);
v_TexCoord.y -= glitchOffset.z * min(1.0, g_NoiseAlpha);
}

View File

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