The home of Stainless
  • Starflight
    • Hacking
    • Remake
    • Archive
  • XNA
    • Planet generation >
      • Planets 1 Mercators
      • Planets 2 Bump maps
      • Planet 3 Ice worlds
      • Planets 4 Gas giants
      • Planets 5 Airless rocks
      • Planets 6 Molten planets
      • Planets 7 Bug fixes and improvements
      • Planets 8 Clouds
      • Planets 9 Atmospheric Scattering
      • Planets 10 Rings and stars
    • Remakes >
      • Ultima 4
      • World map
    • Facial Animation >
      • Importing the expressions
      • Loading the base mesh
      • Using the mesh
    • Spherical Harmonics >
      • GPU based
    • Sand
    • Alpha blending bug
  • Contracting
    • Clients
  • Blog
  • New Games
    • Onslaught
    • Towers
    • Two Towers
    • FOFT
    • Convoy
    • IL2 Mod tool >
      • Gallery
    • Downloads
  • Magic System
    • Genetic Magic
  • DevMaster Competition
  • Reality
    • Chapter 1
    • Chapter 2
    • Chapter 3
    • Chapter 4
    • Chapter 5
    • Part Two
    • Chapter 6

A hybrid approach for procedural planets

Part four - Gas giants
Picture
Gas giants are common. So we had better be able to add them to our universe.

However gas giants have no terrain, so how are we going to handle them?

If we use Jupiter as a base then we have to generate vortices and cloud patterns which are very stable. The big red spot on Jupiter has been pretty stable for at least 300 years. So how are we going to do it?

Well this is where my choice of simplex noise pays dividends. Simplex noise naturally produces swirling patterns, if you look closely at the water planet you may be able to make out some large ones. So all we have to do is play with the pixel shader.

As we did with the ice planet, add a new class GasGiant and copy the code from WaterPlanet. Copy the shader and rename it GasGiant.fx. Then change the pixel shader to this

 
float4 PixelShaderFunction(VS_OUT input) : COLOR0
{
	
    float res=snoise(input.WP*6);
    float3 dr = float3(2,res+10,2);
    float h = snoise(input.WP*dr);
    float4 texCol = float4(h,h,h,1);
    return texCol;
}
Simple piece of shader code isn't it?

Add a new texture, again have a play with this later so you get a result you like, but this is the one I am using.


Picture
Compile it up and you should end up with this.
Picture
Yuck. The bump mapping is causing problems. 
Never fear planning ahead has given us an easy fix. 
Change Nz to a large number, I use 12800, and you will get a much nicer result.

Picture
Well that will do for gas giants. 
Next on the list is airless rocks. 

Stay tuned for the next exciting episode.
part4.zip
File Size: 44 kb
File Type: zip
Download File

Powered by Create your own unique website with customizable templates.