mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-17 16:17:02 +08:00
* fix(renderer): defer uniform location retrieval and add view matrix in outline rendering * refactor(gameplay): encapsulate per-type vertex data into VertexData struct * feat(rendering): separate transparent blocks into discard and blend modes * feat(renderer): implement order-independent transparency * fix(shaders): reduce alpha discard threshold to 0.8
20 lines
413 B
GLSL
20 lines
413 B
GLSL
#version 460
|
|
|
|
uniform sampler2D u_accumTex;
|
|
uniform sampler2D u_revealTex;
|
|
in vec2 TexCoord;
|
|
out vec4 FragColor;
|
|
|
|
void main() {
|
|
vec4 a = texture(u_accumTex, TexCoord);
|
|
float r = texture(u_revealTex, TexCoord).r;
|
|
|
|
if (a.a < 1e-4) discard;
|
|
|
|
vec3 color = a.rgb / max(a.a, 1e-5);
|
|
float transmittance = r;
|
|
float opacity = 1.0 - transmittance;
|
|
|
|
FragColor = vec4(color * opacity, opacity);
|
|
}
|