mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
Refactor, shader fix
This commit is contained in:
parent
6965bbe809
commit
fbce36a05c
5 changed files with 26 additions and 17 deletions
|
|
@ -7,11 +7,14 @@ out vec4 f_color;
|
|||
|
||||
uniform sampler2D u_texture0;
|
||||
uniform vec3 u_fogColor;
|
||||
uniform float u_fogFactor;
|
||||
|
||||
void main(){
|
||||
vec4 tex_color = texture(u_texture0, a_texCoord);
|
||||
//if (tex_color.a < 0.5)
|
||||
// discard;
|
||||
float depth = (a_distance/256.0)*(a_distance/256.0)*256.0/6;
|
||||
f_color = mix(a_color * tex_color, vec4(u_fogColor,1.0), min(1.0, depth/256.0/1.0f));
|
||||
float alpha = a_color.a * tex_color.a;
|
||||
f_color = mix(a_color * tex_color, vec4(u_fogColor,1.0), min(1.0, depth*u_fogFactor));
|
||||
f_color.a = alpha;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue