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.

DarkBASIC Professional Discussion / How to make the atmosphere around a planet?

Author
Message
The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 29th Apr 2010 00:28
Hi guyz,

I'm planning on making a space combat game, and I was wondering how to make the atmosphere around the planets. I added a larger GHOSTED sphere to simulate the atmosphere and that works when looking from a distance, but when I fly through the atmosphere, the ghosted object is no longer visible. So, I set a negative numbre to the size of the sphere, but now the lightning of the sphere is wrong (left becomes right, and vice versa).
So, how do I have to do this to get an atmosphere around my planets that is lit correctly?
Some tips or code would be greatly appreciated.

Thanks in advance.

Cheers

Slayer rules!!! Yeaaah, man!
Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 29th Apr 2010 01:08 Edited at: 29th Apr 2010 01:11
You might want to go over to http://www.starwraith.com/forum/index.php and ask Vice how he did things.. I'm pretty sure he used a method that sounds like yours for landing on planet and it was all one smooth transition.

He's done a lot of great stuff with DB / C++ together so if anyone could have good pointers it would be him.

Not to chaff anyone on this forum, he's just the first person I thought of when I read the question



Otherwise I'm not sure what "ghosted" means in this case.. But maybe you want something that can change its alpha? (transparency) of a particular color as you approach it and go "in to" the atmosphere..

Thebeely
21
Years of Service
User Offline
Joined: 4th May 2005
Location: Croatia
Posted: 29th Apr 2010 01:58 Edited at: 29th Apr 2010 01:59
Try "set object normals" after scaling it negative. Or rotate it somehow.

[edit] or just disable the lighting?
NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 29th Apr 2010 02:33
Green Gandalf did a shader for this somewhere on the forum.
Morcilla
23
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 29th Apr 2010 13:32
Quote: " when I fly through the atmosphere, the ghosted object is no longer visible."

Despite other more complex approaches, for your simple case you can turn on the object culling (set object cull obj_id, 0).
That will make the atmosphere visible on both sides (inner and outer).
If you don't want to have culling turned on all the time, then calculate the distance to the planet, and if it is minor than the atmosphere height (inside the atmosphere), turn culling on. And when the distance is greater than the atmosphere height (outside the atmosphere), turn culling off.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Apr 2010 14:17
Quote: "Green Gandalf did a shader for this somewhere on the forum."


Or was it Dark Coder?
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 29th Apr 2010 18:08
You could also maybe have a ghosted plain with a cloud-like texture on it attached to the camera - fading it in as you enter the atmosphere and out as you approach the surface.

TDK

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th Apr 2010 19:05
Make a plane with an image of a circle on the colour of the atmosphere. (The circle should be semitransparent, and fade to completely transparent at the edges)

Position this plane at the planet's position and point it at the camera each frame. When the player gets within a certain distance of the planet, gradually fade the backdrop colour to the atmosphere colour.

NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 29th Apr 2010 19:32
Quote: "Quote: "Green Gandalf did a shader for this somewhere on the forum."

Or was it Dark Coder? "


Hmmm...Ok I take that back....SOMEONE made a shader for that
The Slayer
Forum Vice President
16
Years of Service
User Offline
Joined: 9th Nov 2009
Playing: (Hide and) Seek and Destroy on my guitar!
Posted: 29th Apr 2010 20:22
Thanks guyz, for all the help!
I'm trying several things out now and see which method suits better.

@Neco:
I tried that link yesterday, but it somehow did'nt work. Today it did work, so I'll try contacting Vice and ask him how he did it. I was playing with the idea of giving the player the ability to land on planets aswell, so maybe he can help me out. Thanx.

@Thebeely:
Set object normals did'nt work. Thanks though.

Quote: "Green Gandalf did a shader for this "

Quote: "Or was it Dark Coder?"

Yep, it was Dark Coder.
I'll try that one out later.

@Green Gandalf:
In an other post, you made a fog shader that animated the fog, right? The fog moved horizontally. So, I was wondering, could it be possible to make a shader where the fog moves in a circular way, like around a planet, to simulate clouds for example?

@TDK:
Yeah, that's another possibility I could try out.

@Diggsey:
I'll try that out too. Maybe combine two methods and experiment till I get it like i wish.

Thanx again!

Cheers

Slayer rules!!! Yeaaah, man!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Apr 2010 02:16
Quote: "@Green Gandalf:
In an other post, you made a fog shader that animated the fog, right? The fog moved horizontally. So, I was wondering, could it be possible to make a shader where the fog moves in a circular way, like around a planet, to simulate clouds for example?"


Food for thought.

Should be possible - but I'm sure someone will beat me to it.

Login to post a reply

Server time is: 2026-07-26 04:27:34
Your offset time is: 2026-07-26 04:27:34