private TerrainPicking(){ depthmapBuffer = BufferUtil.createFloatBuffer(BaseContext.getWindow().getWidth() * BaseContext.getWindow().getHeight()); }
public MotionBlur() { pixelVelocityTexture = new Texture2DNoFilterRGBA32F(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight()); motionBlurSceneTexture = new Texture2DStorageRGBA16F(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight(),1); pixelVelocityShader = PixelVelocityShader.getInstance(); motionBlurShader = MotionBlurShader.getInstance(); }
public FXAA(){ shader = FXAAShader.getInstance(); fxaaSceneTexture = new Texture2DNoFilterRGBA16F(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight()); }
public void updateUniforms(GLTexture depthmap) { glActiveTexture(GL_TEXTURE0); depthmap.bind(); setUniformi("depthmap", 0); setUniformf("windowWidth", BaseContext.getWindow().getWidth()); setUniformf("windowHeight", BaseContext.getWindow().getHeight()); } }
public ContrastController() { contrastShader = ContrastShader.getInstance(); contrastTexture = new Texture2DBilinearFilterRGBA16F(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight()); contrastTexture.bind(); contrastTexture.clampToEdge(); contrastTexture.unbind(); }
public void updateUniforms(GLTexture depthmap){ glActiveTexture(GL_TEXTURE0); depthmap.bind(); setUniformi("depthmap", 0); setUniformf("windowWidth", BaseContext.getWindow().getWidth()); setUniformf("windowHeight", BaseContext.getWindow().getHeight()); } }
public void updateUniforms(GLTexture sceneTexture){ glActiveTexture(GL_TEXTURE0); sceneTexture.bind(); setUniformi("sceneSampler", 0); setUniformf("width", (float) BaseContext.getWindow().getWidth()); setUniformf("height", (float) BaseContext.getWindow().getHeight()); } }
public void render(GLTexture sceneTexture){ shader.bind(); glBindImageTexture(0, fxaaSceneTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); shader.updateUniforms(sceneTexture); glDispatchCompute(BaseContext.getWindow().getWidth()/16, BaseContext.getWindow().getHeight()/16, 1); }
public SunLightScattering() { lightScatteringShader = SunLightScatteringShader.getInstance(); additiveBlendShader = SunLightScatteringAdditiveBlendShader.getInstance(); sunLightScatteringTexture = new Texture2DBilinearFilterRGBA16F(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight()); sunLightScatteringTexture.bind(); sunLightScatteringTexture.clampToEdge(); sunLightScatteringTexture.unbind(); sunLightScatteringSceneTexture = new Texture2DBilinearFilterRGBA16F(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight()); sunLightScatteringSceneTexture.bind(); sunLightScatteringSceneTexture.clampToEdge(); sunLightScatteringSceneTexture.unbind(); }
public DepthOfFieldBlur() { horizontalBlurShader = DepthOfFieldHorizontalBlurShader.getInstance(); verticalBlurShader = DepthOfFieldVerticalBlurShader.getInstance(); fullScreenQuad = new FullScreenQuad(); horizontalBlurSceneTexture = new Texture2DStorageRGBA16F(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight(),1); verticalBlurSceneTexture = new Texture2DStorageRGBA16F(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight(),1); lowResSceneSampler = new Texture2DBilinearFilterRGBA16F((int)(BaseContext.getWindow().getWidth()/1.2f), (int)(BaseContext.getWindow().getHeight()/1.2f)); lowResSceneSampler.bind(); lowResSceneSampler.clampToEdge(); lowResSceneSampler.unbind(); lowResFbo = new GLFramebuffer(); lowResFbo.bind(); lowResFbo.createColorTextureAttachment(lowResSceneSampler.getHandle(), 0); lowResFbo.checkStatus(); lowResFbo.unbind(); }
public void render(GLTexture sceneSampler, GLTexture lightScatteringMask) { lightScatteringShader.bind(); glBindImageTexture(0, lightScatteringMask.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(1, sunLightScatteringTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); lightScatteringShader.updateUniforms(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight(), BaseContext.getCamera().getViewProjectionMatrix()); glDispatchCompute(BaseContext.getWindow().getWidth()/8, BaseContext.getWindow().getHeight()/8, 1); glFinish(); additiveBlendShader.bind(); glBindImageTexture(0, sunLightScatteringTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(1, sceneSampler.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(2, sunLightScatteringSceneTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); glDispatchCompute(BaseContext.getWindow().getWidth()/8, BaseContext.getWindow().getHeight()/8, 1); glFinish(); }
public void updateUniforms(GLTexture texture) { glActiveTexture(GL_TEXTURE0); texture.bind(); setUniformi("texture", 0); setUniformi("width", BaseContext.getWindow().getWidth()); setUniformi("height", BaseContext.getWindow().getHeight()); setUniformi("multisamples", BaseContext.getConfig().getMultisamples()); } }
public void render(GLTexture sceneSampler) { contrastShader.bind(); glBindImageTexture(0, sceneSampler.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(1, contrastTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); contrastShader.updateUniforms(contrastFactor, brightnessFactor); glDispatchCompute(BaseContext.getWindow().getWidth()/16, BaseContext.getWindow().getHeight()/16, 1); glFinish(); }
public void updateUniforms(Matrix4f projectionMatrix, Matrix4f inverseViewProjectionMatrix, Matrix4f previousViewProjectionMatrix, GLTexture depthmap) { glActiveTexture(GL_TEXTURE0); depthmap.bind(); setUniformi("depthmap", 0); setUniformf("windowWidth", BaseContext.getWindow().getWidth()); setUniformf("windowHeight", BaseContext.getWindow().getHeight()); setUniform("projectionMatrix", projectionMatrix); setUniform("inverseViewProjectionMatrix", inverseViewProjectionMatrix); setUniform("previousViewProjectionMatrix", previousViewProjectionMatrix); } }
public void render(GLTexture sceneSampler, GLTexture depthmap) { pixelVelocityShader.bind(); glBindImageTexture(0, pixelVelocityTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA32F); pixelVelocityShader.updateUniforms(BaseContext.getCamera().getProjectionMatrix(), BaseContext.getCamera().getViewProjectionMatrix().invert(), BaseContext.getCamera().getPreviousViewProjectionMatrix(), depthmap); glDispatchCompute(BaseContext.getWindow().getWidth()/8, BaseContext.getWindow().getHeight()/8, 1); glFinish(); motionBlurSceneTexture.bind(); motionBlurShader.bind(); glBindImageTexture(0, motionBlurSceneTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); glBindImageTexture(1, sceneSampler.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(2, pixelVelocityTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); motionBlurShader.updateUniforms(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight()); glDispatchCompute(BaseContext.getWindow().getWidth()/8, BaseContext.getWindow().getHeight()/8, 1); glFinish(); }
public void render(GLTexture sceneTexture, GLTexture sceneDepthMap) { underWaterShader.bind(); glBindImageTexture(0, sceneTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(1, underwaterSceneTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); underWaterShader.updateUniforms(sceneDepthMap); glDispatchCompute(BaseContext.getWindow().getWidth()/8, BaseContext.getWindow().getHeight()/8, 1); glFinish(); distortion += distortion_delta; GLContext.getResources().setUnderwaterDistortion(distortion); }
public UnderWaterRenderer() { underWaterShader = UnderWaterShader.getInstance(); underwaterSceneTexture = new Texture2DBilinearFilterRGBA16F(BaseContext.getWindow().getWidth(), BaseContext.getWindow().getHeight()); underwaterSceneTexture.bind(); underwaterSceneTexture.clampToEdge(); underwaterSceneTexture.unbind(); dudvMap = new Texture2DTrilinearFilter("textures/water/dudv/dudv1.jpg"); causticsMap = new Texture2DTrilinearFilter("textures/water/caustics/caustics.jpg"); GLContext.getResources().setUnderwaterCausticsMap(causticsMap); GLContext.getResources().setUnderwaterDudvMap(dudvMap); }
public void render(GLTexture opaqueScene, GLTexture opaqueSceneDepthMap, GLTexture opaqueSceneLightScatteringTexture, GLTexture transparencyLayer, GLTexture transparencyLayerDepthMap, GLTexture alphaMap, GLTexture transparencyLayerLightScatteringTexture){ shader.bind(); glBindImageTexture(0, blendedSceneTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); glBindImageTexture(1, blendedLightScatteringTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); glBindImageTexture(2, opaqueSceneDepthMap.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); glBindImageTexture(3, transparencyLayerDepthMap.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); shader.updateUniforms(opaqueScene, opaqueSceneLightScatteringTexture, transparencyLayer, alphaMap, transparencyLayerLightScatteringTexture); glDispatchCompute(BaseContext.getWindow().getWidth()/16, BaseContext.getWindow().getHeight()/16, 1); }
public void render(GLTexture worldPositionTexture, GLTexture LightScatteringMaskMS) { shader.bind(); glBindImageTexture(0, sampleCoverageMask.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_R16F); glBindImageTexture(1, worldPositionTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); glBindImageTexture(2, lightScatteringMaskDownSampled.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); glBindImageTexture(3, LightScatteringMaskMS.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); shader.updateUniforms(); glDispatchCompute(BaseContext.getWindow().getWidth()/16, BaseContext.getWindow().getHeight()/16, 1); }
public void render(GLTexture sampleCoverageMask, GLTexture ssaoBlurTexture, GLTexture pssm, GLTexture offScreenAlbedoTexture, GLTexture offScreenWorldPositionTexture, GLTexture offScreenNormalTexture, GLTexture offScreenSpecularEmissionTexture, boolean ssaoFlag){ shader.bind(); glBindImageTexture(0, deferredLightingSceneTexture.getHandle(), 0, false, 0, GL_WRITE_ONLY, GL_RGBA16F); glBindImageTexture(2, offScreenAlbedoTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(3, offScreenWorldPositionTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); glBindImageTexture(4, offScreenNormalTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); glBindImageTexture(5, offScreenSpecularEmissionTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA16F); glBindImageTexture(6, sampleCoverageMask.getHandle(), 0, false, 0, GL_READ_ONLY, GL_R16F); glBindImageTexture(7, ssaoBlurTexture.getHandle(), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); shader.updateUniforms(pssm, ssaoFlag); glDispatchCompute(BaseContext.getWindow().getWidth()/16, BaseContext.getWindow().getHeight()/16,1); }