GLSL atmosphere

Edit:

Files are now hosted properly. Go to
http://bjgil.totallyrecalled.net

The first (and only) article on the front page has both the Java and Win32 versions attached. Hopefully it will work this time.

Hi all,

I saw a post over at gamedev.net
(http://www.gamedev.net/community/forums/topic.asp?topic_id=495465)
about computing atmosphere lookup tables.

I decided it would be much improved if the C code that he released was running in Java :P.

So, here it is. Nearly everything is done in shaders so and it uses 8 texture units. There is also a slight problem I found when running this on my laptop. In inscatterS.glsl I have commented out a line that causes a very nasty crash where the laptop’s display driver stops responding. The same thing happened with the C version so its probably a driver problem. The same shader code worked fine on my desktop. So… you can pop that line back in if you think your gfx card driver is bug free.

If the link/download is broken, send me a PM and i’ll email you the zip, its only ~90k.

Controls:
left-mouse to move the sun
shift + left-mouse to rotate the earth
ctrl + left-mouse to rotate the scene
up and down arrows to change altitude

Cheers,
Brett

I was unable to get it to work. When I ran it (Mac OX X 10.4.11, geforce 8600 mobile), it originally failed to compile the vertex shaders because common.glsl was using gl_FragCoord, which the compiler thought only existed in a fragment shader. When I defined those lines to only be present in a fragment shader, things would compile, but I would only get a black screen. I also checked to see if I have the geometry shader extension, and I do, so I’m not sure what’s going wrong.

Any insight would be appreciated since I would like to view the demo.

If its the shaders going wrong then I’m not really sure I can help. They’re just pulled straight from the demo code zip. It could just be that it need some specific gfx card feature that both machines I’ve run it on just happen to have by chance (laptop 9500M, desktop 8800GTS).

Although from my experience running it on the laptop, and you using a mobile gfx card too, and both of us getting problems, I’m leaning towards it being a mobile gfx card/driver problem.

If you’re desperate to see what it looks like I also got the C version compiled (for Windows). I could bundle it up with all the DLLs and send it to you. It does look slightly better too since the TIFF of the earth in the demo has a proper reflectance value while the JPG from the Java version just has uniform reflectance on land and sea.

Cheers,
Brett

I can’t download it from FileFront, not yesterday nor today. Can you upload it somewhere else? Native build would be also interesting.

Files are now hosted properly, see first post for link