Home > SpaceSim > XNA Planet Custom Shader

XNA Planet Custom Shader

Well I’ve been working on making my planet shaders to be something a bit more colourful.

Day and Night

First of all I wanted to map two diffuse textures that are alpha blended depending on whether the planet’s side is in the Sun’s shadow or not.  When it is you’ll see the city lights twinkle on.

Atmosphere

Next I wanted to do some sort of atmospheric effect.  This was tricky and I’m still not absolutely happy with it – I think I need to read more on subsurface scattering.  Geometry-wise, it’s just a slightly larger sphere.  To shade it the atmospheric shell only renders when the surface normal is nearly perpendicular to the eye – in other words it only shades around the edges of the planet.  The dot product is raised to the 4th power or so to be used during the calculation for the alpha value.  The atmosphere is also emissive so as to illuminate when in shadow.

2010-12-18 vanquish planet atmosphere 1

2010-12-18 vanquish planet atmosphere 2

2010-12-18 vanquish planet atmosphere 3

2010-12-18 15-35 vanquish planet atmosphere

Advertisements
Categories: SpaceSim Tags: , , ,
  1. Andy
    2011/03/29 at 2:53 pm

    Hey,
    I was wondering if you had the .fx file for this that I could look through, learning shaders and I really like the atmospheric shell.

    Thanks,
    Andy

    Like

    • MickyD
      2011/03/29 at 3:37 pm

      not at this time no sorry

      Like

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: