Earth in cycles with volumetric atmosphere

Warning: theorical phisical representation textwall. Stay away if you just want to show an atmospher ein your picture and don’t want to know (or you already know) how our real atmosphere interacts with light.

I’ve no idea about how to do it in cycles, but phisically the atmosphere is a volume scattering material which mostly scatters blue light, while red light is less affected by it (this is why you see a blue sky at mid-day and it’s red at dawn/dusk: you see the scattered blue on mid-day, while at dawn/dusk you see the red because blue has been scattered along the way). There is a reason for this: the atmosphere’s particles’ size is approximately the same as the wavelength of blue light, therefore when blue light hits them, diffraction happens.

It also decreases in density while going up, and while there’s no exact point where you can say “hey, i’m out of the atmosphere”, at about 500km it’s pretty much vanished.
This decrease is not linear, it’s exponential instead: more than half of the atmosphere’s mass is under 10Km from the surface. So, you can pretty much say that density at a certain height, for rendering purposes, can be approximated as D=k^(-h), where k is a constant you may pick as you like and h is the height.
I think some math could achieve a volume texture that does this, tough in this case reality approximation seems to be a complicated and inefficient method to achieve a good image :).

1 Like

I think I get what your saying and it is beyond my capability to make a custom shader such as that. I am faking the atmosphere in the compositor because a volume material would take a lot longer to render and it would be harder to get the desired look.

1 Like

I’m going to try doing what i said and placing it around a stupid white sphere, then i’ll tell you :stuck_out_tongue:

1 Like

see:


and

1 Like

I think i got my equation ready, it was kinda weird to make it using blender’s nodes xD
Also, it is based on a center of the planet situated at 0;0;0 but i may as well add some nodes to make it accept other coordinates for the center, as well as vary the gradient and the distanxe at which it fades away :stuck_out_tongue:

EDIT: Here is what i have. Being a volume, it needs many samples to look decent.
The equation became D=(k^(-h))-(k^(-f)), where k is a constant, h is the distance from the center and f is the height at which i want the density to become 0.
The mess on the left basically calculates the distance of each point of the volume from the center (0;0;0), which is then used as the “h” in the equation. In the middle, there is the equation going on, where the k is 1.3 and the f is 14.5. On the right you can recognize the shader node.


1 Like

yeah, that setup doesn’t really give the most artistic looking result, but i would love to find a way to do it with volume material.

What!!! There is a damn SPHERICAL gradient in Blender!!! That is WAY simpler, had i known that! xD
Just one thing about point 2: the square root of 10 is a bit more than 3, so either the correct number for that is not 1 or the square root is not really the way to get it :wink:

Anyway, i think i’d like a good expression solver in blender that doesn’t need a thousand of nodes. Maybe python could help, i i knew it :stuck_out_tongue:

1 Like

Beautiful picture at the link, but the atmosphere does not look like there’s a thick fog around… http://eoimages.gsfc.nasa.gov/images/imagerecords/79000/79790/city_lights_asia_night_8k.jpg
This makes a volume kinda useless :stuck_out_tongue:
Instead, if you look at the top, where the thin, brigt atmosphere meets the dark, you see a rainbow: light reftacts when entering the atmosphere, because while the IOR of empty space is 1, air’s IOR is slightly higher. I find it interesting :stuck_out_tongue:

1 Like

I noticed that also, but the node setup does work. you just have to tweak your inputs to achive your desired result

1 Like

Jamie B, that thread doesn’t give an explanation as to how the atmosphere was made(that i saw). I tried the method you posted and got a somewhat interesting result. Is there a way to make it darker at the very edge? and make it lighter closer to the ground? it does not seem to have much of a gradient at the very edge, it looks like a constant density.


2 Likes

