XNA Meeting Point
  • Home
  • English
    • FAQ
    • Site Architecture
    • Who we are
    • Contact Us
    • XNA Tutorials
    • XNA-inspired technology>
      • MonoGame Tutorials
    • Game Development
    • Math
    • Physics
    • Computer Science>
      • Programming
      • Data Transmission
      • Hardware
    • Useful Links
    • Ressources
    • Community Spotlight
    • Game Renders
    • News Blog
  • Français
    • FAQ
    • Plan du site
    • Qui sommes-nous ?
    • Contactez-nous
    • Tutoriaux XNA
    • Technos inspirées de XNA>
      • Tutoriaux MonoGame
    • Développement de jeux
    • Maths
    • Physique
    • Informatique générale>
      • Programmation
      • Transmission de données
      • Hardware (machine)
    • Liens utiles
    • Ressources
    • Community Spotlight
    • Captures d'écran
    • Nouveautés / Blog
  • Español
    • FAQ
    • Estructura del sitio
    • ¿Quiénes somos?
    • Contactarnos
    • Tutoriales XNA
    • Desarrollo de videojuegos
    • "Links" utiles
    • Recursos
    • Community Spotlight
    • Capturas de pantalla
    • Actualidad / Blog
  • Search
  • Tutorial Contests
    • XTC 2010
  • XN'net
    • English
    • Français
    • Español
  • YouTube
  • About me
    • School Projects>
      • Numerical Analysis (Python)
      • C Programming
      • Lisp Programming
      • Presentations
    • GCC Projects>
      • GCC Presentations
    • Pollen Hunt
  • RSS
    • XNA News!
    • Other Projects

Hybrid approach for procedural planets
Part IV - Gas giants

by Stainless
author's website
Photo
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 natural 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 nes 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.
Photo
Compile it up and you should end up with this.
Photo
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.
Photo
Well that will do for gas giants. Next on the list is airless rocks. Stay tuned for the next exciting episode.
 
Oh, yes, sorry, zip here.

Next part of the tutorial
Powered by
✕