Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [GDK] - Cheap Atmosphere Effect

Author
Message
JoeOh
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 22nd Jun 2011 12:21 Edited at: 22nd Jun 2011 12:21
Here is a little demo of what this simple technique can do if you want an atmosphere glare effect. The atmosphere glare is a simple round image of the glare (B_Atmosphere.png). I used the dbSetSphereMappingOn() function on a sphere slightly larger than the planet using the glare.

Granted, this is not a full-on atmospheric shader but it will do the trick if you don't get too close to the planet. The program allows you to zoom all the way in to see what I mean. Also, you can turn the effect on and off to see the difference. Don't forget you can pan around the planet to see the full impact on this "cheap" effect.

Maybe someone else has done this already but I haven't seen the post so far. Just puttin' in my 2 cents. Here's the GDK code below:



I hope whoever sees this finds this useful. Enjoy!

Home is where my souped-up computer is...

Attachments

Login to view attachments
JoeOh
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 22nd Jun 2011 12:24 Edited at: 22nd Jun 2011 12:25
Here's a screeny of this effect



Looks pretty no?

Home is where my souped-up computer is...

Attachments

Login to view attachments
JoeOh
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 26th Jun 2011 18:07
Has anyone actually tried this yet? I was hoping to get some feedback on this. I am actually working on to improve this shader-less effect as soon as I get some issues cleared up.

Home is where my souped-up computer is...
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 6th Jul 2011 01:26
It's pretty neat, but I'm wondering if it can be improved (performance wise), for instance not using lights (or lights with large ranges). You could in fact use a shadow mask for the planet. Same setup as a planet image chucked onto a sphere which is pointed in the direction of the sun.
JoeOh
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 6th Jul 2011 22:22
increase the performance? The sphere I used is rather detailed (30,60 columns and rows) and I'm using more than one sphere that is stacked. I'm sure if you lowered the rows/columns you'd get a boost on lower end systems. Also, this can work for much shorter light ranges.

I will upload an updated version of this demo very shortly. It has much more to play with to get the full feel of what this can do.

Home is where my souped-up computer is...
JoeOh
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 6th Jul 2011 22:45
This is a more flexible version of the original demo. This allows you to change the color of the atmosphere to ANY color you wish. It will also automatically increase/decrease the atmosphere glare and haze thickness.

For some reason dbSetSphereMappingOn() won't allow for gradual transparent fading with the dbSetAlphaMappingOn() function. So I have 10 small images that give the effect of changing the amount of atmosphere glare.

Also you can press 1, 2, 3 to change the planet's texture and cloud types.



Home is where my souped-up computer is...

Attachments

Login to view attachments
JoeOh
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 6th Jul 2011 23:11 Edited at: 6th Jul 2011 23:12
Here's another screenshot for this demo-



Home is where my souped-up computer is...

Attachments

Login to view attachments
noobnerd
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location:
Posted: 13th Jul 2011 00:08
looks great, thumb up! Is that part of an awesome spacegame? ( both thumbs up if it is)
JoeOh
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 13th Jul 2011 01:30
@noobnerds: may-beh

Home is where my souped-up computer is...
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 13th Jul 2011 10:30
Looks good. I tried the first version out. Ran well... simple trick, great result, but indeed may-beh not exactly the right way to go for. (performance wise)
Downloading the second version now...

JoeOh
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 14th Jul 2011 02:48
@Red Eye: is this supposed to run at 1000fps or something? The spheres used for the planet do use a 60/30 columns/row layout. The long distance lighting is to show for realistic distance. I'm sure there are ways to optimize.

I do get an frame-rate of 254fps when the planet is maxed out in my 1080p screen. how is everyone else doing when the planet size is maxed but not clipped on your chosen resolution.

Home is where my souped-up computer is...
SH4773R
14
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 23rd Jul 2011 23:00
Looks awesome

Login to post a reply

Server time is: 2024-04-12 22:00:01
Your offset time is: 2024-04-12 22:00:01