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.

In Minecraft, the sunset looks really beautiful and I've always wanted to know how they do it.

Do they use several skyboxes rendered over eachother? That is, one for the sky (which can turn dark and light depending on the time of the day), one for the sun and moon, and one for the orange horizon effect?

I was hoping someone could enlighten me... I wish I could enter wireframe or something like that but as far as I know that is not possible.

enter image description here

share|improve this question
    
I suppose it uses distance from the sun and height above horizon as parameters to change the color that's rendered. But I'm only guessing. –  Christian Oct 16 '12 at 10:39
    
So would that mean they could use a static giant sphere with a custom shader attached to it? –  Nick Oct 16 '12 at 10:41
    
@Christian It would be far easier to let an in-game timer determine the skybox parameters. The sun position is locked to the current time( in game). And everything else(sky color etc) is gradually calculated from it. At least that's how I imagine it. –  Sidar Oct 16 '12 at 10:44
1  
You don't actually need to know how they did it, I assume? You may want to edit your question to ask how you can achieve a similar effect. Since you probably just want to do the same thing, not know how they did theirs. –  Byte56 Oct 16 '12 at 14:38
2  
This question can't be answered reasonably except by those with knowledge of the code and is generally considered off-topic. You should edit your question to be about obtaining a similar effect. –  Josh Petrie Oct 16 '12 at 15:30

1 Answer 1

up vote 9 down vote accepted

I'm going to gamble on the fact that you really want to know how to achieve a similar effect, and not specifically how Minecraft does it, which wouldn't be an on-topic question.

Do they use several skyboxes rendered over eachother? That is, one for the sky (which can turn dark and light depending on the time of the day), one for the sun and moon, and one for the orange horizon effect?

You don't need that much geometry -- a single skybox and some geometry for the sun/moon is sufficient. Skyboxes are generally rendered in such a fashion as to ensure they are always the same distance from the eye, thus giving them the "infinitely far away" effect. The same thing can be applied to the geometry for the sun and moon, except you'll also want to transform the sun and moon by some global time value.

That same global time value feeds in to the skybox effect, which can be done with a shader that modulates between day and night textures (or just colors if you want to be simple) based on the time.

To get the "orange glow" on the horizon you'll want to also modulate in some vertex (or pixel) colors on the textures. Atmospheric scattering and perspective play a large part in determining these effects in the real world, and several papers exist presenting various ways of simulating those variables in software. The paper A Practical Analytical Model for Daylight is one I've personally used and implemented (dead image links there, you'll want to make sure you get the PDF on the linked site).

The Virtual Terrain Project has a section of curated links to relevant papers as well.

share|improve this answer
    
Thank you, I indeed want to implement a similar effect. Those links are very helpful! –  Nick Oct 16 '12 at 20:33

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.