Update shader for android

This commit is contained in:
2025-02-15 22:34:24 +01:00
parent e020784f4f
commit 1994e7ccb1
8 changed files with 143 additions and 153 deletions

View File

@@ -1,17 +1,17 @@
#version 100
#version 300 es
precision mediump float;
varying vec2 fragTexCoord;
varying vec4 fragColor;
in vec2 fragTexCoord;
in vec4 fragColor;
out vec4 finalColor;
uniform vec3 color;
uniform float sun_radius;
uniform float start_transperency;
vec2 offset = vec2(1.0, 1.0);
float sun_end = 1.0;
float start_transparency = 0.40f;
float sun_radius = 0.6f;
float sun_end = 1.0f;
void main()
{
@@ -20,17 +20,13 @@ void main()
float radius = length(offset);
if(radius < sun_radius){
gl_FragColor = vec4(color, 1.0);
finalColor = vec4(color, 1.0);
}else if(radius < sun_end){
float gradient = radius;
gradient -= sun_radius;
gradient = gradient / (sun_end - sun_radius) * start_transperency;
gl_FragColor = vec4(color, start_transperency - gradient);
gradient = gradient / 0.4f * start_transparency;
finalColor = vec4(color, start_transparency - gradient);
}else{
gl_FragColor = vec4(color, 0.0);
finalColor = vec4(color, 0.0);
}
}
}

View File

@@ -5,9 +5,10 @@ in vec4 fragColor;
out vec4 finalColor;
uniform vec3 color;
uniform float sun_radius;
uniform float start_transperency;
vec2 offset = vec2(1.0f, 1.0f);
vec2 offset = vec2(1.0, 1.0);
float start_transparency = 0.40f;
float sun_radius = 0.6f;
float sun_end = 1.0f;
void main()
@@ -20,8 +21,8 @@ void main()
}else if(radius < sun_end){
float gradient = radius;
gradient -= sun_radius;
gradient = gradient / (sun_end - sun_radius) * start_transperency;
finalColor = vec4(color, start_transperency - gradient);
gradient = gradient / 0.4f * start_transparency;
finalColor = vec4(color, start_transparency - gradient);
}else{
finalColor = vec4(color, 0.0f);
}