I’m playing with equations, to get a bit of control over the density of atmosphere at varoius heigths.
I found out that a logarithm worked better than an exponential (which basically was the wrong thing to do), and got a nice crepuscular light on the night/day separation together with a light stripe at the edge of the sphere (unfortunately with no rainbow).
I have to say that 512 samples sobol still give a noisy image, thanks to volumetrics :frowning:

Anyway, i stil didn’t get a shooth enough gradient. Looking at photos, atmosphere appears uniform up to little more than clouds’ height, then it fades away. I’m starting to think that feeding the “distance from center” calculated through my nodes on the right into a gradient could be a good idea. But i’d also add a node to subtract the range of the “ground sphere” from the result, so i have control only where i need it.

I think i got a nice looking one. I threw the equation into the trashcan (yay!) and plugged the distance-from-point nodes into a color ramp, after subtracting from them the radius of the planet, then i divided the output of the ramp by the thickness i wanted the atmosphere to be.
I think the result looks good (if you don’t take into account the fact that the earth is a damn stupid textured sphere, and there’s a lot of noise on the right caused by my bad branched path tracing settings :P):


Yeah, the stars shouldn’t be there because in a photo they would be underexposed due to the brightness of the earth. But i threw them in anyway :stuck_out_tongue:

That looks cool but the atmosphere seems to extend very far out into space, and could you share a screen shot of your whole node set-up?

Ok, i made a screenshot and hilighted the important things, please read before use:

  • the red area is the part which calculates the distance from center of the volume on each volumetric point
  • in the green node you set the distance from the center of the volume at which the height should be 0 (the ground level of the planet); this should equal the range of the planet
  • in the yellow node you set the height (distance from the planet’s ground)at which atmosphere completely fades away
  • the color ramp controls the fading of the atmosphere at various heights, you should play a bit with this
  • in the blue node you set the density of the atmosphere at ground level


Gspin - You should incorporate volume absortion into your shader also. As far as i know, atmospheres absorb light as well as allowing it to scatter through.

This article explains how atmospheric absorption/scattering takes place in reality. it’s a good in depth article, and i’m sure you can extract relevant information to help you improve your shader. - http://www.sciencedirect.com/science/article/pii/0960168693901047

Sorry mate, i’m still experimenting with this myself, and i haven’t made much progress so far. If i do come up with something i will let you know.

I know the atmosphere also does absorption, but it didn’t look good, or at least it was harder to manage :stuck_out_tongue:
The thing is, if i use blue absorption, athmosphere will look bluish at every angle, while it should create a reddish light on the day/night edge (as it does in the shader i posted). With red absorption i have a reddish look on the day side, while it should look bluish, as it does. I think i should try a colorless absorption, yet to me it seems the density should be much smaller than that of the scatter.
What i REALLY feel is missing is the atmosphere’s refraction, because light does get refracted when going through it in real world, producing a really nice rainbow effect on some sides. In fact, while vacuum’s IOR is 1, air’s IOR is around 1.0003 which, tough it’s really small, can create visible spectrum refraction effect when far outside the atmosphere.
Unfortunately, i don’t think this can be done in blender.

I think i may be on to something. It doesn’t look great so far and the planet model is not too good (I used one i made a while back) plus i’ve only just started testing this method but i think with some fine tuning it could turn out some nice results. I’ve attached some images of my first test render below, along with the node setup. (A very simple node setup lol) The fade into space is terrible at the moment, it’s too sudden, but i’m sure i can find a way to sort that out :slight_smile:

The colour ramp only has two colours (it could do with more) a darkish grey at position 0.000, and a full black at position 0.020

P.S - I had my multiply node set so high to better highlight the density change from ground upwards

Attachments




Found a way to immitate volumetric refraction (with varying levels of success)

it can be done but i don’t think it’s very physically accurate. I’ll post a render of the atmosphere and a screenshot of the shader, see if you can do anything with this idea. Probably not, but it is the only way i can think of incorporating refraction into your volume shader.

Attachments


The Node Setup - for some reason, you can only see the refraction if you set the colour to a very bright white. see below.

Attachments