Skip to content

Commit

Permalink
Fixed #34 Glow Is Way too Bright
Browse files Browse the repository at this point in the history
  • Loading branch information
HumanGamer committed May 21, 2021
1 parent 2bc2587 commit 8db8d06
Showing 1 changed file with 108 additions and 0 deletions.
108 changes: 108 additions & 0 deletions engine/gfx/glowBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,116 @@ void GlowBuffer::blur()

mBlurShader->shader->process();

// Attempt at MBU X360 Glow Buffer
/*Point4F pixelOffsets = mPixelOffsets;
// PASS 1
//-------------------------------
setupPixelOffsets(pixelOffsets, true);
Point3F kernel[13];
kernel[0].set(0.0f, -0.0078125f, 0.0f);
kernel[1].set(0.6f, 0.0f, -0.00390625f);
kernel[2].set(0.0f, 0.69999999f, 0.0f);
kernel[3].set(0.0f, 0.0f, 1.0f);
kernel[4].set(0.0f, 0.00390625f, 1.0f);
kernel[5].set(0.69999999f, 0.0f, 0.0078125f);
kernel[6].set(0.0f, 0.6f, 0.0f);
kernel[7].set(0.01171875f, 0.0f, 0.5f);
kernel[8].set(0.0f, 0.015625f, 0.0f);
kernel[9].set(0.4f, 0.0f, 0.01953125f);
kernel[10].set(0.0f, 0.3f, 0.0f);
kernel[11].set(0.0234375f, 0.0f, 0.1f);
kernel[12].set(0.0f, 0.0f, 0.0f);
float divisibles[13];
divisibles[0] = 0.1f;
divisibles[1] = 0.0f;
divisibles[2] = -0.01953125f;
divisibles[3] = 0.0f;
divisibles[4] = 0.3f;
divisibles[5] = 0.0f;
divisibles[6] = -0.015625f;
divisibles[7] = 0.0f;
divisibles[8] = 0.4f;
divisibles[9] = 0.0f;
divisibles[10] = -0.01171875f;
divisibles[11] = 0.0f;
divisibles[12] = 0.5f;
// set blur kernel
GFX->setPixelShaderConstF(0, (float*)kernel, 13);
float divisor = 0.0f;
for (S32 i = 0; i < 13; i++)
divisor += divisibles[i];
GFX->setPixelShaderConstF(30, &divisor, 1);
GFX->setTexture(0, mSurface[0]);
GFX->setTexture(1, mSurface[0]);
GFX->setTexture(2, mSurface[0]);
GFX->setTexture(3, mSurface[0]);
GFX->setActiveRenderSurface(mSurface[1]);
GFX->drawPrimitive(GFXTriangleFan, 0, 2);
// PASS 2
//-------------------------------
setupPixelOffsets(pixelOffsets * -1.0f, true);
Point3F kernel2[13];
kernel2[0].set(0.0f, 0.0f, -0.0078125f);
kernel2[1].set(0.6f, 0.0f, 0.0f);
kernel2[2].set(-0.00390625f, 0.69999999f, 0.0f);
kernel2[3].set(0.0f, 0.0f, 1.0f);
kernel2[4].set(0.0f, 0.0f, 0.00390625f);
kernel2[5].set(0.69999999f, 0.0f, 0.0f);
kernel2[6].set(0.0078125, 0.6f, 0.0f);
kernel2[7].set(0.0f, 0.01171875f, 0.5f);
kernel2[8].set(0.0f, 0.0f, 0.015625f);
kernel2[9].set(0.4f, 0.0f, 0.0f);
kernel2[10].set(0.01953125f, 0.3f, 0.0f);
kernel2[11].set(0.0f, 0.0234375f, 0.1f);
kernel2[12].set(0.0f, 0.0f, 0.0f);
float divisibles2[13];
divisibles2[0] = 0.1f;
divisibles2[1] = 0.0f;
divisibles2[2] = 0.0f;
divisibles2[3] = -0.01953125f;
divisibles2[4] = 0.3f;
divisibles2[5] = 0.0f;
divisibles2[6] = 0.0f;
divisibles2[7] = -0.015625f;
divisibles2[8] = 0.4f;
divisibles2[9] = 0.0f;
divisibles2[10] = 0.0f;
divisibles2[11] = -0.01171875f;
divisibles2[12] = 0.5f;
// set blur kernel
GFX->setPixelShaderConstF(0, (float*)kernel2, 13);
float divisor2 = 0.0f;
for (S32 i = 0; i < 13; i++)
divisor2 += divisibles2[i];
GFX->setPixelShaderConstF(30, &divisor2, 1);
GFX->setTexture(0, mSurface[1]);
GFX->setTexture(1, mSurface[1]);
GFX->setTexture(2, mSurface[1]);
GFX->setTexture(3, mSurface[1]);
GFX->setActiveRenderSurface(mSurface[0]);
GFX->drawPrimitive(GFXTriangleFan, 0, 2);
*/

Point4F pixelOffsets = mPixelOffsets;

float divisor = 1.25f;
GFX->setPixelShaderConstF(2, &divisor, 1);

if (mMaxGlowPasses > 0)
{
// PASS 1
Expand Down

0 comments on commit 8db8d06

Please sign in to comment.