Changed scale distribution for the god ray passes.

This commit is contained in:
Andrei Drexler 2011-03-14 16:47:56 +00:00
parent dffc983550
commit c557cb11df
1 changed files with 12 additions and 8 deletions

View File

@ -135,14 +135,20 @@ static void RB_DrawScaledQuad(float x, float y, float w, float h, float xcenter,
static void RB_RadialBlur(int passes, float stretch, float x, float y, float w, float h, float xcenter, float ycenter, float alpha)
{
const float inc = 1.f / (passes + 1.f);
const float mul = powf(stretch, inc);
float scale;
stretch -= 1.f;
alpha *= inc;
RB_Color4f(alpha, alpha, alpha, 1.f);
for (scale=inc; scale<1.f; scale+=inc)
scale = mul;
while (passes > 0)
{
RB_DrawScaledQuad(x, y, w, h, xcenter, ycenter, 1.f + scale * stretch);
RB_DrawScaledQuad(x, y, w, h, xcenter, ycenter, scale);
scale *= mul;
--passes;
}
RB_Color4f(1.f, 1.f, 1.f, 1.f);
}
@ -203,7 +209,7 @@ static void RB_GodRays(void)
R_FBO_BindColorBuffer(tr.fbo.full[1], 0);
GL_State(GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
mul = 0.25f;
mul = 0.5f;
RB_Color4f(mul, mul, mul, 1.f);
RB_DrawQuad(x, y, w2, h2, 0.f, 0.f, 1.f, 1.f);
@ -219,15 +225,13 @@ static void RB_GodRays(void)
// several additive passes
GL_State(GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
RB_DrawScaledQuad(x, y, w2, h2, pos[0], pos[1], 1.f + 1.f/16.f);
RB_DrawScaledQuad(x, y, w2, h2, pos[0], pos[1], 1.f + 2.f/16.f);
RB_DrawScaledQuad(x, y, w2, h2, pos[0], pos[1], 1.f + 3.f/16.f);
RB_RadialBlur(3, 4.f/3.f, x, y, w2, h2, pos[0], pos[1], 1.f);
// switch back to the first buffer and do some more passes
R_FBO_Bind(tr.fbo.quarter[0]);
R_FBO_BindColorBuffer(tr.fbo.quarter[1], 0);
RB_RadialBlur(5, 4.f, x, y, w2, h2, pos[0], pos[1], 1.f);
RB_RadialBlur(5, 5.f, x, y, w2, h2, pos[0], pos[1], 1.f);
RB_Color4f(1.f, 1.f, 1.f, 1.f);