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 / Planet Atmosphere Shader

Author
Message
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 10th Sep 2008 09:33 Edited at: 10th Sep 2008 09:33
Attached is the project and the shader.

Found this shader in 3DGS wiki, looks quite good but needs a shader guru's touch.

This is as far as i could implement it to DBPro within a limited time.

There is always one more imbecile than you counted on.

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Sep 2008 15:30
Just had a quick look, but a few things caught my eye:

1. Why are the values of "vecSkill1" so huge? For example, your object is only 100 units in size, yet your shader makes the atmosphere an additional 10000 units in size (= vecSkill1.x*5 = 2000 *5 in the shader). Think carefully about what each value actually represents. Don't forget that colour values should be in the range 0 to 1 in shader code - values outside that range will get clamped to that range when passed to a colour variable.

2. Some of your normals have been normalized using all four coords of a vector - you need only the XYZ coords in that calculation.

3. One "return" statement seems out of place.

4. You might get less "faceting" if you put the non-linear lighting calculations into the pixel shader.

But you have got a working shader to start from which is good news - and you do get an "atmosphere" once the values have been tweaked a bit.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 11th Sep 2008 17:37
Mr.Green, actually i spent only 10 minutes or so, to test this shader. Have i mentioned i didnt write it? I grapped it out of 3d game studio wiki and there are some more useful ones there if you wanna check out.

Actually i was just fishing if you or some other shader guru would like to tweak this shader to actually make it work.

well, can you?

There is always one more imbecile than you counted on.
Bad Monkey
17
Years of Service
User Offline
Joined: 1st Jan 2007
Location:
Posted: 11th Sep 2008 20:05
GiMMEee Tehh COdeZZZ1!!!1!!!!


Visit my website:
http://www.artistsareus.com
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Sep 2008 20:30
Quote: "GiMMEee Tehh COdeZZZ1!!!1!!!!"


Indeed.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 12th Sep 2008 09:25
So what, its for mutual benefit.

And what is wrong with gimme the codez anyways? you give me the codez today, and ill give you some other codez tomorrow. This is how things work.

There is always one more imbecile than you counted on.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Sep 2008 12:25
Quote: "well, can you?"


Possibly.

It would help though if you described what you expect to see - or had a screenshot of a working version from another application.

But you could try spending more than 10 minutes on it yourself.

Quote: "you give me the codez today, and ill give you some other codez tomorrow. This is how things work"


That is true.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 12th Sep 2008 14:58
I just want Atmospheric Scattering, the halo around the planet, and when you look at it from the side i want to see the light side also has a shiny atmosphere but dark side does not.

like these:
[img]http://nis-lab.is.s.u-tokyo.ac.jp/~nis/abs_sig.html#sig93[/img]





And in order to help you with this quest, i found this nvidia article about atmospheric scattering which also has a sample shader too.

http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html

There is always one more imbecile than you counted on.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Sep 2008 17:23
Nice. Something to aim for.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Sep 2008 00:42
Quote: "Found this shader in 3DGS wiki, looks quite good"


Just had a closer look at that shader. It's a mess.

Could you provide the original link? I can't believe the one you posted is a good working shader. It would be far easier to develop one from scratch using one of the many web pages as a guide - Google "atmosphere shader" perhaps?
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 13th Sep 2008 10:09 Edited at: 13th Sep 2008 10:15
Quote: "Just had a closer look at that shader. It's a mess. "

Well, i take that as a compliment

Quote: "I can't believe the one you posted is a good working shader."

Another well spotted compliment i take

Below is the 3dgs shaders list, just scroll down to the bottom of DX9 Shaders / Model Rendering and there you will see a small screen shot and the link to the original shader.

http://www.coniserver.net/wiki/index.php/Shaders

NOTE: While you are in there, could you check out the DREAM and SECURITY CAMERA shaders too? Thank you for the generous helping mister.

There is always one more imbecile than you counted on.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Sep 2008 15:10
Quote: "Mr.Green, actually i spent only 10 minutes or so, to test this shader. Have i mentioned i didnt write it?"


Quote: "Quote: "Just had a closer look at that shader. It's a mess. "
Well, i take that as a compliment


Quote: "I can't believe the one you posted is a good working shader."
Another well spotted compliment i take "


You must have done a lot to it in those 10 minutes.

Thanks for the links, I'll take a look.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 16th Sep 2008 13:37
Any Progress?

There is always one more imbecile than you counted on.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Sep 2008 21:26
Oops.
Hoozer
17
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bremerhaven (Germany)
Posted: 16th Sep 2008 23:22
@ Green G.: I'm also curious to see what you (as one of the shader-masters here in the forum) can make out of it! It might end up as one of the best shaders (besides evolved's "standard-shaders") made for DB-Pro, if you can reach something like in the screen-shots!

Hoozer

