further adjustments on bloom

This commit is contained in:
2018-09-03 20:39:26 -05:00
parent 8fd8308d47
commit 80d4132510
4 changed files with 16 additions and 9 deletions

View File

@@ -63,12 +63,13 @@ public class BloomShader implements Disposable {
normalBuffer = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
hBlur = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
vBlur = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
fboRegion = new TextureRegion(normalBuffer.getColorBufferTexture());
fboRegion.flip(false, true);
combineShader.begin();
combineShader.setUniformi("u_texture1", 1);
combineShader.setUniformi("u_texture2", 2);
combineShader.end();
gaussianBlurShader.begin();
@@ -76,7 +77,7 @@ public class BloomShader implements Disposable {
gaussianBlurShader.end();
vBlur.getColorBufferTexture().bind(1);
lightFilterBuffer.getColorBufferTexture().bind(2);
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
}
@@ -109,7 +110,7 @@ public class BloomShader implements Disposable {
fboRegion.setTexture(lightFilterBuffer.getColorBufferTexture());
hBlur.begin();
screenBatch.setShader(gaussianBlurShader);
gaussianBlurShader.setUniformf("radius", 1f + 0.2f*bloomLevel);
gaussianBlurShader.setUniformf("radius", 1f + 0.2f*(bloomLevel*1.75f));
gaussianBlurShader.setUniformi("pass", 0);
screenBatch.draw(fboRegion, 0f, 0f, width, height);
screenBatch.flush();