OGRE: Earth project containing several shaders

Share your advanced PureBasic knowledge/code with the community.
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

OGRE: Earth project containing several shaders

Post by DarkDragon »

Hello,

I've done this quite a while ago, when STARGATE and Artus (those guys) asked me for help. I've updated it, so it works with PB 4.61 final now. It contains a shader for normal maps, specular maps and a fake atmospherical scattering (just the glow effect). The clouds are moving independently from the earth rotation. The images are modified versions of the blue marble and blue marble next generation project found at NASA visible earth (details inside readme.txt).

Screenshot:
Image

Download:
http://www.bradan.eu/files/OGREEarthmapping.zip

It also contains a sourcecode for generating the normal map out of the topology map.

For porting it to PB 5.0 you may need to remove the node-type parameter (the last one) in those two lines:

Code: Select all

    AttachNodeObject(0, EntityID(0), #PB_Node_Entity)
    AttachNodeObject(0, EntityID(1), #PB_Node_Entity)
bye,
Daniel
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 796
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: OGRE: Earth project containing several shaders

Post by Zebuddi123 »

Hi DarkDragon Well i think that looks amazing turned it into my screen saver allready really really good !!!. one point i have noticed that the land depth wise is where the clouds should be that's what it looks like to me

ive had a look through the code to see if i could adjust it but i got say i aint got a clue with how all this kind stuff is put together but you've started that little itch. I tried renaming clouds.png to texture.png and visa versa but that looked ok but lost the depth as i assume the the depth param or something needs changing.


But Really great, thank you.

Zebuddi. :P
malleo, caput, bang. Ego, comprehendunt in tempore
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: OGRE: Earth project containing several shaders

Post by DarkDragon »

Thank you for your answer.
Zebuddi123 wrote:one point i have noticed that the land depth wise is where the clouds should be that's what it looks like to me

ive had a look through the code to see if i could adjust it but i got say i aint got a clue with how all this kind stuff is put together but you've started that little itch. I tried renaming clouds.png to texture.png and visa versa but that looked ok but lost the depth as i assume the the depth param or something needs changing.
I don't think I've understood you completely. You want to control the cloud height over the earth? Have a look into the file "data/Earth.material" with a text editor. There you search the "pass"-block with the comment "For the clouds" right before. It should look like this:

Code: Select all

      // For the clouds
      pass
      {
         depth_write off
         depth_func less_equal
         depth_bias 0.1
         scene_blend alpha_blend
         lighting on
         iteration once_per_light
         
         vertex_program_ref hemisphereVS
         {
           param_named      hemisphereScale    float                 1.025
         }

         fragment_program_ref cloudPhongPS
         {
         }

         texture_unit
         {
           scroll_anim -0.01 0
           texture clouds.png -1
           filtering anisotropic
           max_anisotropy 16
         }
      }
And there you can specify a different hemisphereScale. Replace the 1.025 by 1.5 and the clouds are outside the atmosphere, replace it by 1.0 and they are flat on the earth. Smaller than 1.0 would mean inside the earth :P . You could also specify the cloud speed in the line starting with "scroll_anim".

And well, the earth itself just has a fake depth. The lighting is calculated for mountains with different orientation than the flatlands. That's all.
bye,
Daniel
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 796
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: OGRE: Earth project containing several shaders

Post by Zebuddi123 »

Thanks DarkDragon you`ve definitely got me interested in this, and i`ve got a free copy of Autodesk 3ds Max Design 2013 to have a play with from searching for information about 3d rendering and 3d game engines etc

anyone interested

http://students.autodesk.com/

Zebuddi. :D
malleo, caput, bang. Ego, comprehendunt in tempore
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: OGRE: Earth project containing several shaders

Post by applePi »

thanks DarkDragon for the beautiful demo, and the clouds ... explanation. and thanks Zebuddi123 for the free Autodesk student editions links i will download a copy.
User avatar
[blendman]
Enthusiast
Enthusiast
Posts: 297
Joined: Thu Apr 07, 2011 1:14 pm
Location: 3 arks
Contact:

Re: OGRE: Earth project containing several shaders

Post by [blendman] »

great exemple !
Thank you very much !
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: OGRE: Earth project containing several shaders

Post by Fred »

Very good !
User avatar
zxtunes.com
Enthusiast
Enthusiast
Posts: 375
Joined: Wed Apr 23, 2008 7:51 am
Location: Saint-Petersburg, Russia
Contact:

Re: OGRE: Earth project containing several shaders

Post by zxtunes.com »

Super!

which for me is particularly surprising all running smoothly and almost does not consume CPU.

perhaps it is time to reconsider its attitude to OGRE.
Post Reply