Русский

Site menu
Login form

Search
Donate
Our poll
What would you most like to see in the next version of SpaceEngine?
Total answers: 47913
Statistics


Now on site:
Total online: 29
Guests: 24
Users: 5

Today visited:

Blog

Main » 2012 » November » 11 » Real-time secondary lighting color
14:39
Real-time secondary lighting color
As you've probably noticed, SE doesn't take into account the color of the planet when it calculates the illumination of moons, and vice versa (except for real planets - planet script have the parameter 'Color' for this purpose). Now I've fixed this. The method is very tricky. Analytic calculation of color of the planet is almost impossible - it should take into account the color table used for the surface texture generation, clouds and water coverage, and atmosphere color. So I made things easier - I just render a planet into a small texture (viewed from sun, so it's at full phase), then it read this texture back to CPU and sums up all pixels to calculate average color. This gives the true color of the planet taking into account all its features - real surface texture, clouds pattern, atmosphere and even rings!

This procedure is fast enough, so it even can be used for real-time update of a planet's color. I've implemented several settings - compute color once, when planet first comes into view of field, update color every half second, and disable updating color. In the real-time updating mode, the effect fixes full eclipse issues - when the moon is in the shadow of the planet, it does not illuminate the planet.

Another thing is the distance from which the color should be calculated. Now we should be able to approach the planet to see its disk. After that, if you leave the planet, its star-like particle will have a proper color. It is possible to calculate the color of every object from any distance, but this may hit performance, because there are hundreds of objects in a typical planetary system. It is also possible to calculate a color for every body when a planetary system is being generated, but this also will increase the generation time.

Here are the screenshots showing the same scene, before and after a planet's color calculation (view it at full size). The first two are a view on a blue gas giant from its moon, and the next two are from far away, where it looks like a star (note the color of some small yellow moon near the gas giant):









In the real-time updating mode, the effect fixes full eclipse issues - when the moon is in the shadow of the planet, it does not illuminate the planet. However, I should solve this issue analytically, by upgrading the eclipse code.
Views: 465 | Added by: SpaceEngineer | Rating: 5.0/1
Total comments: 0
Only registered users can add comments.
[ Registration | Login ]