Atmospheric Scattering In Unity from GPU Gems 2

http://www.3dservice.ru/DefaultScene/SkyScene.html

Hi Everybody !
On link above my experience in Atmospheric Scattering by Sean O’Neil, from page http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html

202559--7479--$4_358.jpg
202559--7480--$2_128.jpg
202559--7481--$1_198.jpg

Amazing work!

You could make a sky day/night cycle using this method

This is superb!

Matt.

Yes of course!

nice work

Would this work in unity indie? and how does one accomplish this effect? i’d only need it for a large (flat) level not a spherical world

This is just a Vertex Shader ( simply fragment), work on Shader Model 2.0…

Kool, i don’t know much about how shaders work (except basic shaders).

Where would i start if i wanted this effect in the sky?

Here =)… The Cg Tutorial - Chapter 1. Introduction

Awesome work Russian Madman. I’ve implemented the same method on a visualization I did for NASA. NASA’s Eyes

I toned down the effect to not take away from the Blue Marble. I noticed your map looked a bit low res, if you are looking for a hi res texture map of the earth, go here: http://visibleearth.nasa.gov/view_set.php?categoryID=2363

Someone mentioned a day/night cycle earlier in the post. You can find a hi res texture map on that BlueMarble site as well.

If anyone is wondering on how to implement this effect in Unity, check out this thread: http://forum.unity3d.com/viewtopic.php?t=13076

Like I mentioned earlier, the effect is toned down, I would ask Russian Madman for his parameters if you want it to look like his.

Russian Madman, would you be willing to post your shader code, I would like to see how yours works. Again, awesome work!

–Paul

I forgot to mention, I really like your implementation of the atmospheric scattering from the ground!

–Paul

That’s a very nice visualization. Playing around with the camera close to the surface is quite fun. The only thing bothering me is the ugly, built-in lens flare. I think it would look better without one, or perhaps try one of these: Lens Flare examples.

Wow! Thanks for examples =)…Now I’am working around exposition, and maybe later I will share my code for SkyFromGround shader.

Shaders can be downloaded here : http://forum.unity3d.com/viewtopic.php?t=13076

I have taken the sample project from the other thread and have been messing around with it. I would like to apply this shader to my own scene which is currently of a planet orbiting a star. The star is drawn as a “point” light which means it is no longer visible when the planet passes between the camera and the star. In the sample project it takes a static direction of forward from a directional light positioned inside the planet itself. If you move this light around, ie up or down during test play the flare never moves. I’m totally at a loss here.

If you would be willing to post your code Mr. Russian it would be an absolute life saver. I believe in your project you could fly around the planet etc… which is basically what I have in mind.

Do you mean like this?

http://space6000.com/blog.php/real-time-scenes/planets-real-time-scenes/earth-3d

For some reason when I visit your link it says it failed to update unity web player. I have updated to the latest version but still no go. Kinda strange.

I’m guessing though it’s basically what I have in mind. I have say a planet slowly orbiting a star, a station and a moon orbiting the planet. I click a “moon” button and my camera flies over to the moon and goes into orbit, if I click the “planet” button it makes that the new target and goes into orbit around that etc… The current example project I have found for this scattering works with the exception of the light source. My light source is at the origin (0,0,0) with everything orbiting it. It is a point light.

oh, I see, it is made with the beta 6 :frowning: sorry… you will have to wait a little bit to see it hopefully not too much.

Anyway the example is working great for me, why don’t you place the light far in the distance. Mine is at 5000 away (do not forget to set the camera distance to +5000 to see the sun)

Also something else, be carefull with the sphere collision as it may hide the sun (remove the collision or make it smaller than the planet)

It should work.

Not sure we are on the same page here…

I was messing around with the project that PRD posted which was very kind of him. The light source is inside the sphere in that project, everything is located at 0,0,0. When I move the light source far away nothing changes in the scene.

The reason I would like to use a point light source is I want the planet to hide the sun when the camera passes behind it. With the directional light it doesn’t seem to do this so the sun shines through the planet.

Nikko did you set yours up from scratch or did you go off of PRD’s example too? I’m wondering if there is two different implementations going on here and if so what is the difference.