mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 13:31:49 +00:00
Improved fog quality
This commit is contained in:
parent
01c6c854e1
commit
e796bd0e69
2 changed files with 10 additions and 5 deletions
|
|
@ -2,13 +2,16 @@
|
|||
|
||||
in vec4 a_color;
|
||||
in vec2 a_texCoord;
|
||||
in float a_distance;
|
||||
out vec4 f_color;
|
||||
|
||||
uniform sampler2D u_texture0;
|
||||
uniform vec3 u_fogColor;
|
||||
|
||||
void main(){
|
||||
vec4 tex_color = texture(u_texture0, a_texCoord);
|
||||
if (tex_color.a < 0.5)
|
||||
discard;
|
||||
f_color = a_color * tex_color;
|
||||
float depth = (a_distance/256.0)*(a_distance/256.0)*256.0;
|
||||
f_color = mix(a_color * tex_color, vec4(u_fogColor,1.0), min(1.0, depth/256.0));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue