Skip to content

Commit

Permalink
Renderer|FX: Reduce halo brightness as bloom intensity grows
Browse files Browse the repository at this point in the history
To avoid over-saturating halos, halo brightness is reduced as a
factor of bloom intensity.
  • Loading branch information
skyjake committed Apr 10, 2014
1 parent fc58178 commit 2dd0712
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions doomsday/client/include/render/fx/bloom.h
Expand Up @@ -39,6 +39,7 @@ class Bloom : public ConsoleEffect

static void consoleRegister();
static bool isEnabled();
static float intensity();

private:
DENG2_PRIVATE(d)
Expand Down
5 changes: 5 additions & 0 deletions doomsday/client/src/render/fx/bloom.cpp
Expand Up @@ -261,4 +261,9 @@ bool Bloom::isEnabled() // static
return bloomEnabled;
}

float Bloom::intensity()
{
return bloomIntensity;
}

} // namespace fx
10 changes: 9 additions & 1 deletion doomsday/client/src/render/rend_halo.cpp
Expand Up @@ -19,8 +19,8 @@

#include "de_platform.h"
#include "render/rend_halo.h"

#include "render/rend_main.h"
#include "render/fx/bloom.h"

#include "gl/gl_main.h"
#include "gl/gl_texmanager.h"
Expand Down Expand Up @@ -235,6 +235,14 @@ bool H_RenderHalo(Vector3d const &origin, float size, DGLuint tex,
// Apply the global dimming factor.
alpha *= .8f * haloBright / 100.0f;

if(fx::Bloom::isEnabled())
{
// Bloom will make bright areas even brighter, which means halos
// should be dimmer to compensate. Otherwise there will be
// oversaturation.
alpha *= clamp(0.1f, (1.f - fx::Bloom::intensity() * .8f), 1.f);
}

// Secondary flares are a little bolder.
if(secondary)
{
Expand Down

0 comments on commit 2dd0712

Please sign in to comment.