From cc8cc05f873aa64ee3c4e1ea6e7a662b15c57723 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Wed, 25 May 2016 07:37:17 +0100 Subject: Default constant of attenuation to 1.0 Without this, the default was 0 for the constant attenuation factor. This is bad because if the user only sets the linear and/or quadratic constants, then when the distance gets small, the denominator in the lighting equation gets very large causing a lot of saturation of the renderered meshes. Change-Id: Ie1b8b2d24702090879cb1429912eb51aeb002f68 Reviewed-by: Kevin Ottens --- src/render/lights/qpointlight.cpp | 2 +- src/render/lights/qspotlight.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/lights/qpointlight.cpp b/src/render/lights/qpointlight.cpp index 1936ef4f4..c94078995 100644 --- a/src/render/lights/qpointlight.cpp +++ b/src/render/lights/qpointlight.cpp @@ -64,7 +64,7 @@ namespace Qt3DRender { QPointLightPrivate::QPointLightPrivate() : QAbstractLightPrivate(QAbstractLight::PointLight) { - m_shaderData->setProperty("constantAttenuation", 0.0f); + m_shaderData->setProperty("constantAttenuation", 1.0f); m_shaderData->setProperty("linearAttenuation", 0.0f); m_shaderData->setProperty("quadraticAttenuation", 0.0f); } diff --git a/src/render/lights/qspotlight.cpp b/src/render/lights/qspotlight.cpp index aa2c8c201..a3dd91a6f 100644 --- a/src/render/lights/qspotlight.cpp +++ b/src/render/lights/qspotlight.cpp @@ -68,7 +68,7 @@ namespace Qt3DRender { QSpotLightPrivate::QSpotLightPrivate() : QAbstractLightPrivate(QAbstractLight::SpotLight) { - m_shaderData->setProperty("constantAttenuation", 0.0f); + m_shaderData->setProperty("constantAttenuation", 1.0f); m_shaderData->setProperty("linearAttenuation", 0.0f); m_shaderData->setProperty("quadraticAttenuation", 0.0f); m_shaderData->setProperty("direction", QVector3D(0.0f, -1.0f, 0.0f)); -- cgit v1.2.3