Page 2 of 3

Re: Planetshine

Posted: 01.04.2008, 22:53
by chris
Cross-posted from the developers list

Here's a rather large patch against the current SVN version of Celestia that implements secondary illumination:

http://www.celestiaproject.net/~claurel/celest ... hine.patch

Problems have been reported with the patch file; you may want to use this zip archive with all the changed files instead:

http://www.celestiaproject.net/~claurel/celest ... tshine.zip

For testing purposes only, planetshine can be toggled on and off with Ctrl+X (antialias lines.) This toggle will be removed before the code is committed to SVN.

The patch includes a significant cleanup and streamlining of
Celestia's lighting code; it simply wasn't practical to implement
secondary illumination /without/ this cleanup. The performance
benefits from this cleanup should more than compensate for the extra
computation required for secondary lighting.

I've worked hard to make Celestia's implementation of secondary
illumination both fast and general. Secondary illumination can come
from objects that aren't in the same 'system'. Thus the Cassini
spacecraft can be lit by light reflected from Earth, Venus, Jupiter,
Saturn, or any of Saturn's moons even though its orbit is defined
relative to the Sun. This is different how eclipse shadows work:
they're currently only computed for objects in the same system, and so
Cassini will never be eclipsed by Saturn (at least, not until a
subsequent patch addresses the limitation.)

Both reflector phase and reflector-to-receiver distance are accounted
for in the calculation of secondary illumination. There are two ways
in which distance affects the amount of light reaching the receiver:
obviously, the received energy falls off with 1/distance^2. But, the
distance also affects what part of the reflecting object is visible to
the receiver. An object in low Earth orbit like ISS sees only a small
fraction of the Earth's surface at one time, thus using something like
a simple (1+cos(phase))/2 correction to the amount of reflected light
will produce noticeably wrong lighting. The code in the patch uses a
more sophisticated approach that is still an approximation but gives
correct looking results in all cases.

Some limitations:
- All reflecting objects are treated as spheres
- Spacecraft, components, and surface features don't reflect light;
this was done in order to avoid terrible slowdowns with add-ons like
Selden's Hale telescope that have complex assemblies of small models.
And with a mass of irregular objects, the lighting wouldn't be correct
anyway.
- Only the brightest secondary illuminator is considered. This is easy
to fix, but at the expense of performance. It's probably not
worthwhile until HDR support lets us see the effects of very faint
light sources.
- You'll note that Earthshine isn't visible on the Moon; there's an
adjustable 'gamma' setting that would make it visible. Right now, it's
set so that secondary illumination will be visible when it is at least
10^-4 times as bright as the primary illumination. Earthshine on the
Moon is just barely under the cutoff. This gamma value can be
modified, but at the expense of underemphasizing light intensity
differences between more similar light sources. My feeling is that we
should wait for HDR rendering to be more developed before playing with
this value too much.

The best places to see planetshine are spacecraft in low orbits or
doing low-altitude fly-bys. The Martian satellites and inner moons of
the giant planets also show off the effect nicely.

One other thing that this patch addresses is orbit visibility for
barycenters. People often complain that the orbit of Pluto is no
longer visible now that it's defined as relative to the Pluto-Charon
barycenter rather than the Sun. In the process of implementing
secondary lighting, I had to introduce an 'object type' mask for frame
tree nodes. The mask contains the types of all objects that are
children of the node. With a small change to the orbit code, the mask
is used to render the orbit of a barycenter when planets or moons
orbit it.

Re: Planetshine

Posted: 02.04.2008, 09:31
by cartrite
I've built the planetshine with and without hdr enabled. I've been testing the ISS model and do notice a nice shine on the dark side of the model when it is over the day side of earth. It is also interesting to see the change over when the model is at the point where it is about to go to the darkside of the earth and is still in view of the setting sun.
But with hdr enabled, there is hardly any shine at all. When I toggle "ctrl-x", I can see a slight difference to show that it is working. But it is hard to tell the difference.
cartrite

Re: Planetshine

Posted: 02.04.2008, 17:31
by buggs_moran
Chris wrote:Spacecraft, components, and surface features don't reflect light;
this was done in order to avoid terrible slowdowns with add-ons like
Selden's Hale telescope that have complex assemblies of small models.
And with a mass of irregular objects, the lighting wouldn't be correct
anyway.

I know this would probably be a hassle, but why not have the ability to switch
reflective like emmisive, and like emmisive, have the default be false?

Re: Planetshine

Posted: 02.04.2008, 18:10
by chris
buggs_moran wrote:
Chris wrote:Spacecraft, components, and surface features don't reflect light;
this was done in order to avoid terrible slowdowns with add-ons like
Selden's Hale telescope that have complex assemblies of small models.
And with a mass of irregular objects, the lighting wouldn't be correct
anyway.

I know this would probably be a hassle, but why not have the ability to switch
reflective like emmisive, and like emmisive, have the default be false?

It's not that much of a hassle: anticipating that people might want to override the default, the reflectivity is controlled by a flag on the object. That flag is set automatically based on the object's class when it is read from an ssc file. It would be easy to add a boolean property for ssc objects. Is there any particular reason why want this?

--Chris

Re: Planetshine

Posted: 02.04.2008, 18:30
by buggs_moran
I know it's not exactly a reflection per se, but the effect might be neat on glass or metal objects
like the stations solar panels.

Also, Selden could, if he wished, just have the dome and outer building be reflective, not all the parts.
However, would planetshine effect a surface object, unless we are talking increased albedo above
snow covered areas...

Reflectivity on and emmisive off may give interesting effects as well.

Re: Planetshine

Posted: 03.04.2008, 17:16
by chris
The planetshine changes have now been checked into SVN (revision 4237).

