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,21 @@
{
"version" : 1,
"replacementkey" : "iris",
"name" : "ui_editor_effect_depth_parallax_title",
"description" : "ui_editor_effect_depth_parallax_description",
"group" : "interactive",
"performance" : "expensive",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/depthparallax.json"
}
],
"dependencies" :
[
"materials/effects/depthparallax.json",
"shaders/effects/depthparallax.frag",
"shaders/effects/depthparallax.vert"
]
}

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/depthparallax",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,20 @@
{
"version" : 1,
"replacementkey" : "iris",
"name" : "ui_editor_effect_depth_parallax_title",
"description" : "ui_editor_effect_depth_parallax_description",
"group" : "distort",
"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/depthparallax.json"
}
],
"dependencies" :
[
"materials/effects/depthparallax.json",
"shaders/effects/depthparallax.frag",
"shaders/effects/depthparallax.vert"
]
}

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/depthparallax",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,20 @@
{
"passes" :
[
{
"blending" : "translucent",
"combos" :
{
"VERSION" : 2
},
"cullmode" : "nocull",
"depthtest" : "disabled",
"depthwrite" : "disabled",
"shader" : "genericimage2",
"textures" :
[
"mountain_peak_summit_altitude_top_extreme_mountaineering_trekking-892149"
]
}
]
}

View File

@@ -0,0 +1,7 @@
{
"bleedtransparentcolors" : true,
"clampuvs" : true,
"format" : "rgba8888",
"halfmip" : true,
"nonpoweroftwo" : true
}

View File

@@ -0,0 +1,8 @@
{
"bleedtransparentcolors" : true,
"clampuvs" : true,
"format" : "r8",
"halfmip" : true,
"nomip" : true,
"nonpoweroftwo" : true
}

View File

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

View File

@@ -0,0 +1,4 @@
{
"autosize" : true,
"material" : "materials/mountain_peak_summit_altitude_top_extreme_mountaineering_trekking-892149.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,98 @@
{
"camera" :
{
"center" : "0.00000 0.00000 0.00000",
"eye" : "0.00000 0.00000 1.00000",
"up" : "0.00000 1.00000 0.00000"
},
"general" :
{
"ambientcolor" : "0.30000 0.30000 0.30000",
"bloom" : false,
"bloomhdrfeather" : 0.10000000149011612,
"bloomhdriterations" : 8,
"bloomhdrscatter" : 1.6189999580383301,
"bloomhdrstrength" : 2.0,
"bloomhdrthreshold" : 1.0,
"bloomstrength" : 2.0,
"bloomthreshold" : 0.64999997615814209,
"camerafade" : true,
"cameraparallax" : true,
"cameraparallaxamount" : 0.5,
"cameraparallaxdelay" : 0.10000000149011612,
"cameraparallaxmouseinfluence" : 1.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,
"hdr" : false,
"nearz" : 0.0099999997764825821,
"orthogonalprojection" :
{
"height" : 600,
"width" : 600
},
"skylightcolor" : "0.30000 0.30000 0.30000",
"zoom" : 1.0
},
"objects" :
[
{
"alignment" : "center",
"alpha" : 1.0,
"angles" : "0.00000 0.00000 0.00000",
"brightness" : 1.0,
"color" : "1.00000 1.00000 1.00000",
"colorBlendMode" : 0,
"copybackground" : true,
"effects" :
[
{
"file" : "effects/depthparallax/effect.json",
"id" : 32,
"name" : "",
"passes" :
[
{
"combos" :
{
"QUALITY" : 2
},
"constantshadervalues" :
{
"center" : 0.23999999999999999,
"scale" : "0.47 0.47",
"sens" : 5
},
"id" : 33,
"textures" :
[
null,
"mountain_peak_summit_altitude_top_extreme_mountaineering_trekking-892149_depth"
]
}
],
"visible" : true
}
],
"id" : 28,
"image" : "models/mountain_peak_summit_altitude_top_extreme_mountaineering_trekking-892149.json",
"ledsource" : false,
"locktransforms" : false,
"name" : "mountain_peak_summit_altitude_top_extreme_mountaineering_trekking-892149",
"origin" : "110.44984 300.00000 0.00000",
"parallaxDepth" : "0.00000 0.00000",
"perspective" : false,
"scale" : "0.91987 0.91987 0.91987",
"size" : "1200.00000 674.00000",
"solid" : true,
"visible" : true
}
],
"version" : 0
}

View File

@@ -0,0 +1,87 @@
// [COMBO] {"material":"ui_editor_properties_quality","combo":"QUALITY","type":"options","default":1,"options":{"ui_editor_properties_basic":0,"ui_editor_properties_occlusion_performance":1,"ui_editor_properties_occlusion_quality":2}}
varying vec4 v_TexCoord;
#if MASK
varying vec2 v_TexCoordMask;
#endif
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_depth_map","mode":"depth","format":"r8","default":"util/black","paintdefaultcolor":"0 0 0 1"}
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","combo":"MASK","paintdefaultcolor":"0 0 0 1"}
uniform vec2 g_Scale; // {"material":"scale","label":"ui_editor_properties_depth","default":"0.5 0.5","linked":true,"range":[0.01, 1.0]}
uniform float g_Sensitivity; // {"material":"sens","label":"ui_editor_properties_perspective","default":2,"range":[0.01, 5.0]}
uniform float g_Center; // {"material":"center","label":"ui_editor_properties_center","default":0.2,"range":[0.0, 1.0]}
uniform vec2 g_ParallaxPosition;
#if QUALITY != 0
vec2 ParallaxMapping(vec2 texCoords, vec2 viewDir)
{
#if QUALITY == 1
int numLayers = 24;
#endif
#if QUALITY == 2
int numLayers = 64;
#endif
float layerDepth = 1.0 / numLayers;
float currentLayerDepth = 1.0;
vec2 P = viewDir.xy * g_Scale * 0.1;
vec2 deltaTexCoords = P / numLayers;
vec2 currentTexCoords = texCoords;
float currentDepthMapValue = texSample2D(g_Texture1, currentTexCoords).r;
for (int i=0; currentLayerDepth > currentDepthMapValue && i<numLayers; i++)
{
currentTexCoords -= deltaTexCoords;
currentDepthMapValue = texSample2D(g_Texture1, currentTexCoords).r;
currentLayerDepth -= layerDepth;
}
vec2 prevTexCoords = currentTexCoords + deltaTexCoords;
float afterDepth = currentDepthMapValue - currentLayerDepth;
float beforeDepth = texSample2D(g_Texture1, prevTexCoords).r - currentLayerDepth - layerDepth;
float weight = afterDepth / (afterDepth - beforeDepth);
vec2 finalTexCoords = prevTexCoords * weight + currentTexCoords * (1.0 - weight);
return finalTexCoords;
}
#endif
void main() {
float depth = texSample2D(g_Texture1, v_TexCoord.zw).r;
float mask = 1.0;
#if MASK
mask *= texSample2D(g_Texture2, v_TexCoordMask.xy).r;
#endif
#if QUALITY == 0
vec2 pointer = vec2(v_TexCoord.z, 1.0 - v_TexCoord.w);
pointer = (pointer - g_ParallaxPosition) * vec2(2.0, -2.0) * g_Scale * -0.04;
vec2 offset = (depth * 2.0 - 1.0) * pointer * mask;
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy + offset);
#else
vec2 coords = v_TexCoord.xy - (g_ParallaxPosition * 2 - 1) * g_Center * vec2(-0.2, 0.2) * g_Scale;
vec2 pointer = vec2(1.0 - v_TexCoord.z, v_TexCoord.w);
vec2 fakeViewdir = (pointer - g_ParallaxPosition) * vec2(-g_Sensitivity, g_Sensitivity);
vec2 newCoords = ParallaxMapping(coords, fakeViewdir * mask);
//vec2 newCoords = parallax_uv(v_TexCoord.xy, vec3(fakeViewdir, 1));
vec4 albedo = texSample2D(g_Texture0, newCoords);
#endif
gl_FragColor = albedo;
//gl_FragColor.rgb = vec3(pointer, 0);
}

