Advanced lighting?

The place to discuss creating, porting and modifying Celestia's source code.
Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #21by dirkpitt » 16.10.2007, 06:58

I've recently experimented with bringing HDR to Celestia.
My version does NOT use shaders. It runs even in the Basic render path.
However dynamic range is only 2x.

Here's what a star looks like before:
Image

After:
Image

Venus:
Image

Technical details:
- Does not use float buffers, scene is stored compressed 2x in a regular 8bpp RGBA texture so antialiasing, alpha blending comes for free
(but dynamic range is not very high, also there will be mach banding etc but texture mapping tends to hide this...)
- Uses glCopyTexImage2D and blending instead of FBO and shaders etc so backward compatibility is very high
(ought to work 100% even on a Geforce 4MX)
Speed can be slow, but on my 9700 it's much faster than ATI's simple HDR demo (which uses float buffers)
- "Tone mapping" is very simplistic, stars are not handled so no star fading yet
- Model and bump mapping illumination currently incorrect

Citations:
"Practical Implementation of SH Lighting and HDR Rendering on PlayStation 2"
Yoshiharu Gotanda, Tatsuya Shoji, 2005.

srosenow_98
Posts: 18
Joined: 18.07.2007
With us: 17 years 4 months
Location: Shelton, Washington

Post #22by srosenow_98 » 16.10.2007, 09:25

dirkpitt wrote:I've recently experimented with bringing HDR to Celestia.
My version does NOT use shaders. It runs even in the Basic render path.
However dynamic range is only 2x.

Here's what a star looks like before:
Image

After:
Image

Venus:
Image

Technical details:
- Does not use float buffers, scene is stored compressed 2x in a regular 8bpp RGBA texture so antialiasing, alpha blending comes for free
(but dynamic range is not very high, also there will be mach banding etc but texture mapping tends to hide this...)
- Uses glCopyTexImage2D and blending instead of FBO and shaders etc so backward compatibility is very high
(ought to work 100% even on a Geforce 4MX)
Speed can be slow, but on my 9700 it's much faster than ATI's simple HDR demo (which uses float buffers)
- "Tone mapping" is very simplistic, stars are not handled so no star fading yet
- Model and bump mapping illumination currently incorrect

Citations:
"Practical Implementation of SH Lighting and HDR Rendering on PlayStation 2"
Yoshiharu Gotanda, Tatsuya Shoji, 2005.


Oh my GOD! Please say that rendering will make it to Celestia 1.5.0's official release! That star rendering looks fantastic! Very realistic!

And for the Venus rendering, I assume that when you look at it more directly (read, near full in phase) will the center of the planet's disk appear a near-white as it does in reality? That rendering there is almost *EXACTLY* like what I see through my high-powered Meade ETX telescope!

Excellent, excellent work! I sure hopes it hits 1.5.0's official release, and furthermore maybe an option to enable/disable it via the "Render options" dialog?

Again, I'm very impressed!

Avatar
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 11 months

Post #23by Chuft-Captain » 16.10.2007, 13:01

Ditto to srosenow_98's comments.

Very, very cool (well *hot* actually) dirkpitt. I can almost feel the searing heat of that sun!
I'm particularly impressed that you've achieved this in a basic render path. This means even my lowly graphics hardware may one day be able to display this.
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #24by ElChristou » 16.10.2007, 13:47

dirkpitt wrote:I've recently experimented with bringing HDR to Celestia...


DW, could you make available your app?
Image

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #25by Cham » 16.10.2007, 15:23

And what about the impact on the frame rate ?

That new rendering option may be used under all rendering paths, but what about performances ?
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #26by dirkpitt » 16.10.2007, 18:38

srosenow_98 wrote:Oh my GOD! Please say that rendering will make it to Celestia 1.5.0's official release! That star rendering looks fantastic! Very realistic!

And for the Venus rendering, I assume that when you look at it more directly (read, near full in phase) will the center of the planet's disk appear a near-white as it does in reality? That rendering there is almost *EXACTLY* like what I see through my high-powered Meade ETX telescope!

