Giter Site home page Giter Site logo

Fog not rendering about digitalrune HOT 4 CLOSED

digitalrune avatar digitalrune commented on June 28, 2024
Fog not rendering

from digitalrune.

Comments (4)

Lu05 avatar Lu05 commented on June 28, 2024 1

I don´t use fog rendering so this is just an idea.
I think you shouldn´t create the GBuffer0 by yourself.
At the DefferedGraphicsScreen sample the GBufferRenderer does it.
image
I can´t see that you use the GBufferRenderer so maybe this is the problem.

from digitalrune.

polyminthe avatar polyminthe commented on June 28, 2024

Please, help me . i am blocked since many days :'(

from digitalrune.

polyminthe avatar polyminthe commented on June 28, 2024

Hi, thank you so much for try to help me.I really appreciate that.
I try now your solution. And replace the code in my function

if (context.GBuffer0 == null)
            { 
              ........
            }

By that new code

context.Data[RenderContextKeys.RebuildZBufferRenderer] = _rebuildZBufferRenderer;
 _gBufferRenderer.Render(sceneQuery.RenderableNodes, sceneQuery.DecalNodes, context);

After this , if i start my game. I only can see a purple screen ^^. I think , i still need to change somethings.
By the way, i find the documentation not explain us to use the gBufferRenderer for render the fog.
I hope somebody have some idea

from digitalrune.

polyminthe avatar polyminthe commented on June 28, 2024

THank you !! I find now .
I just add that code more and everything goes well 👍

// Render opaque meshes.    
            context.RenderTarget =
          renderTargetPool.Obtain2D(new RenderTargetFormat(width, height, false, SurfaceFormat.HdrBlendable,
            DepthFormat.Depth24Stencil8));
            graphicsDevice.SetRenderTarget(context.RenderTarget);
            context.Viewport = graphicsDevice.Viewport;

// Only copy the current render target to the final render target without post-processing.
            graphicsDevice.SetRenderTarget(originalRenderTarget);
            graphicsDevice.Viewport = originalViewport;
            SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone);
            SpriteBatch.Draw(context.SourceTexture, new Rectangle(0, 0, originalViewport.Width, originalViewport.Height), Color.White);
            SpriteBatch.End();


context.RenderPass = null;
            context.CameraNode = null;
            context.LodCameraNode = null;
            context.Scene = null;
            context.LodHysteresis = 0;
            renderTargetPool.Recycle(context.GBuffer0);
            context.GBuffer0 = null;
            renderTargetPool.Recycle(context.GBuffer1);
            context.GBuffer1 = null;
            renderTargetPool.Recycle((RenderTarget2D) context.Data[RenderContextKeys.DepthBufferHalf]);
            context.Data.Remove(RenderContextKeys.DepthBufferHalf);
            context.Data.Remove(RenderContextKeys.RebuildZBufferRenderer);

from digitalrune.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.