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,26 @@
{
"version" : 1,
"replacementkey" : "refract",
"name" : "ui_editor_effect_refract_title",
"description" : "ui_editor_effect_refract_description",
"group" : "distort",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/util/effectcomposebackground.json",
"compose" : true
},
{
"material" : "materials/effects/refract.json"
}
],
"dependencies" :
[
"materials/effects/refract.json",
"materials/effects/refractnormal.png",
"materials/effects/refractnormal.tex-json",
"shaders/effects/refract.frag",
"shaders/effects/refract.vert"
]
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

View File

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

View File

@@ -0,0 +1,26 @@
{
"version" : 1,
"replacementkey" : "refract",
"name" : "ui_editor_effect_refract_title",
"description" : "ui_editor_effect_refract_description",
"group" : "distort",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/util/effectcomposebackground.json",
"compose" : true
},
{
"material" : "materials/effects/refract.json"
}
],
"dependencies" :
[
"materials/effects/refract.json",
"materials/effects/refractnormal.png",
"materials/effects/refractnormal.tex-json",
"shaders/effects/refract.frag",
"shaders/effects/refract.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,10 @@
{
"passes": [{
"shader": "effects/refract",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull",
"textures": [null, null, "effects/refractnormal"]
}]
}

View File

@@ -0,0 +1,4 @@
{
"autosize" : true,
"material" : "materials/effectpreview.json"
}

View File

@@ -0,0 +1,19 @@
{
"file" : "scene.json",
"general" :
{
"properties" :
{
"schemecolor" :
{
"order" : 0,
"text" : "ui_browse_properties_scheme_color",
"type" : "color",
"value" : "0 0 0"
}
}
},
"title" : "preview",
"type" : "scene",
"version" : 0
}

View File

@@ -0,0 +1,86 @@
{
"camera" :
{
"center" : "0.00000 0.00000 -1.00000",
"eye" : "0.00000 0.00000 0.00000",
"up" : "0.00000 1.00000 0.00000"
},
"general" :
{
"ambientcolor" : "0.30000 0.30000 0.30000",
"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.70000 0.70000 0.70000",
"clearenabled" : true,
"farz" : 10000.0,
"fov" : 50.0,
"nearz" : 0.0099999997764825821,
"orthogonalprojection" :
{
"height" : 256,
"width" : 256
},
"skylightcolor" : "0.30000 0.30000 0.30000",
"zoom" : 1.0
},
"objects" :
[
{
"alignment" : "center",
"alpha" : 1.0,
"angles" : "0.00000 0.00000 0.00000",
"color" : "1.00000 1.00000 1.00000",
"colorBlendMode" : 0,
"copybackground" : true,
"depth" : 1,
"effects" :
[
{
"file" : "effects/refract/effect.json",
"id" : 17,
"name" : "",
"passes" :
[
{
"id" : 18,
"textures" : [ null, "_rt_FullFrameBuffer" ]
},
{
"constantshadervalues" :
{
"ripplestrength" : 0.23999999999999999,
"scale" : "0.48 0.48"
},
"id" : 20,
"textures" : [ null, "util/white", "effects/refractnormal" ]
}
],
"visible" : true
}
],
"id" : 38,
"image" : "models/effectpreview.json",
"ledsource" : false,
"locktransforms" : false,
"name" : "",
"origin" : "128.00000 128.00000 0.00000",
"parallaxDepth" : "1.00000 1.00000",
"perspective" : false,
"scale" : "1.00000 1.00000 1.00000",
"size" : "256.00000 256.00000",
"solid" : true,
"visible" : true
}
]
}

View File

@@ -0,0 +1,31 @@
#include "common_fragment.h"
varying vec4 v_TexCoord;
varying vec3 v_RefractTexCoord;
uniform sampler2D g_Texture0; // {"material":"framebuffer","label":"ui_editor_properties_framebuffer","hidden":true}
uniform sampler2D g_Texture1; // {"material":"mask","label":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"MASK","paintdefaultcolor":"0 0 0 1"}
uniform sampler2D g_Texture2; // {"material":"normalmap","label":"ui_editor_properties_normal","default":"","format":"normalmap"}
void main() {
#if MASK == 1
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
#else
float mask = 1;
#endif
vec2 texCoord = v_TexCoord.xy;
vec3 normal = DecompressNormal(texSample2D(g_Texture2, v_RefractTexCoord.xy));
texCoord.xy += normal.xy * v_RefractTexCoord.z * mask;
vec4 albedo = texSample2D(g_Texture0, texCoord.xy);
//vec2 screenCoord = v_ScreenCoord.xy / v_ScreenCoord.z * CAST2(0.5) + 0.5;
//vec4 bg = texSample2D(g_Texture3, screenCoord.xy);
//albedo.rgb = mix(bg.rgb, albedo.rgb, albedo.a);
//albedo.a = 1;
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,21 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
uniform vec2 g_Scale; // {"material":"scale","label":"ui_editor_properties_ripple_scale","linked":true,"default":"1 1","range":[0,10]}
uniform float g_Strength; // {"material":"ripplestrength","label":"ui_editor_properties_strength","default":0.1,"range":[-1,1]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
varying vec3 v_RefractTexCoord;
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord.xy = a_TexCoord;
v_RefractTexCoord.xy = a_TexCoord * g_Scale;
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture1Resolution.z / g_Texture1Resolution.x,
v_TexCoord.y * g_Texture1Resolution.w / g_Texture1Resolution.y);
v_RefractTexCoord.z = sign(g_Strength) * g_Strength * g_Strength;
}

View File

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

View File

@@ -0,0 +1,31 @@
#include "common_fragment.h"
varying vec4 v_TexCoord;
varying vec3 v_RefractTexCoord;
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_normal","default":"","format":"normalmap","formatcombo":true}
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","combo":"MASK","paintdefaultcolor":"0 0 0 1"}
void main() {
#if MASK
float mask = texSample2D(g_Texture2, v_TexCoord.zw).r;
#else
float mask = 1;
#endif
vec2 texCoord = v_TexCoord.xy;
vec3 normal = DecompressNormal(texSample2D(g_Texture1, v_RefractTexCoord.xy));
texCoord.xy += normal.xy * v_RefractTexCoord.z * mask;
vec4 albedo = texSample2D(g_Texture0, texCoord.xy);
//vec2 screenCoord = v_ScreenCoord.xy / v_ScreenCoord.z * CAST2(0.5) + 0.5;
//vec4 bg = texSample2D(g_Texture3, screenCoord.xy);
//albedo.rgb = mix(bg.rgb, albedo.rgb, albedo.a);
//albedo.a = 1;
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,21 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture2Resolution;
uniform vec2 g_Scale; // {"material":"scale","label":"ui_editor_properties_scale","linked":true,"default":"1 1","range":[0,10]}
uniform float g_Strength; // {"material":"strength","label":"ui_editor_properties_strength","default":0.1,"range":[-1,1]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
varying vec3 v_RefractTexCoord;
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord.xy = a_TexCoord;
v_RefractTexCoord.xy = a_TexCoord * g_Scale;
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
v_RefractTexCoord.z = sign(g_Strength) * g_Strength * g_Strength;
}