Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to change atmosphere color #3439

Closed
pjcozzi opened this issue Jan 18, 2016 · 6 comments
Closed

Ability to change atmosphere color #3439

pjcozzi opened this issue Jan 18, 2016 · 6 comments
Labels
good first issue An opportunity for first time contributors priority - next release

Comments

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 18, 2016

This has been asked for a few times, including this forum post and this FOSS4G presentation.

Good beginner graphics issue.

@pjcozzi pjcozzi added the good first issue An opportunity for first time contributors label Jan 18, 2016
@kepta
Copy link

kepta commented Jan 19, 2016

Hi @pjcozzi , can I work on this one?
In this file SkyAtmosphereVS.glsl,

const vec3 v3InvWavelength = vec3(
    5.60204474633241,  // Red = 1.0 / Math.pow(0.650, 4.0)
    9.473284437923038, // Green = 1.0 / Math.pow(0.570, 4.0)
    19.643802610477206); // Blue = 1.0 / Math.pow(0.475, 4.0)

I think this is what needs to be modified? Any pointers on how to implement?

@tokyovigilante
Copy link

Some additional realism could be added to the atmosphere when lighting is enabled by fading the brightness or alpha on the night side of the globe.

It might also be cool down the track to combine the existing fog and atmosphere into a unified shader. The new Google Earth JS app does this, and there is another GLES/Unity example at http://scrawkblog.com/2014/05/19/proland-to-unity-atmosphere/. This might be a bigger effort though.

There are some additional posts on that blog regarding varying the Rayleigh scatter value to produce different colors, but I think that's more related to Earth's atmosphere at different times of day.

@kepta
Copy link

kepta commented Jan 21, 2016

@tokyovigilante Can you help me work on this bug ? :P

@tokyovigilante
Copy link

Sure, my physics background doesn't cover optics extensively, but we can give it a crack.

Have a look at Mie and Rayleigh scattering online.

The atmosphere in Cesium is currently based on this GPU Gems article

There is a DX9 implementation for the Proland renderer I posted above. I've just found another OpenGL implementation which has an impressive YouTube demo and should be relatively easy to port over to Cesium, however it has a fairly heavy fragment shader so I'm not sure about performance.

What effects are you aiming to implement? I would suggest increased realism during sunrise and sunset and day/night fading when the camera is in space are most useful.

@kepta
Copy link

kepta commented Jan 21, 2016

First I would like to know,
Do we need to implement an API to change atmosphere colour? or is it based on camera movement solely?

@tokyovigilante
Copy link

Again that depends on your goal. If you want a more realistic representation of Earth's atmosphere, you'll need to implement one of the approaches I've mentioned above.

If you want to represent a different atmosphere, then you need to understand that the mixture of gases determine the scattering of sunlight and therefore perceived color, and alter input parameters, which to do effectively you'll again need to understand Rayleigh scattering.

Lastly, if you just want a ground-based view to have a different color, just turn off the atmosphere entirely and use either a static background color or a SkyBox with custom textures to simulate the atmosphere you want.

kepta added a commit to kepta/cesium that referenced this issue Jan 21, 2016
kepta added a commit to kepta/cesium that referenced this issue Jan 27, 2016
kepta added a commit to kepta/cesium that referenced this issue Jan 27, 2016
Issue: CesiumGS#3439

Change the atmoshphere color
kepta added a commit to kepta/cesium that referenced this issue Jan 27, 2016
    Issue: CesiumGS#3439

    Change the atmoshphere color
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An opportunity for first time contributors priority - next release
Projects
None yet
Development

No branches or pull requests

3 participants