Coder Social home page Coder Social logo

Comments (6)

simeonradivoev avatar simeonradivoev commented on June 1, 2024

It should be easy, given that the scattering is just a post-processing effect. Does it not work with Unity's Skybox system?

from gpu-planetary-rendering.

simeonradivoev avatar simeonradivoev commented on June 1, 2024

Ah it seems the skybox is rendered after lighting. So for skybox support to be added, the atmospheric scattering needs to be turned into an effect for the post-processing stack.

from gpu-planetary-rendering.

louisGreenland avatar louisGreenland commented on June 1, 2024

I was literally just about to post that haha. I wouldn't know how to go about doing that since I am not at all a shader expert. Another issue seems to be the effect glitching at long distances, not sure if this is a floating point issue that could be solved with a floating origin method but I thought i'd let you know anyways. Great stuff!
Unity_QFnMK2TEEy

from gpu-planetary-rendering.

adellari avatar adellari commented on June 1, 2024

@louisGreenland The floating point issues are caused by these lines in AtmosphericScatter.shader:

     float3 attenuation;
     float irradianceFactor = 0;
     float3 inscat = GetInscatteredLight(wpos,viewDir,attenuation,irradianceFactor);
     float3 reflected = GetReflectedLight(wpos, depth,attenuation,irradianceFactor, normal,surfaceColor);

where attenuation is used without proper initialization.
This can of course be easily fixed by changing the first line to

float3 attenuation = float3(0., 0., 0.);

thus removing the visual artifacts

from gpu-planetary-rendering.

adellari avatar adellari commented on June 1, 2024

Ah it seems the skybox is rendered after lighting. So for skybox support to be added, the atmospheric scattering needs to be turned into an effect for the post-processing stack.

Alternatively, using a custom skybox shader with blending mode

Blend One One 

works like a charm since the image effect's blending in AtmosphericScattering.shader is

OneMinusSrcAlpha

from gpu-planetary-rendering.

dev-bre avatar dev-bre commented on June 1, 2024

@adellari can you please expand how to fix this?
I am not expert in shaders, but I am trying to have the sun properly rendered in the sky.
Any chance you can provide an example of custom skybox which would work?

from gpu-planetary-rendering.

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.