Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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#?

share|improve this question
3  
This will answer your first question: gamedev.stackexchange.com/questions/773/… –  Jonathan Hobbs Dec 30 '10 at 8:52
1  
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. –  The Communist Duck Dec 30 '10 at 16:46

2 Answers 2

up vote 1 down vote accepted

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

share|improve this answer
    
Thanks for the links i actually like the shading that's going on in that sky sphere a lot! –  Wade Jan 14 '11 at 20:16
    
@Wade: Are you writing the code in XNA 4.0? –  Neil Knight Jan 14 '11 at 20:40
    
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! –  Wade Jan 14 '11 at 20:47

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.