Skip to content
Snippets Groups Projects
Commit 3231e93d authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Fix impostors rendering with green pixels, grey pixels, weird colors, etc

parent 98ce1dd9
No related branches found
No related tags found
No related merge requests found
...@@ -183,13 +183,17 @@ void main() ...@@ -183,13 +183,17 @@ void main()
vec4 diffuse_srgb = diffuse_tap; vec4 diffuse_srgb = diffuse_tap;
#ifdef FOR_IMPOSTOR float final_alpha = diffuse_srgb.a;
vec4 color;
color.rgb = diffuse_srgb.rgb;
color.a = 1.0;
float final_alpha = diffuse_srgb.a * vertex_color.a; #ifdef USE_VERTEX_COLOR
final_alpha *= vertex_color.a;
diffuse_srgb.rgb *= vertex_color.rgb; diffuse_srgb.rgb *= vertex_color.rgb;
#endif
vec3 diffuse_linear = srgb_to_linear(diffuse_srgb.rgb);
#ifdef FOR_IMPOSTOR
vec4 color = vec4(diffuse_linear,final_alpha);
// Insure we don't pollute depth with invis pixels in impostor rendering // Insure we don't pollute depth with invis pixels in impostor rendering
// //
...@@ -200,15 +204,6 @@ void main() ...@@ -200,15 +204,6 @@ void main()
#else #else
vec3 light_dir = (sun_up_factor == 1) ? sun_dir: moon_dir; vec3 light_dir = (sun_up_factor == 1) ? sun_dir: moon_dir;
float final_alpha = diffuse_srgb.a;
#ifdef USE_VERTEX_COLOR
final_alpha *= vertex_color.a;
diffuse_srgb.rgb *= vertex_color.rgb;
#endif
vec3 diffuse_linear = srgb_to_linear(diffuse_srgb.rgb);
vec3 sunlit; vec3 sunlit;
vec3 amblit; vec3 amblit;
vec3 additive; vec3 additive;
......
...@@ -41,6 +41,7 @@ uniform sampler2D specularMap; ...@@ -41,6 +41,7 @@ uniform sampler2D specularMap;
VARYING vec2 vary_texcoord0; VARYING vec2 vary_texcoord0;
vec3 linear_to_srgb(vec3 c); vec3 linear_to_srgb(vec3 c);
vec2 encode_normal (vec3 n);
void main() void main()
{ {
...@@ -54,8 +55,7 @@ void main() ...@@ -54,8 +55,7 @@ void main()
vec4 norm = texture2D(normalMap, vary_texcoord0.xy); vec4 norm = texture2D(normalMap, vary_texcoord0.xy);
vec4 spec = texture2D(specularMap, vary_texcoord0.xy); vec4 spec = texture2D(specularMap, vary_texcoord0.xy);
col.rgb = linear_to_srgb(col.rgb);
frag_data[0] = vec4(col.rgb, 0.0); frag_data[0] = vec4(col.rgb, 0.0);
frag_data[1] = spec; frag_data[1] = spec;
frag_data[2] = vec4(norm.xy,0,0); frag_data[2] = vec4(encode_normal(norm.xyz),0,0);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment