forked from taisei-project/taisei
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
725 additions
and
10 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
# Disable mipmaps to reduce artifacts at the seams. | ||
# Note that some artifacts will still be present, because the linear filter is unaware of how the slices are supposed to wrap. | ||
mipmaps = 1 | ||
filter_min = linear | ||
filter_mag = linear | ||
|
||
# Nearest-neighbour filter avoids artifacts entirely, but looks worse. | ||
#filter_min = nearest | ||
#filter_mag = nearest |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#version 330 core | ||
|
||
#include "lib/render_context.glslh" | ||
#include "interface/standard.glslh" | ||
#include "extra_bg.glslh" | ||
|
||
UNIFORM(1) sampler2D background_tex; | ||
UNIFORM(2) sampler2D background_binary_tex; | ||
UNIFORM(3) sampler2D code_tex; | ||
UNIFORM(4) vec4 code_tex_params; | ||
UNIFORM(5) float time; | ||
|
||
void main(void) { | ||
fragColor = sample_background( | ||
background_tex, | ||
background_binary_tex, | ||
code_tex, | ||
code_tex_params, | ||
texCoord, | ||
1, | ||
time | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
vec2 code_transform_uv(float num_segs, float inv_num_segs, vec2 uv) { | ||
uv *= inv_num_segs; | ||
float cur_segment = floor(mod(uv.y, num_segs)) * inv_num_segs; | ||
uv.x = mod(uv.x - cur_segment, 1.0); | ||
uv.y = mod(uv.y, 1.0); | ||
return uv; | ||
} | ||
|
||
vec4 sample_code(sampler2D sampler_code, vec4 code_tex_params, vec2 uv) { | ||
vec2 code_aspect = code_tex_params.xy; | ||
float num_segs = code_tex_params.z; | ||
float inv_num_segs = code_tex_params.w; | ||
|
||
uv *= code_aspect; | ||
uv = code_transform_uv(num_segs, inv_num_segs, uv * 2); | ||
return texture(sampler_code, uv); | ||
} | ||
|
||
vec2 estd(vec2 p, vec2 f) { | ||
p = mod(p, 1.0); | ||
p -= 0.5; | ||
p *= f; | ||
p = p * sqrt(1.0 - 0.5 * p.yx * p.yx); | ||
p /= f; | ||
p += 0.5; | ||
return p; | ||
} | ||
|
||
vec4 sample_background( | ||
sampler2D sampler_bg, | ||
sampler2D sampler_bg_binary, | ||
sampler2D sampler_code, | ||
vec4 code_tex_params, | ||
vec2 uv, | ||
float r, | ||
float t | ||
) { | ||
uv = estd(uv, vec2(1.5, 1.0) * r); | ||
|
||
vec2 bg_uv = uv * vec2(0.5, 0.8) * 0.5; | ||
vec2 bg_binary_uv = bg_uv; | ||
|
||
t *= 0.5; | ||
|
||
bg_uv.x += t * 0.02; | ||
bg_uv.y -= t * 0.145; | ||
bg_binary_uv.x += t * 0.013937; | ||
bg_binary_uv.y += t * 0.05; | ||
|
||
vec2 code_uv = uv; | ||
code_uv.x += t * 0.3; | ||
code_uv.y += t * 0.2; | ||
|
||
vec4 background = texture(sampler_bg, bg_uv); | ||
vec4 background_binary = texture(sampler_bg_binary, bg_binary_uv); | ||
vec4 code = sample_code(sampler_code, code_tex_params, code_uv) * r; | ||
|
||
background = background * background_binary + code; | ||
background.rgb = pow(background.rgb, mix(1 - vec3(1.0, 0.5, 0.3), vec3(1), r)); | ||
|
||
return background; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
objects = standardnotex.vert extra_bg.frag |
59 changes: 59 additions & 0 deletions
59
resources/00-taisei.pkgdir/shader/extra_tower_apply_mask.frag.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#version 330 core | ||
|
||
#include "lib/render_context.glslh" | ||
#include "lib/util.glslh" | ||
#include "interface/standard.glslh" | ||
#include "extra_bg.glslh" | ||
|
||
UNIFORM(1) sampler2D depth_tex; | ||
UNIFORM(2) sampler2D mask_tex; | ||
UNIFORM(3) sampler2D background_tex; | ||
UNIFORM(4) sampler2D background_binary_tex; | ||
UNIFORM(5) sampler2D code_tex; | ||
UNIFORM(6) vec4 code_tex_params; // (aspect_x, aspect_y, num_segs, 1/num_segs) | ||
UNIFORM(7) vec2 dissolve; // (dissolve, dissolve^2) | ||
UNIFORM(8) float time; | ||
|
||
vec4 sample_background(vec2 uv, float r, float t) { | ||
return sample_background( | ||
background_tex, | ||
background_binary_tex, | ||
code_tex, | ||
code_tex_params, | ||
uv, | ||
r, | ||
t | ||
); | ||
} | ||
|
||
void main(void) { | ||
vec4 tower = texture(tex, texCoord); | ||
float depthval = texture(depth_tex, texCoord).r; | ||
vec4 masks = texture(mask_tex, texCoord); | ||
|
||
float global_dissolve_phase = smoothstep(dissolve.y, dissolve.x, masks.a); | ||
masks.rg = mix(masks.rg, vec2(1, 0), global_dissolve_phase); | ||
|
||
if(masks.g == 1) { | ||
fragColor = tower; | ||
gl_FragDepth = depthval; | ||
return; | ||
} | ||
|
||
float maskval = masks.r; | ||
vec4 background = sample_background(texCoord, maskval, time); | ||
|
||
maskval = 0.5 + 0.5 * sin(pi * (maskval + 1.42 * smoothstep(0.5, 1.0, depthval) * masks.b)); | ||
maskval = smoothstep(0, 1, maskval + 0.5); | ||
maskval = smoothstep(0.75, 1.0, maskval); | ||
maskval = mix(maskval, 1, masks.g); | ||
maskval = mix(maskval, 0, global_dissolve_phase); | ||
|
||
vec4 result = background; | ||
result = alphaCompose(result, tower * maskval); | ||
depthval = mix(depthval, 0, global_dissolve_phase); | ||
depthval = mix(depthval, depthval * depthval, (1 - maskval) * 0.5); | ||
|
||
fragColor = result; | ||
gl_FragDepth = depthval; | ||
} |
2 changes: 2 additions & 0 deletions
2
resources/00-taisei.pkgdir/shader/extra_tower_apply_mask.prog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
objects = standard.vert extra_tower_apply_mask.frag |
22 changes: 22 additions & 0 deletions
22
resources/00-taisei.pkgdir/shader/extra_tower_mask.frag.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#version 330 core | ||
|
||
#include "interface/tower_light.glslh" | ||
#include "lib/util.glslh" | ||
|
||
UNIFORM(24) float time; | ||
UNIFORM(25) sampler2D tex2; | ||
UNIFORM(26) float dissolve; | ||
|
||
void main(void) { | ||
vec4 texel2 = texture(tex2, texCoord); | ||
vec4 texel = texture(tex, texCoord); | ||
|
||
float m = texel.r; | ||
m = 0.5 + 0.5 * sin(pi*m + time); | ||
m = 0.5 + 0.5 * sin(2*pi*m + time); | ||
|
||
float dissolve_phase = smoothstep(dissolve * dissolve, dissolve, texel.r); | ||
float d = mix(1.0 - texel2.r, 1.0, dissolve_phase); | ||
|
||
fragColor = vec4(m, d, texel2.g, texel.r); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
objects = extra_tower_mask.vert extra_tower_mask.frag |
11 changes: 11 additions & 0 deletions
11
resources/00-taisei.pkgdir/shader/extra_tower_mask.vert.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#version 330 core | ||
|
||
#include "lib/render_context.glslh" | ||
#include "interface/tower_light.glslh" | ||
|
||
void main(void) { | ||
gl_Position = r_projectionMatrix * r_modelViewMatrix * vec4(position, 1.0); | ||
texCoord = (r_textureMatrix * vec4(texCoordRawIn, 0.0, 1.0)).xy; | ||
normal = normalIn; | ||
l = lightvec - (r_modelViewMatrix*vec4(position,1.0)).xyz; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.