-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
3886ffb
commit 177e7a5
Showing
28 changed files
with
550 additions
and
373 deletions.
There are no files selected for viewing
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
105 changes: 105 additions & 0 deletions
105
...ight/Shader Selector (EXP) (Flashlight)/assets/minecraft/shaders/program/transparency.fsh
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,105 @@ | ||
#version 150 | ||
|
||
uniform sampler2D DiffuseSampler; | ||
uniform sampler2D DiffuseDepthSampler; | ||
uniform sampler2D TranslucentSampler; | ||
uniform sampler2D TranslucentDepthSampler; | ||
uniform sampler2D ItemEntitySampler; | ||
uniform sampler2D ItemEntityDepthSampler; | ||
uniform sampler2D ParticlesSampler; | ||
uniform sampler2D ParticlesDepthSampler; | ||
uniform sampler2D WeatherSampler; | ||
uniform sampler2D WeatherDepthSampler; | ||
uniform sampler2D CloudsSampler; | ||
uniform sampler2D CloudsDepthSampler; | ||
|
||
in vec2 texCoord; | ||
|
||
|
||
#define NUM_LAYERS 6 | ||
|
||
vec4 color_layers[NUM_LAYERS]; | ||
float depth_layers[NUM_LAYERS]; | ||
int active_layers = 0; | ||
|
||
out vec4 fragColor; | ||
|
||
void try_insert( vec4 color, float depth ) { | ||
if ( color.a == 0.0 ) { | ||
return; | ||
} | ||
|
||
color_layers[active_layers] = color; | ||
depth_layers[active_layers] = depth; | ||
|
||
int jj = active_layers++; | ||
int ii = jj - 1; | ||
while ( jj > 0 && depth_layers[jj] > depth_layers[ii] ) { | ||
float depthTemp = depth_layers[ii]; | ||
depth_layers[ii] = depth_layers[jj]; | ||
depth_layers[jj] = depthTemp; | ||
|
||
vec4 colorTemp = color_layers[ii]; | ||
color_layers[ii] = color_layers[jj]; | ||
color_layers[jj] = colorTemp; | ||
|
||
jj = ii--; | ||
} | ||
} | ||
|
||
flat in vec2 oneTexel; | ||
|
||
void try_insert_particle( vec4 color, float depth ) { | ||
vec4 col = color; | ||
bool isMarker = col.rg * 255. == vec2(254., 253.); | ||
if (isMarker) { | ||
col = texture( | ||
DiffuseSampler, | ||
texCoord + vec2(0.0, oneTexel.y) | ||
); | ||
} | ||
|
||
if ( col.a == 0.0 ) { | ||
return; | ||
} | ||
|
||
color_layers[active_layers] = col; | ||
depth_layers[active_layers] = depth; | ||
|
||
int jj = active_layers++; | ||
int ii = jj - 1; | ||
while ( jj > 0 && depth_layers[jj] > depth_layers[ii] ) { | ||
float depthTemp = depth_layers[ii]; | ||
depth_layers[ii] = depth_layers[jj]; | ||
depth_layers[jj] = depthTemp; | ||
|
||
vec4 colorTemp = color_layers[ii]; | ||
color_layers[ii] = color_layers[jj]; | ||
color_layers[jj] = colorTemp; | ||
|
||
jj = ii--; | ||
} | ||
} | ||
|
||
vec3 blend( vec3 dst, vec4 src ) { | ||
return ( dst * ( 1.0 - src.a ) ) + src.rgb; | ||
} | ||
|
||
void main() { | ||
color_layers[0] = vec4( texture( DiffuseSampler, texCoord ).rgb, 1.0 ); | ||
depth_layers[0] = texture( DiffuseDepthSampler, texCoord ).r; | ||
active_layers = 1; | ||
|
||
try_insert( texture( TranslucentSampler, texCoord ), texture( TranslucentDepthSampler, texCoord ).r ); | ||
try_insert( texture( ItemEntitySampler, texCoord ), texture( ItemEntityDepthSampler, texCoord ).r ); | ||
try_insert_particle( texture( ParticlesSampler, texCoord ), texture( ParticlesDepthSampler, texCoord ).r ); | ||
try_insert( texture( WeatherSampler, texCoord ), texture( WeatherDepthSampler, texCoord ).r ); | ||
try_insert( texture( CloudsSampler, texCoord ), texture( CloudsDepthSampler, texCoord ).r ); | ||
|
||
vec3 texelAccum = color_layers[0].rgb; | ||
for ( int ii = 1; ii < active_layers; ++ii ) { | ||
texelAccum = blend( texelAccum, color_layers[ii] ); | ||
} | ||
|
||
fragColor = vec4( texelAccum.rgb, 1.0 ); | ||
} |
28 changes: 28 additions & 0 deletions
28
...ght/Shader Selector (EXP) (Flashlight)/assets/minecraft/shaders/program/transparency.json
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,28 @@ | ||
{ | ||
"blend": { | ||
"func": "add", | ||
"srcrgb": "one", | ||
"dstrgb": "zero" | ||
}, | ||
"vertex": "screenquad", | ||
"fragment": "transparency", | ||
"attributes": [ "Position" ], | ||
"samplers": [ | ||
{ "name": "DiffuseSampler" }, | ||
{ "name": "DiffuseDepthSampler" }, | ||
{ "name": "TranslucentSampler" }, | ||
{ "name": "TranslucentDepthSampler" }, | ||
{ "name": "ItemEntitySampler" }, | ||
{ "name": "ItemEntityDepthSampler" }, | ||
{ "name": "ParticlesSampler" }, | ||
{ "name": "ParticlesDepthSampler" }, | ||
{ "name": "CloudsSampler" }, | ||
{ "name": "CloudsDepthSampler" }, | ||
{ "name": "WeatherSampler" }, | ||
{ "name": "WeatherDepthSampler" } | ||
], | ||
"uniforms": [ | ||
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, | ||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] } | ||
] | ||
} |
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
126 changes: 0 additions & 126 deletions
126
...s/Phosphor/Shader.Selector.Phosphor/assets/minecraft/shaders/post/transparency_debug.json
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
...les/Phosphor/Shader.Selector.Phosphor/assets/minecraft/shaders/program/toggler/remove.fsh
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
...es/Phosphor/Shader.Selector.Phosphor/assets/minecraft/shaders/program/toggler/remove.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.