Excellent, excellent work! I sure hopes it hits 1.5.0's official release, and furthermore maybe an option to enable/disable it via the "Render options" dialog?


This is strictly an unofficial experiment at this point - it is far from release quality. (It's probably too optimistic to expect anything like this in 1.5.0...)

This said, yes, the sunlit side of Venus does become almost white. And I already made an instant keyboard toggle for myself for easier debugging.

Performance wise, currently frame rate is roughly proportional to the window area so it takes a big hit if the window is large (e.g., full screen).
I have a couple of ideas on how to fix that though.

Christophe - there are a couple of obvious quality problems I'd like to fix first.

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #27by chris » 16.10.2007, 20:46

Nice work DW! The appearance of brilliance for stars is quite good. If you can work out some of the nits, this would be a nice option to offer users with graphics cards that ca't support full HDR. How does it work with labels and orbits? I supose these end up getting the bloom effect applied if they're too bright. I wonder if it might be possible to take advantage of destination alpha to mark only certain pixels for bloom?

And speaking of full HDR, the key feature that is required is support for 16-bit floating point frame buffers with alpha blending. Some older hardware (GeForce FX, Radeon X800, Radeon 9x00 series) have 16-bit floating point frame buffers, but without support for alpha blending with these formats, it's not much use. Later cards should all be able to do true HDR, though we'll have to be a little careful with the limited range of 16-bit floating point values. The GeForce 8 series supports alpha blending with 32-bit floating point frame buffers, but I have big concerns about performance.

--Chris

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #28by ElChristou » 17.10.2007, 00:04

Chris, a few post above, it's was question of the Celestia Wiki; don't you think a link on the main site would be useful?
Image

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #29by dirkpitt » 17.10.2007, 00:47

chris wrote:How does it work with labels and orbits? I suppose these end up getting the bloom effect applied if they're too bright. I wonder if it might be possible to take advantage of destination alpha to mark only certain pixels for bloom?


Yes, orbits and labels still need to be handled specially. That's why none of the above screenshots show any labels, orbits, or markers. :wink:

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #30by dirkpitt » 21.10.2007, 12:46

Here's another test.
I call this "3 Phases of Venus" aka "ElChristou look - stars now adapt brightness!"
(click for larger versions):
Image
Image
Image

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #31by t00fri » 21.10.2007, 12:55

Oh what a relief! I was suffering from this previous unphysical artefact since many years...

Cheers,
Fridger
Image

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #32by ElChristou » 21.10.2007, 13:38

dirkpitt wrote:Here's another test.
I call this "3 Phases of Venus" aka "ElChristou look - stars now adapt brightness!"


8O OOhhh...

Test app please! (even buggy!)
Image

phoenix
Posts: 214
Joined: 18.06.2002
With us: 22 years 5 months
Location: Germany - Berlin

Post #33by phoenix » 21.10.2007, 14:40

yes, please give us at least a patch-file.
i'm dying to see this live ;)
most recent celestia win32-SVN-build - use at your own risk (copy over existing 1.5.1 release)

ANDREA
Posts: 1543
Joined: 01.06.2002
With us: 22 years 5 months
Location: Rome, ITALY

Post #34by ANDREA » 21.10.2007, 14:59

dirkpitt wrote:Here's another test.
I call this "3 Phases of Venus" aka "ElChristou look - stars now adapt brightness!"

I think this is wonderful, the final solution, indeed.
It's like if my iris opens as soon as Venus luminosity dims, exactly what really happens. 8O
Very appreciated, dirkpitt, thank you.
Bye

Andrea :D
"Something is always better than nothing!"
HP Omen 15-DC1040nl- Intel® Core i7 9750H, 2.6/4.5 GHz- 1TB PCIe NVMe M.2 SSD+ 1TB SATA 6 SSD- 32GB SDRAM DDR4 2666 MHz- Nvidia GeForce GTX 1660 Ti 6 GB-WIN 11 PRO

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #35by dirkpitt » 21.10.2007, 15:06

There's still a couple of major eyesores that I need to fix before any sort of public testing.
In particular, star brightness away from any visible planets suddenly jumps.
Currently, I'm only basing saturation mag ("max" brightness) on the brightest body (planet/model).
If there are no nearby planets or satellites I need to tone down the saturation mag smoothly.
A related issue causes stars to not yet darken if there's a bright sun in the scene.
Also, bloom quality is dreadful. (Luckily I think it's a simple mistake)

There are lots of other issues, but fixing the above is probably enough for a "first milestone".

cyber_space_doc
Posts: 53
Joined: 19.03.2007
With us: 17 years 8 months
Location: united kingdom

Post #36by cyber_space_doc » 21.10.2007, 19:46

one feature I would request is that there should be a flag that determines whether HDR adjusts the exposure automatically or through user input.
System: AMD 3200+
512Mb RAM
GeForce 7300 FX 256 mb VRAM
Windows XP Home Edition
Nforce4 Motherboard
Service Pack 2
_____________________

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #37by dirkpitt » 21.10.2007, 22:42

You're in luck - I already added manual exposure adjustment (< and > keys) to help with debugging.

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #38by dirkpitt » 24.10.2007, 07:29

This may seem like a very basic question, but...
I'm having trouble trying to reconcile the relative brightnesses of:

- Dark side of Venus (Celestia claims apparent magnitude ~ -15 ?!)
- Deep space (Celestia claims ~ 3)

Why is the dark side of Venus (seen close up) so bright?
For comparison, Wikipedia claims that the full moon, as seen from Earth with no atmosphere, has apparent magnitude ~ -12.6.
Why is the dark side of a planet "brighter" than the full moon?

Are non-visible wavelengths being considered by Celestia's calculations?
BTW, Pluto's dark side is -6 ~ -7 at ~ 10,000 km. This seems unusually bright..

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #39by chris » 24.10.2007, 16:03

dirkpitt wrote:This may seem like a very basic question, but...
I'm having trouble trying to reconcile the relative brightnesses of:

- Dark side of Venus (Celestia claims apparent magnitude ~ -15 ?!)
- Deep space (Celestia claims ~ 3)

Why is the dark side of Venus (seen close up) so bright?
For comparison, Wikipedia claims that the full moon, as seen from Earth with no atmosphere, has apparent magnitude ~ -12.6.
Why is the dark side of a planet "brighter" than the full moon?

Are non-visible wavelengths being considered by Celestia's calculations?
BTW, Pluto's dark side is -6 ~ -7 at ~ 10,000 km. This seems unusually bright..


There are a few things going on here . . . Venus has a much higher albedo than the Moon, is closer to the Sun, is larger (thus reflecting more light overall), and although you don't specify as much, my guess is that the camera is also closer to Venus than the Earth-moon distance. Unless the phase angle is exactly 180, Venus is going to seem quite bright; in fact, light forward scattered by the atmosphere will make Venus appear brilliant even at 180, though Celestia doesn't account for this in it's magnitude calculation.

However . . . One significant factor that Celestia's apparent magnitude calculation does not take into account is perspective. When you're close the surface of Venus on the side opposite the Sun, you won't see any lit portions because they are over the horizon. Since the apparent magnitude function is currently used to determine the brightness of planets so distant that they're rendered as points, this geometric shortcut isn't a problem. But, it's a serious shortcoming for your usage; you'll have to write a new, more complicated apparent magnitude function to use when perspective can't be neglected.

There will always be limitations with this approach to calculating overall scene brightness, even with a new apparent magnitude function. Irregular objects won't be handled correctly, and eclipses will give you headaches. I'm not saying this to discourage you from trying: it's probably the only thing that will work when using 8 bit per channel frame buffers, and on many graphics cards 8 bits is all you get.

--Chris

Avatar
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #40by dirkpitt » 24.10.2007, 22:54

chris wrote:light forward scattered by the atmosphere will make Venus appear brilliant even at 180, though Celestia doesn't account for this in it's magnitude calculation.


In fact a quick search also uncovered a page of Venus transit observations that describe this Titan-like atmospheric "ring": Transit of Venus 2004


Return to “Development”