From bcd075820a7fbe72d3c293a4e4365a349c7a9958 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 12 Nov 2026 14:04:46 +0400 Subject: fix(render): disable specular from opposite celestial lights --- .../fparkan-render-vulkan/shaders/triangle.vert | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'adapters/fparkan-render-vulkan/shaders/triangle.vert') diff --git a/adapters/fparkan-render-vulkan/shaders/triangle.vert b/adapters/fparkan-render-vulkan/shaders/triangle.vert index 039aed07..4615bae0 100644 --- a/adapters/fparkan-render-vulkan/shaders/triangle.vert +++ b/adapters/fparkan-render-vulkan/shaders/triangle.vert @@ -184,21 +184,24 @@ LightingTerms native_material_lighting( for (int index = 0; index < 4; ++index) { vec4 direction_record = frame.directional_direction[index]; vec4 rgb_record = frame.directional_rgb[index]; - if (direction_record.w <= 0.5 || rgb_record.w <= 0.5) { + if (direction_record.w <= 0.5) { continue; } vec3 light_direction = normalized_or(-direction_record.xyz, vec3(0.0, 0.0, 1.0)); float ndotl = max(dot(normal, light_direction), 0.0); accumulated += ndotl * directional_rgb * rgb_record.rgb; - specular += specular_from_light( - normal, - view_direction, - light_direction, - rgb_record.rgb, - specular_rgb, - specular_power, - 1.0 - ); + // CShade light flags bit 1 suppresses only the specular contribution. + if (rgb_record.w > 0.5) { + specular += specular_from_light( + normal, + view_direction, + light_direction, + rgb_record.rgb, + specular_rgb, + specular_power, + 1.0 + ); + } } for (uint index = 0u; index < point_light_buffer.header.x; ++index) { PointLightRecord point_light = point_light_buffer.records[index]; -- cgit v1.2.3