summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2020-03-30 23:27:04 -0400
committerRye Mutt <rye@alchemyviewer.org>2020-03-30 23:27:04 -0400
commit516ca236597e9e76193dd597edddc6a2fd7b0912 (patch)
treec6655f424686900a84b8b08f88f9cfdf1a4ac081
parent3dc71d1ce97f2a4017f7a0eff056856b02742911 (diff)
Update falloff fix with changes requested in review.
-rw-r--r--indra/newview/llvovolume.cpp4
-rw-r--r--indra/newview/llvovolume.h2
-rw-r--r--indra/newview/pipeline.cpp13
3 files changed, 10 insertions, 9 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 29be841847..ec10d3e22c 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3376,12 +3376,12 @@ F32 LLVOVolume::getLightRadius() const
}
}
-F32 LLVOVolume::getLightFalloff() const
+F32 LLVOVolume::getLightFalloff(const F32 fudge_factor) const
{
const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT);
if (param_block)
{
- return param_block->getFalloff();
+ return param_block->getFalloff() * fudge_factor;
}
else
{
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 776b6a16b0..de00ef494e 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -279,7 +279,7 @@ public:
LLViewerTexture* getLightTexture();
F32 getLightIntensity() const;
F32 getLightRadius() const;
- F32 getLightFalloff() const;
+ F32 getLightFalloff(const F32 fudge_factor = 1.f) const;
F32 getLightCutoff() const;
// Flexible Objects
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 1f5aa644fd..f0ed303f66 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -211,6 +211,7 @@ LLTrace::EventStatHandle<S64> LLPipeline::sStatBatchSize("renderbatchsize");
const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f;
const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f;
+const F32 DEFERRED_LIGHT_FALLOFF = 0.5f;
const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1;
extern S32 gBoxFrame;
@@ -6363,7 +6364,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
continue;
}
- F32 x = (3.f * (1.f + ((light->getLightFalloff() * 0.5f) * 2.0f))); // why this magic? probably trying to match a historic behavior.
+ F32 x = (3.f * (1.f + (light->getLightFalloff() * 2.0f))); // why this magic? probably trying to match a historic behavior.
F32 linatten = x / (light_radius); // % of brightness at radius
mHWLightColors[cur_light] = light_color;
@@ -6376,7 +6377,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
if (sRenderDeferred)
{
light_state->setLinearAttenuation(size);
- light_state->setQuadraticAttenuation(light->getLightFalloff() * 0.5f + 1.f); // get falloff to match for forward deferred rendering lights
+ light_state->setQuadraticAttenuation(light->getLightFalloff(DEFERRED_LIGHT_FALLOFF) + 1.f); // get falloff to match for forward deferred rendering lights
}
else
{
@@ -8807,7 +8808,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
- gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
+ gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF));
gGL.syncMatrices();
mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center));
@@ -8827,7 +8828,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
mat.mult_matrix_vec(tc);
fullscreen_lights.push_back(LLVector4(tc.v[0], tc.v[1], tc.v[2], s));
- light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f));
+ light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF)));
}
}
unbindDeferredShader(gDeferredLightProgram);
@@ -8864,7 +8865,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
- gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f);
+ gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF));
gGL.syncMatrices();
mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center));
@@ -8939,7 +8940,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
LLVector3 center = drawablep->getPositionAgent();
F32* c = center.mV;
F32 light_size_final = volume->getLightRadius()*1.5f;
- F32 light_falloff_final = volume->getLightFalloff()*0.5f;
+ F32 light_falloff_final = volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF);
sVisibleLightCount++;