From e702003f0ec508219b2887d44d8f41736f380835 Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Sun, 28 Jan 2024 22:01:00 +0100 Subject: [PATCH] volumetric: remove -1 --- data/base/shaders/vk/pointlights.glsl | 6 ++---- lib/ivis_opengl/pielighting.cpp | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/data/base/shaders/vk/pointlights.glsl b/data/base/shaders/vk/pointlights.glsl index 84023f69f16..c8de86a15b6 100644 --- a/data/base/shaders/vk/pointlights.glsl +++ b/data/base/shaders/vk/pointlights.glsl @@ -57,8 +57,7 @@ vec4 iterateOverAllPointLights( int lightIndex = PointLightsIndex[entryInLightList / 4][entryInLightList % 4]; vec4 position = PointLightsPosition[lightIndex]; vec4 colorAndEnergy = PointLightsColorAndEnergy[lightIndex]; - vec3 tmp = position.xyz * vec3(1., 1., -1.); - light += processPointLight(WorldFragPos, fragNormal, viewVector, material, tmp, colorAndEnergy.w, colorAndEnergy.xyz, normalWorldSpaceToLocalSpace); + light += processPointLight(WorldFragPos, fragNormal, viewVector, material, position.xyz, colorAndEnergy.w, colorAndEnergy.xyz, normalWorldSpaceToLocalSpace); } return light; } @@ -154,8 +153,7 @@ vec4 volumetricLights( int lightIndex = PointLightsIndex[entryInLightList / 4][entryInLightList % 4]; vec4 position = PointLightsPosition[lightIndex]; vec4 colorAndEnergy = PointLightsColorAndEnergy[lightIndex]; - vec3 tmp = position.xyz * vec3(1., 1., -1.); - scatteredLight += colorAndEnergy.xyz * pointLightEnergyAtPosition(posOnViewLine, tmp, colorAndEnergy.w) * od; + scatteredLight += colorAndEnergy.xyz * pointLightEnergyAtPosition(posOnViewLine, position.xyz, colorAndEnergy.w) * od; } result += scatteredLight * currentTransmittence; diff --git a/lib/ivis_opengl/pielighting.cpp b/lib/ivis_opengl/pielighting.cpp index 92daa19e08f..bb7f2363a5f 100644 --- a/lib/ivis_opengl/pielighting.cpp +++ b/lib/ivis_opengl/pielighting.cpp @@ -151,7 +151,8 @@ void renderingNew::LightingManager::ComputeFrameData(const LightingData& data, L const auto& light = culledLights[lightIndex]; result.positions[lightIndex].x = light.position.x; result.positions[lightIndex].y = light.position.y; - result.positions[lightIndex].z = light.position.z; + // z coordinate system require the -1 factor before entering shaders + result.positions[lightIndex].z = -light.position.z; result.colorAndEnergy[lightIndex].x = light.colour.byte.r / 255.f; result.colorAndEnergy[lightIndex].y = light.colour.byte.g / 255.f; result.colorAndEnergy[lightIndex].z = light.colour.byte.b / 255.f;