View File

@@ -0,0 +1,30 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
#if MASK
uniform vec4 g_Texture2Resolution;
#endif
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
#if MASK
varying vec2 v_TexCoordMask;
#endif
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord.xy = a_TexCoord.xy;
v_TexCoord.zw = vec2(a_TexCoord.x * g_Texture1Resolution.z / g_Texture1Resolution.x,
a_TexCoord.y * g_Texture1Resolution.w / g_Texture1Resolution.y);
#if MASK
v_TexCoordMask.xy = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
#endif
}

View File

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

View File

@@ -0,0 +1,99 @@
// [COMBO] {"material":"ui_editor_properties_quality","combo":"QUALITY","type":"options","default":1,"options":{"ui_editor_properties_basic":0,"ui_editor_properties_occlusion_performance":1,"ui_editor_properties_occlusion_quality":2}}
uniform sampler2D g_Texture0; // {"hidden":true}
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_depth_map","mode":"depth","format":"r8","default":"util/black","paintdefaultcolor":"0 0 0 1"}
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","combo":"MASK","paintdefaultcolor":"0 0 0 1"}
uniform vec2 g_Scale; // {"material":"scale","label":"ui_editor_properties_depth","default":"1 1","linked":true,"range":[0.01, 2.0]}
uniform float g_Sensitivity; // {"material":"sens","label":"ui_editor_properties_perspective","default":1,"range":[-5.0, 5.0]}
uniform float g_Center; // {"material":"center","label":"ui_editor_properties_center","default":0.3,"range":[0.0, 1.0]}
//uniform mat4 g_EffectModelViewProjectionMatrixInverse;
//uniform mat4 g_EffectTextureProjectionMatrixInverse;
//uniform mat4 g_EffectTextureProjectionMatrix;
varying vec4 v_TexCoord;
varying vec2 v_ParallaxOffset;
#if MASK
varying vec2 v_TexCoordMask;
#endif
#if QUALITY != 0
vec2 ParallaxMapping(vec2 texCoords, vec2 viewDir)
{
#if QUALITY == 1
float numLayers = 24;
#endif
#if QUALITY == 2
float numLayers = 64;
#endif
float layerDepth = 1.0 / numLayers;
float currentLayerDepth = 1.0;
vec2 P = viewDir.xy * g_Scale * 0.1;
vec2 deltaTexCoords = P / numLayers;
vec2 currentTexCoords = texCoords;
float currentDepthMapValue = texSample2D(g_Texture1, currentTexCoords).r;
for (float i=0.0; currentLayerDepth > currentDepthMapValue && i<numLayers; i++)
{
currentTexCoords -= deltaTexCoords;
currentDepthMapValue = texSample2D(g_Texture1, currentTexCoords).r;
currentLayerDepth -= layerDepth;
}
vec2 prevTexCoords = currentTexCoords + deltaTexCoords;
float afterDepth = currentDepthMapValue - currentLayerDepth;
float beforeDepth = texSample2D(g_Texture1, prevTexCoords).r - currentLayerDepth - layerDepth;
float weight = afterDepth / (afterDepth - beforeDepth);
vec2 finalTexCoords = prevTexCoords * weight + currentTexCoords * (1.0 - weight);
return finalTexCoords;
}
#endif
void main() {
float depth = texSample2D(g_Texture1, v_TexCoord.zw).r;
float mask = 1.0;
#if MASK
mask *= texSample2D(g_Texture2, v_TexCoordMask.xy).r;
#endif
#if QUALITY == 0
vec2 pointer = vec2(v_TexCoord.z, 1.0 - v_TexCoord.w);
pointer = (pointer - v_ParallaxOffset) * vec2(2.0, -2.0) * g_Scale * -0.04;
vec2 offset = (depth * 2.0 - 1.0) * pointer * mask;
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy + offset);
#else
float ctrlSign = step(0.0, g_Sensitivity);
float negPerspective = -g_Sensitivity;
float ctrlPerspOrtho = saturate(g_Sensitivity) + step(0.0001, negPerspective);
vec2 prlx = mix(v_ParallaxOffset, CAST2(1.0) - v_ParallaxOffset, ctrlSign);
vec2 coords = mix(v_TexCoord.xy, (v_TexCoord.xy - CAST2(0.5)) / (1.0 + g_Sensitivity * 0.2) + CAST2(0.5), ctrlSign);
coords = coords - (prlx * 2 - 1) * g_Center * vec2(-0.05, 0.05) * g_Scale * mix(-1.0, negPerspective, ctrlPerspOrtho);
vec2 pointer = vec2(1.0 - v_TexCoord.z, v_TexCoord.w);
vec2 ctrlDir = (pointer - prlx);
ctrlDir = mix(vec2(1.0 - prlx.x, prlx.y) - CAST2(0.5),
ctrlDir * vec2(-negPerspective, negPerspective),
ctrlPerspOrtho);
vec2 fakeViewdir = ctrlDir;
vec2 newCoords = ParallaxMapping(coords, fakeViewdir * mask);
vec4 albedo = texSample2D(g_Texture0, newCoords);
//albedo.rgb = vec3(v_ParallaxOffset, 0);
#endif
gl_FragColor = albedo;
}