--Chris

Re: Planetshine

Posted: 03.04.2008, 19:34
by ElChristou
chris wrote:The planetshine changes have now been checked into SVN (revision 4237).

Just tested and it's just... E x c e l l e n t !

Even Voyager which is quite dark get some smooth lighting during the approach of planets... The shuttle also become much more realistic... If one day we implement shadows, Celestia will be really sublime...

Bravo Chris!

Re: Planetshine

Posted: 03.04.2008, 20:05
by Cham
I already found a bug !

The planet shine doesn't work if Celestia's antialiasing is OFF. I'm getting the planet illumination only if I check ON the antialiasing in the preferences. This is bad, since I'm already using FSAA from my video card.

Re: Planetshine

Posted: 03.04.2008, 20:06
by chris
Cham wrote:I already found a bug !

The planet shine doesn't work if Celestia's antialiasing is OFF. I'm getting the planet illumination only if I check ON the antialiasing in the preferences. This is bad, since I'm already using FSAA from my video card.

Sorry--this was some debugging code that should not have made it into SVN. Ctrl+x toggled planetshine on and off to make it easy to compare what could sometimes be a very subtle lighting effect.

--Chris

Re: Planetshine

Posted: 04.04.2008, 01:57
by fsgregs
Chris or anyone:

Is there any Windows compiled version of this planetshine upgrade to Celestia 1.5.0 available yet? I've accessed CVS and found only the January/08 release of Celestia 1.5.0 final for Windows on it. Am I looking in the wrong place??

Frank

Re: Planetshine

Posted: 04.04.2008, 02:44
by chris
fsgregs wrote:Chris or anyone:

Is there any Windows compiled version of this planetshine upgrade to Celestia 1.5.0 available yet? I've accessed CVS and found only the January/08 release of Celestia 1.5.0 final for Windows on it. Am I looking in the wrong place??

Frank

Celestia is using SVN (Subversion) instead of CVS for source control. But, if you're looking for a compiled version of Celestia, that's probably not what you want anyway. Both cartrite and phoenix regularly build the Windows version of Celestia from SVN and make the files available for download:

http://cartrite.myhosting247.com/index.html
http://www.purebytes.de/stuff/celestia/

It doesn't look like either build has been updated with the planetshine change, but I'm sure it won't be long. I can make a build for you tomorrow if cartrite or phoenix don't beat me to it.

--Chris

Re: Planetshine

Posted: 04.04.2008, 06:54
by steffens
chris wrote:Sorry--this was some debugging code that should not have made it into SVN. Ctrl+x toggled planetshine on and off to make it easy to compare what could sometimes be a very subtle lighting effect.
Will planetshine be enabled by default, a rendering option or a keyboard toggle?

These screenshots look spectacular! Looking forward to the weekend, I hope I will have some time to play with this!

steffens

Re: Planetshine

Posted: 04.04.2008, 08:10
by volcanopele
chris wrote:It doesn't look like either build has been updated with the planetshine change, but I'm sure it won't be long. I can make a build for you tomorrow if cartrite or phoenix don't beat me to it.
Sounds great, Chris! Now I want to see if NH can catch some Charon-shine on Pluto.

Re: Planetshine

Posted: 04.04.2008, 10:08
by cartrite
My website now contains svn r4239 which should include the planetshine feature.
cartrite

Re: Planetshine

Posted: 04.04.2008, 13:08
by fsgregs
Thanks for posting the Windows exe files. I just cannot believe it! Celestia just keeps getting better and better. Planetshine is spectacular.

Pretty soon, there will be Astronauts waving from the windows of the Shuttle :D

Here are screenshots of the 2001 space station viewed from two different angles. Unbelievably realistic!!!! WOW!
SS1.jpg
SS2.jpg

Re: Planetshine

Posted: 04.04.2008, 18:16
by CAP-Team
Hmm well I've downloaded Cartrite's version, but planetshine doesn't seem to work.
I always have Ambient ligt set to none, but the Enceladus scene Chris posted is not like the picture he posted, the dark side of Enceladus is still black.

Re: Planetshine

Posted: 04.04.2008, 18:21
by chris
CAP-Team wrote:Hmm well I've downloaded Cartrite's version, but planetshine doesn't seem to work.
I always have Ambient ligt set to none, but the Enceladus scene Chris posted is not like the picture he posted, the dark side of Enceladus is still black.

It works fine for me, though the planetshine on Enceladus is rather subtle. Try looking at a moon closer to Saturn or at a spacecraft in low Earth orbit such as Hubble.

--Chris

Re: Planetshine

Posted: 04.04.2008, 21:51
by CAP-Team
Funny, it's working now :) (I tried mimas, and then Enceladus), and Hubble works now, too.

I do have noticed that there's a weird behaviour of an addon that works fine in 1.5.0 but with every new SVN version gives a weird effect:

saturn.jpg


The addon uses a cloud map, which isn't rendered correctly.

Re: Planetshine

Posted: 04.04.2008, 22:47
by Cham
CAP-Team wrote:Funny, it's working now :) (I tried mimas, and then Enceladus), and Hubble works now, too.

I do have noticed that there's a weird behaviour of an addon that works fine in 1.5.0 but with every new SVN version gives a weird effect:

saturn.jpg


The addon uses a cloud map, which isn't rendered correctly.

I believe this is the result of cloud shadows on gas giants. I already talked to Chris about this before. The cloud shadows shouldn't be turned ON in the case of gas giants.

Re: Planetshine

Posted: 05.04.2008, 09:25
by CAP-Team
I've tested this, turning cloud shadows off while viewing Saturn corrects the image; the weird clouds are gone.