Search in sources :

Example 6 with FBOConfig

use of org.terasology.rendering.opengl.FBOConfig in project Terasology by MovingBlocks.

the class WorldRendererImpl method addReflectionAndRefractionNodes.

private void addReflectionAndRefractionNodes(RenderGraph renderGraph) {
    FBOConfig reflectedBufferConfig = new FBOConfig(BackdropReflectionNode.REFLECTED_FBO_URI, HALF_SCALE, FBO.Type.DEFAULT).useDepthBuffer();
    BufferClearingNode reflectedBufferClearingNode = new BufferClearingNode(reflectedBufferConfig, displayResolutionDependentFBOs, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    renderGraph.addNode(reflectedBufferClearingNode, "reflectedBufferClearingNode");
    Node reflectedBackdropNode = new BackdropReflectionNode(context);
    renderGraph.addNode(reflectedBackdropNode, "reflectedBackdropNode");
    Node worldReflectionNode = new WorldReflectionNode(context);
    renderGraph.addNode(worldReflectionNode, "worldReflectionNode");
    renderGraph.connect(reflectedBufferClearingNode, reflectedBackdropNode, worldReflectionNode);
    FBOConfig reflectedRefractedBufferConfig = new FBOConfig(RefractiveReflectiveBlocksNode.REFRACTIVE_REFLECTIVE_FBO_URI, FULL_SCALE, FBO.Type.HDR).useNormalBuffer();
    BufferClearingNode reflectedRefractedBufferClearingNode = new BufferClearingNode(reflectedRefractedBufferConfig, displayResolutionDependentFBOs, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    renderGraph.addNode(reflectedRefractedBufferClearingNode, "reflectedRefractedBufferClearingNode");
    Node chunksRefractiveReflectiveNode = new RefractiveReflectiveBlocksNode(context);
    renderGraph.addNode(chunksRefractiveReflectiveNode, "chunksRefractiveReflectiveNode");
    Node applyDeferredLightingNode = renderGraph.findNode("engine:applyDeferredLightingNode");
    renderGraph.connect(reflectedRefractedBufferClearingNode, chunksRefractiveReflectiveNode);
    renderGraph.connect(worldReflectionNode, chunksRefractiveReflectiveNode);
    // TODO: At this stage, it is unclear -why- this connection is required, we just know that it's required. Investigate.
    renderGraph.connect(applyDeferredLightingNode, chunksRefractiveReflectiveNode);
// TODO: consider having a non-rendering node for FBO.attachDepthBufferTo() methods
}
Also used : FBOConfig(org.terasology.rendering.opengl.FBOConfig) RefractiveReflectiveBlocksNode(org.terasology.rendering.dag.nodes.RefractiveReflectiveBlocksNode) DeferredMainLightNode(org.terasology.rendering.dag.nodes.DeferredMainLightNode) PrePostCompositeNode(org.terasology.rendering.dag.nodes.PrePostCompositeNode) ShadowMapNode(org.terasology.rendering.dag.nodes.ShadowMapNode) OutlineNode(org.terasology.rendering.dag.nodes.OutlineNode) InitialPostProcessingNode(org.terasology.rendering.dag.nodes.InitialPostProcessingNode) BlurredAmbientOcclusionNode(org.terasology.rendering.dag.nodes.BlurredAmbientOcclusionNode) OpaqueBlocksNode(org.terasology.rendering.dag.nodes.OpaqueBlocksNode) AmbientOcclusionNode(org.terasology.rendering.dag.nodes.AmbientOcclusionNode) FinalPostProcessingNode(org.terasology.rendering.dag.nodes.FinalPostProcessingNode) UpdateExposureNode(org.terasology.rendering.dag.nodes.UpdateExposureNode) LightShaftsNode(org.terasology.rendering.dag.nodes.LightShaftsNode) AlphaRejectBlocksNode(org.terasology.rendering.dag.nodes.AlphaRejectBlocksNode) Node(org.terasology.rendering.dag.Node) DeferredPointLightsNode(org.terasology.rendering.dag.nodes.DeferredPointLightsNode) WorldReflectionNode(org.terasology.rendering.dag.nodes.WorldReflectionNode) ToneMappingNode(org.terasology.rendering.dag.nodes.ToneMappingNode) BufferClearingNode(org.terasology.rendering.dag.nodes.BufferClearingNode) HighPassNode(org.terasology.rendering.dag.nodes.HighPassNode) BloomBlurNode(org.terasology.rendering.dag.nodes.BloomBlurNode) OpaqueObjectsNode(org.terasology.rendering.dag.nodes.OpaqueObjectsNode) OutputToHMDNode(org.terasology.rendering.dag.nodes.OutputToHMDNode) LateBlurNode(org.terasology.rendering.dag.nodes.LateBlurNode) ApplyDeferredLightingNode(org.terasology.rendering.dag.nodes.ApplyDeferredLightingNode) BackdropReflectionNode(org.terasology.rendering.dag.nodes.BackdropReflectionNode) DownSamplerForExposureNode(org.terasology.rendering.dag.nodes.DownSamplerForExposureNode) HazeNode(org.terasology.rendering.dag.nodes.HazeNode) RefractiveReflectiveBlocksNode(org.terasology.rendering.dag.nodes.RefractiveReflectiveBlocksNode) SimpleBlendMaterialsNode(org.terasology.rendering.dag.nodes.SimpleBlendMaterialsNode) OutputToScreenNode(org.terasology.rendering.dag.nodes.OutputToScreenNode) BackdropNode(org.terasology.rendering.dag.nodes.BackdropNode) OverlaysNode(org.terasology.rendering.dag.nodes.OverlaysNode) BufferClearingNode(org.terasology.rendering.dag.nodes.BufferClearingNode) BackdropReflectionNode(org.terasology.rendering.dag.nodes.BackdropReflectionNode) WorldReflectionNode(org.terasology.rendering.dag.nodes.WorldReflectionNode)

Example 7 with FBOConfig

use of org.terasology.rendering.opengl.FBOConfig in project Terasology by MovingBlocks.

the class ShadowMapResolutionDependentFBOs method propertyChange.

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (renderingConfig.isDynamicShadows()) {
        int shadowMapResFromSettings = (int) evt.getNewValue();
        shadowMapResolution = new FBO.Dimensions(shadowMapResFromSettings, shadowMapResFromSettings);
        for (Map.Entry<SimpleUri, FBOConfig> entry : fboConfigs.entrySet()) {
            SimpleUri fboName = entry.getKey();
            FBOConfig fboConfig = entry.getValue();
            if (fboLookup.containsKey(fboName)) {
                FBO fbo = fboLookup.get(fboName);
                if (fbo != null) {
                    // TODO: validate if necessary
                    fbo.dispose();
                }
            }
            FBO shadowMapResDependentFBO = generateWithDimensions(fboConfig, shadowMapResolution);
            if (shadowMapResDependentFBO.getStatus() == FBO.Status.DISPOSED) {
                logger.warn("Failed to generate ShadowMap FBO. Turning off shadows.");
                renderingConfig.setDynamicShadows(false);
                break;
            }
            fboLookup.put(fboName, shadowMapResDependentFBO);
        }
    }
}
Also used : FBOConfig(org.terasology.rendering.opengl.FBOConfig) FBO(org.terasology.rendering.opengl.FBO) SimpleUri(org.terasology.engine.SimpleUri) Map(java.util.Map)

Example 8 with FBOConfig

use of org.terasology.rendering.opengl.FBOConfig in project Terasology by MovingBlocks.

the class WorldRendererImpl method addFinalPostProcessingNodes.

private void addFinalPostProcessingNodes(RenderGraph renderGraph) {
    Node initialPostProcessingNode = renderGraph.findNode("engine:initialPostProcessingNode");
    Node updateExposureNode = renderGraph.findNode("engine:updateExposureNode");
    Node toneMappingNode = new ToneMappingNode(context);
    renderGraph.addNode(toneMappingNode, "toneMappingNode");
    renderGraph.connect(updateExposureNode, toneMappingNode);
    renderGraph.connect(initialPostProcessingNode, toneMappingNode);
    // Late Blur nodes: assisting Motion Blur and Depth-of-Field effects
    FBOConfig firstLateBlurConfig = new FBOConfig(FIRST_LATE_BLUR_FBO_URI, HALF_SCALE, FBO.Type.DEFAULT);
    FBO firstLateBlurFbo = displayResolutionDependentFBOs.request(firstLateBlurConfig);
    LateBlurNode firstLateBlurNode = new LateBlurNode(context, displayResolutionDependentFBOs.get(ToneMappingNode.TONE_MAPPING_FBO_URI), firstLateBlurFbo);
    renderGraph.addNode(firstLateBlurNode, "firstLateBlurNode");
    FBOConfig secondLateBlurConfig = new FBOConfig(SECOND_LATE_BLUR_FBO_URI, HALF_SCALE, FBO.Type.DEFAULT);
    FBO secondLateBlurFbo = displayResolutionDependentFBOs.request(secondLateBlurConfig);
    LateBlurNode secondLateBlurNode = new LateBlurNode(context, firstLateBlurFbo, secondLateBlurFbo);
    renderGraph.addNode(secondLateBlurNode, "secondLateBlurNode");
    Node finalPostProcessingNode = new FinalPostProcessingNode(context);
    renderGraph.addNode(finalPostProcessingNode, "finalPostProcessingNode");
    renderGraph.connect(toneMappingNode, firstLateBlurNode, secondLateBlurNode, finalPostProcessingNode);
}
Also used : FBOConfig(org.terasology.rendering.opengl.FBOConfig) SwappableFBO(org.terasology.rendering.opengl.SwappableFBO) FBO(org.terasology.rendering.opengl.FBO) LateBlurNode(org.terasology.rendering.dag.nodes.LateBlurNode) FinalPostProcessingNode(org.terasology.rendering.dag.nodes.FinalPostProcessingNode) DeferredMainLightNode(org.terasology.rendering.dag.nodes.DeferredMainLightNode) PrePostCompositeNode(org.terasology.rendering.dag.nodes.PrePostCompositeNode) ShadowMapNode(org.terasology.rendering.dag.nodes.ShadowMapNode) OutlineNode(org.terasology.rendering.dag.nodes.OutlineNode) InitialPostProcessingNode(org.terasology.rendering.dag.nodes.InitialPostProcessingNode) BlurredAmbientOcclusionNode(org.terasology.rendering.dag.nodes.BlurredAmbientOcclusionNode) OpaqueBlocksNode(org.terasology.rendering.dag.nodes.OpaqueBlocksNode) AmbientOcclusionNode(org.terasology.rendering.dag.nodes.AmbientOcclusionNode) FinalPostProcessingNode(org.terasology.rendering.dag.nodes.FinalPostProcessingNode) UpdateExposureNode(org.terasology.rendering.dag.nodes.UpdateExposureNode) LightShaftsNode(org.terasology.rendering.dag.nodes.LightShaftsNode) AlphaRejectBlocksNode(org.terasology.rendering.dag.nodes.AlphaRejectBlocksNode) Node(org.terasology.rendering.dag.Node) DeferredPointLightsNode(org.terasology.rendering.dag.nodes.DeferredPointLightsNode) WorldReflectionNode(org.terasology.rendering.dag.nodes.WorldReflectionNode) ToneMappingNode(org.terasology.rendering.dag.nodes.ToneMappingNode) BufferClearingNode(org.terasology.rendering.dag.nodes.BufferClearingNode) HighPassNode(org.terasology.rendering.dag.nodes.HighPassNode) BloomBlurNode(org.terasology.rendering.dag.nodes.BloomBlurNode) OpaqueObjectsNode(org.terasology.rendering.dag.nodes.OpaqueObjectsNode) OutputToHMDNode(org.terasology.rendering.dag.nodes.OutputToHMDNode) LateBlurNode(org.terasology.rendering.dag.nodes.LateBlurNode) ApplyDeferredLightingNode(org.terasology.rendering.dag.nodes.ApplyDeferredLightingNode) BackdropReflectionNode(org.terasology.rendering.dag.nodes.BackdropReflectionNode) DownSamplerForExposureNode(org.terasology.rendering.dag.nodes.DownSamplerForExposureNode) HazeNode(org.terasology.rendering.dag.nodes.HazeNode) RefractiveReflectiveBlocksNode(org.terasology.rendering.dag.nodes.RefractiveReflectiveBlocksNode) SimpleBlendMaterialsNode(org.terasology.rendering.dag.nodes.SimpleBlendMaterialsNode) OutputToScreenNode(org.terasology.rendering.dag.nodes.OutputToScreenNode) BackdropNode(org.terasology.rendering.dag.nodes.BackdropNode) OverlaysNode(org.terasology.rendering.dag.nodes.OverlaysNode) ToneMappingNode(org.terasology.rendering.dag.nodes.ToneMappingNode)

Example 9 with FBOConfig

use of org.terasology.rendering.opengl.FBOConfig in project Terasology by MovingBlocks.

the class WorldRendererImpl method addExposureNodes.

private void addExposureNodes(RenderGraph renderGraph) {
    // TODO: Remove the hard coded value here
    FBOConfig gBuffer2Config = displayResolutionDependentFBOs.getFboConfig(new SimpleUri("engine:fbo.gBuffer2"));
    DownSamplerForExposureNode exposureDownSamplerTo16pixels = new DownSamplerForExposureNode(context, gBuffer2Config, displayResolutionDependentFBOs, FBO_16X16_CONFIG, immutableFBOs);
    renderGraph.addNode(exposureDownSamplerTo16pixels, "exposureDownSamplerTo16pixels");
    DownSamplerForExposureNode exposureDownSamplerTo8pixels = new DownSamplerForExposureNode(context, FBO_16X16_CONFIG, immutableFBOs, FBO_8X8_CONFIG, immutableFBOs);
    renderGraph.addNode(exposureDownSamplerTo8pixels, "exposureDownSamplerTo8pixels");
    DownSamplerForExposureNode exposureDownSamplerTo4pixels = new DownSamplerForExposureNode(context, FBO_8X8_CONFIG, immutableFBOs, FBO_4X4_CONFIG, immutableFBOs);
    renderGraph.addNode(exposureDownSamplerTo4pixels, "exposureDownSamplerTo4pixels");
    DownSamplerForExposureNode exposureDownSamplerTo2pixels = new DownSamplerForExposureNode(context, FBO_4X4_CONFIG, immutableFBOs, FBO_2X2_CONFIG, immutableFBOs);
    renderGraph.addNode(exposureDownSamplerTo2pixels, "exposureDownSamplerTo2pixels");
    DownSamplerForExposureNode exposureDownSamplerTo1pixel = new DownSamplerForExposureNode(context, FBO_2X2_CONFIG, immutableFBOs, FBO_1X1_CONFIG, immutableFBOs);
    renderGraph.addNode(exposureDownSamplerTo1pixel, "exposureDownSamplerTo1pixel");
    Node updateExposureNode = new UpdateExposureNode(context);
    renderGraph.addNode(updateExposureNode, "updateExposureNode");
    Node simpleBlendMaterialsNode = renderGraph.findNode("engine:simpleBlendMaterialsNode");
    renderGraph.connect(simpleBlendMaterialsNode, exposureDownSamplerTo16pixels, exposureDownSamplerTo8pixels, exposureDownSamplerTo4pixels, exposureDownSamplerTo2pixels, exposureDownSamplerTo1pixel, updateExposureNode);
}
Also used : FBOConfig(org.terasology.rendering.opengl.FBOConfig) UpdateExposureNode(org.terasology.rendering.dag.nodes.UpdateExposureNode) DownSamplerForExposureNode(org.terasology.rendering.dag.nodes.DownSamplerForExposureNode) DeferredMainLightNode(org.terasology.rendering.dag.nodes.DeferredMainLightNode) PrePostCompositeNode(org.terasology.rendering.dag.nodes.PrePostCompositeNode) ShadowMapNode(org.terasology.rendering.dag.nodes.ShadowMapNode) OutlineNode(org.terasology.rendering.dag.nodes.OutlineNode) InitialPostProcessingNode(org.terasology.rendering.dag.nodes.InitialPostProcessingNode) BlurredAmbientOcclusionNode(org.terasology.rendering.dag.nodes.BlurredAmbientOcclusionNode) OpaqueBlocksNode(org.terasology.rendering.dag.nodes.OpaqueBlocksNode) AmbientOcclusionNode(org.terasology.rendering.dag.nodes.AmbientOcclusionNode) FinalPostProcessingNode(org.terasology.rendering.dag.nodes.FinalPostProcessingNode) UpdateExposureNode(org.terasology.rendering.dag.nodes.UpdateExposureNode) LightShaftsNode(org.terasology.rendering.dag.nodes.LightShaftsNode) AlphaRejectBlocksNode(org.terasology.rendering.dag.nodes.AlphaRejectBlocksNode) Node(org.terasology.rendering.dag.Node) DeferredPointLightsNode(org.terasology.rendering.dag.nodes.DeferredPointLightsNode) WorldReflectionNode(org.terasology.rendering.dag.nodes.WorldReflectionNode) ToneMappingNode(org.terasology.rendering.dag.nodes.ToneMappingNode) BufferClearingNode(org.terasology.rendering.dag.nodes.BufferClearingNode) HighPassNode(org.terasology.rendering.dag.nodes.HighPassNode) BloomBlurNode(org.terasology.rendering.dag.nodes.BloomBlurNode) OpaqueObjectsNode(org.terasology.rendering.dag.nodes.OpaqueObjectsNode) OutputToHMDNode(org.terasology.rendering.dag.nodes.OutputToHMDNode) LateBlurNode(org.terasology.rendering.dag.nodes.LateBlurNode) ApplyDeferredLightingNode(org.terasology.rendering.dag.nodes.ApplyDeferredLightingNode) BackdropReflectionNode(org.terasology.rendering.dag.nodes.BackdropReflectionNode) DownSamplerForExposureNode(org.terasology.rendering.dag.nodes.DownSamplerForExposureNode) HazeNode(org.terasology.rendering.dag.nodes.HazeNode) RefractiveReflectiveBlocksNode(org.terasology.rendering.dag.nodes.RefractiveReflectiveBlocksNode) SimpleBlendMaterialsNode(org.terasology.rendering.dag.nodes.SimpleBlendMaterialsNode) OutputToScreenNode(org.terasology.rendering.dag.nodes.OutputToScreenNode) BackdropNode(org.terasology.rendering.dag.nodes.BackdropNode) OverlaysNode(org.terasology.rendering.dag.nodes.OverlaysNode) SimpleUri(org.terasology.engine.SimpleUri)

Aggregations

FBOConfig (org.terasology.rendering.opengl.FBOConfig)9 Node (org.terasology.rendering.dag.Node)6 AlphaRejectBlocksNode (org.terasology.rendering.dag.nodes.AlphaRejectBlocksNode)6 AmbientOcclusionNode (org.terasology.rendering.dag.nodes.AmbientOcclusionNode)6 ApplyDeferredLightingNode (org.terasology.rendering.dag.nodes.ApplyDeferredLightingNode)6 BackdropNode (org.terasology.rendering.dag.nodes.BackdropNode)6 BackdropReflectionNode (org.terasology.rendering.dag.nodes.BackdropReflectionNode)6 BloomBlurNode (org.terasology.rendering.dag.nodes.BloomBlurNode)6 BlurredAmbientOcclusionNode (org.terasology.rendering.dag.nodes.BlurredAmbientOcclusionNode)6 BufferClearingNode (org.terasology.rendering.dag.nodes.BufferClearingNode)6 DeferredMainLightNode (org.terasology.rendering.dag.nodes.DeferredMainLightNode)6 DeferredPointLightsNode (org.terasology.rendering.dag.nodes.DeferredPointLightsNode)6 DownSamplerForExposureNode (org.terasology.rendering.dag.nodes.DownSamplerForExposureNode)6 FinalPostProcessingNode (org.terasology.rendering.dag.nodes.FinalPostProcessingNode)6 HazeNode (org.terasology.rendering.dag.nodes.HazeNode)6 HighPassNode (org.terasology.rendering.dag.nodes.HighPassNode)6 InitialPostProcessingNode (org.terasology.rendering.dag.nodes.InitialPostProcessingNode)6 LateBlurNode (org.terasology.rendering.dag.nodes.LateBlurNode)6 LightShaftsNode (org.terasology.rendering.dag.nodes.LightShaftsNode)6 OpaqueBlocksNode (org.terasology.rendering.dag.nodes.OpaqueBlocksNode)6