Skip to content

Commit

Permalink
Fix LIGHT compilation for canvas shader
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaosus committed Jan 9, 2021
1 parent 98ccaa1 commit fdfddbd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2506,7 +2506,7 @@ RendererCanvasRenderRD::RendererCanvasRenderRD(RendererStorageRD *p_storage) {
actions.renames["FRAGCOORD"] = "gl_FragCoord";
actions.renames["POINT_COORD"] = "gl_PointCoord";

actions.renames["LIGHT_POSITION"] = "light_pos";
actions.renames["LIGHT_POSITION"] = "light_position";
actions.renames["LIGHT_COLOR"] = "light_color";
actions.renames["LIGHT_ENERGY"] = "light_energy";
actions.renames["LIGHT"] = "light";
Expand Down
10 changes: 5 additions & 5 deletions servers/rendering/renderer_rd/shaders/canvas.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ vec4 light_shadow_compute(uint light_base, vec4 light_color, vec4 shadow_uv

vec4 shadow_color = unpackUnorm4x8(light_array.data[light_base].shadow_color);
#ifdef LIGHT_SHADER_CODE_USED
shadow_color *= shadow_modulate;
shadow_color.rgb *= shadow_modulate;
#endif

shadow_color.a *= light_color.a; //respect light alpha
Expand Down Expand Up @@ -546,7 +546,7 @@ FRAGMENT_SHADER_CODE
#ifdef LIGHT_SHADER_CODE_USED

vec4 shadow_modulate = vec4(1.0);
light_color = light_compute(light_vertex, direction, normal, light_color, light_color.a, specular_shininess, shadow_modulate, screen_uv, color, uv, true);
light_color = light_compute(light_vertex, vec3(direction, light_array.data[light_base].height), normal, light_color, light_color.a, specular_shininess, shadow_modulate, screen_uv, uv, color, true);
#else

if (normal_used) {
Expand All @@ -563,7 +563,7 @@ FRAGMENT_SHADER_CODE
light_color = light_shadow_compute(light_base, light_color, shadow_uv
#ifdef LIGHT_SHADER_CODE_USED
,
shadow_modulate
shadow_modulate.rgb
#endif
);
}
Expand Down Expand Up @@ -605,7 +605,7 @@ FRAGMENT_SHADER_CODE
vec3 light_position = vec3(light_array.data[light_base].position, light_array.data[light_base].height);

light_color.rgb *= light_base_color.rgb;
light_color = light_compute(light_vertex, light_position, normal, light_color, light_base_color.a, specular_shininess, shadow_modulate, screen_uv, color, uv, false);
light_color = light_compute(light_vertex, light_position, normal, light_color, light_base_color.a, specular_shininess, shadow_modulate, screen_uv, uv, color, false);
#else

light_color.rgb *= light_base_color.rgb * light_base_color.a;
Expand Down Expand Up @@ -659,7 +659,7 @@ FRAGMENT_SHADER_CODE
light_color = light_shadow_compute(light_base, light_color, shadow_uv
#ifdef LIGHT_SHADER_CODE_USED
,
shadow_modulate
shadow_modulate.rgb
#endif
);
}
Expand Down

0 comments on commit fdfddbd

Please sign in to comment.