View File

@@ -0,0 +1,49 @@
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture1Resolution;
uniform vec2 g_ParallaxPosition;
uniform vec3 g_Screen;
uniform mat4 g_EffectTextureProjectionMatrix;
uniform mat4 g_EffectTextureProjectionMatrixInverse;
#if MASK
uniform vec4 g_Texture2Resolution;
#endif
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec4 v_TexCoord;
varying vec2 v_ParallaxOffset;
#if MASK
varying vec2 v_TexCoordMask;
#endif
void main() {
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
v_TexCoord.xy = a_TexCoord.xy;
v_TexCoord.zw = vec2(a_TexCoord.x * g_Texture1Resolution.z / g_Texture1Resolution.x,
a_TexCoord.y * g_Texture1Resolution.w / g_Texture1Resolution.y);
#if MASK
v_TexCoordMask.xy = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
#endif
mat3 rot = CAST3X3(g_EffectTextureProjectionMatrixInverse);
vec2 projectedDirX = mul(vec3(1.0, 0.0, 0.0), rot).xy;
vec2 projectedDirY = mul(vec3(0.0, 1.0, 0.0), rot).xy;
projectedDirX = normalize(projectedDirX);
projectedDirY = normalize(projectedDirY);
vec2 prlxInput = g_ParallaxPosition * 2 - 1;
v_ParallaxOffset = projectedDirX * prlxInput.x + projectedDirY * prlxInput.y;
v_ParallaxOffset = v_ParallaxOffset * 0.5 + 0.5;
//v_ParallaxOffset = g_ParallaxPosition;
}