AMD64X24800+(939);2GB;GF6800LE (@12PS, 6VS; 380 MHz, RAM: 434 MHz)
DP-Sw-Mode-Comp-Entry (updated to V. 1.4):
http://forum.thegamecreators.com/?m=forum_view&t=109846&b=5&p=0
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 18th Sep 2008 11:44
I had a bash at making a better atmosphere shader than the previous ones I used in my games, it doesn't simulate atmospheric scattering(yet) but it does calculate the atmospheric depth, or particle density across the atmosphere so when looking at shallow angles there's more fog depending on the distance through the atmosphere and the altitude of the samples. The example is attached, though I had to reduce the surface map size so the archive wasn't huge.



Attachments

Login to view attachments
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 18th Sep 2008 16:12
Thats awesome Dark Coder, thanks for the shader. It looks good.
Tough, the scattering part of the shader i posted above works somehow, maybe you could just implement that part to Your shader?

That would be awesome and complete.

There is always one more imbecile than you counted on.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Sep 2008 19:47
That looks sweet. Now include the HUUUUUUGE textures! lol

3700+ Athlon 64 - Geforce 7600 GS - 2GbDDR2 RAM - 40Gb Hdd (In this pc) - Windows Vista Ultimate (x86)
Hoozer
17
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bremerhaven (Germany)
Posted: 18th Sep 2008 23:39
@ dark coder: Your example looks really extremely good! (I like the effect when you enter the atmosphere and the darkness of the space gets replaced by the blue sky!) Now only displacement-mapping with a high resolution texture is missing and you would get an absolute nice copy of the earth (or any other planet)!

(As far as my knowledge goes displacement-mapping would deform the sphere according to the texture, correct me, if I'm wrong! And what I have read it is only available on DX-10-cards (or was it on DX-10.1?).)

Hoozer

AMD64X24800+(939);2GB;GF6800LE (@12PS, 6VS; 380 MHz, RAM: 434 MHz)
DP-Sw-Mode-Comp-Entry (updated to V. 1.4):
http://forum.thegamecreators.com/?m=forum_view&t=109846&b=5&p=0
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 19th Sep 2008 03:15 Edited at: 19th Sep 2008 03:16
Quote: "maybe you could just implement that part to Your shader?"


Well it's not as simple as copy and pasting a few lines :p, I'll have a look at implementing it eventually.

Quote: "That looks sweet. Now include the HUUUUUUGE textures! lol"


You can get them yourself, these are the ones I used for the pics:

http://www.celestiamotherlode.net/creators/donedwards/RealisticEarth-v4-4kDDS.zip
http://celestiamotherlode.net/creators/tjong/earthlights.zip

Or you can get other planet's ones from http://celestiamotherlode.net

Quote: "(As far as my knowledge goes displacement-mapping would deform the sphere according to the texture, correct me, if I'm wrong! And what I have read it is only available on DX-10-cards (or was it on DX-10.1?).)"


You can do texture lookup calls in the vertex shader using VS3.0, but I dunno if DBPro supports this as I've never tried. However it's better you do this on the CPU, you see mountains on a planet are incredibly tiny(on Earth at least) compared to its radius, so from a distance like in that pic I showed you likely wouldn't be able to notice any displacement features, only shadows caused by them at beast. It's only when you get really close to the surface would you actually see the mountains and things rising above the background, but in the example the sphere I use for the terrain is far too low low res to show these terrains. Because of this, you need to use some type of dynamic LOD system that subdivides parts of the planet as you get closer, such like the demo I entered into the recursion compo, adding displacement to that would be very simple as you only have to write your own texture sampling code. However I wrote that code using GDK as it's the kind of code that really requires OOP to be manageable, I wrote similar code in DBPro before but it was no way near as efficient.

Hoozer
17
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bremerhaven (Germany)
Posted: 19th Sep 2008 22:06
@ dark coder: I had a (fast) look into how to make a planet look like something realistic and I found a nice demo that had this type of LOD you described! I know that DB-Pro most possibly would be the wrong language to do such difficult thing. My skill isn't that good to do such things anyway regardless of the language used!
Here is the link to the demo (although it seems a bit old, it still looks impressive somehow!):
http://drtypo.free.fr/index.html

Here is also an article about real-time atmosphere rendering:
http://www.cescg.org/CESCG-2005/papers/Brno-Josth-Radovan/index.html#online

You might already know them or you might find them useful in some way!

Hoozer

AMD64X24800+(939);2GB;GF6800LE (@12PS, 6VS; 380 MHz, RAM: 434 MHz)
DP-Sw-Mode-Comp-Entry (updated to V. 1.4):
http://forum.thegamecreators.com/?m=forum_view&t=109846&b=5&p=0
Dark Fire
15
Years of Service
User Offline
Joined: 23rd Jun 2008
Location: In the code you write
Posted: 14th Oct 2008 20:46 Edited at: 14th Oct 2008 20:47
@CuCuMBeR - Wow, this is cool stuff! You could apply this to a sun and combine it with your sky shader.

Edit: Tried sky shader and it didn't work. It only textured half of the sky sphere. This was in an example I made. Would it have to do with the object I am using? What should I do?

Thanks,

Dark Fire

Login to post a reply

Server time is: 2024-05-02 00:21:16
Your offset time is: 2024-05-02 00:21:16