4
\$\begingroup\$

I have been banging my head against the wall trying to get a sky sphere to work appropriately in XNA 4.0. I have the sphere loading correctly, and even textured, but i would like something a little more dynamic that can support a day/night cycle.

My issue is that, while i know a good amount of C# and XNA, i know next to nothing about HLSL. (I could make an ambient light shader if my life depended on it...) I also have not been able to find a tutorial on how to build a sky sphere like this. Of course i don't expect to be able to make an amazing one right off the bat, i would like to start small, with a dynamic coloring sky i'll work out the clouds and sun later.

My first question: Does anyone know of any good tutorial sites that could help me get a decent grasp around HLSL?

Second: Does anyone have a good example of or know where to find one of a gradient sky using XNA and C#?

\$\endgroup\$
2
  • 3
    \$\begingroup\$ This will answer your first question: gamedev.stackexchange.com/questions/773/… \$\endgroup\$ Commented Dec 30, 2010 at 8:52
  • 1
    \$\begingroup\$ I would separate your questions into just asking the latter. The first already has an exact duplicate, and try to keep one point-per-question. \$\endgroup\$ Commented Dec 30, 2010 at 16:46

2 Answers 2

1
\$\begingroup\$

You can get a Skysphere here. I have managed to convert it and you can see it working here.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks for the links i actually like the shading that's going on in that sky sphere a lot! \$\endgroup\$
    – Wade
    Commented Jan 14, 2011 at 20:16
  • \$\begingroup\$ @Wade: Are you writing the code in XNA 4.0? \$\endgroup\$ Commented Jan 14, 2011 at 20:40
  • \$\begingroup\$ Yeah i am however, i was able to convert the project up to 4.0 and VS2010 with only minor issues. It's working great i think you've pretty much answered my questions here! Thanks! \$\endgroup\$
    – Wade
    Commented Jan 14, 2011 at 20:47
1
\$\begingroup\$

I had to do one of these. Easiest method is to texture the sphere (make sure the normals are facing inward, otherwise you won't be able to see it). Then if you want clouds n' the like, just move another texture over it in a shader (there's a good number of fairly easy HLSL tutorials out there. Others have recommended some, I would recommend Riemers even if it's not specifically skysphere related as a good starting point)

If you want a day/night cycle, it's heavily going to be influenced just by the lighting you cast on the rest of your scene. However, if the lights in the sky are looking kinda flat, make a second texture that just has the light sources in white (intensity = whiteness) then do an additive blend based on how much you want them to light up.

In any case, good luck. Wanting a skysphere is something that drove me into getting a lot more involved with shaders. It won't be too scary once you start digging into it.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .