Drawing a better star

Discussion forum for Celestia developers; topics may only be started by members of the developers group, but anyone can post replies.

Re: Drawing a better star

Postby t00fri » Mon Jul 26, 2010 1:37 pm

chris wrote:
I haven't done anything with the appearance of nearby stars, though obviously that needs quite a bit of work too.

--Chris


Chris,

another related question to ask is how your stars behave, once the sensitivity is increased from visual to a 200 mm photographic lens, say. In Celestia the automag might be a relevant testing ground for this. Anyway, in this case, the distance to the stars remains large throughout.

As a possible reference, here is a nice photo of alpha Cen and beta Cen, taken with a 200 mm lens by Dr. Noël Cramer, Observatoire de Genève.

Image

We see that the two bright stars really blow up in size with the glare regime being very conspicuous. An uncountable number of background stars is visible with the star size remaining tiny.

Where would the hardware-specific profile enter in your approach? Once I increase the amount of collected light by some device other than the eye, I need to know its spectral sensitivity! A CCD, for example is way more sensitive in the blue regime than normal film.

Fridger

PS: probing your above pixel formula at varying light levels might provide further evidence about its proper normalization and the correct ratio of core / glare size of bright stars.
Image
User avatar
t00fri
 
Posts: 8784
Joined: Fri Mar 29, 2002 5:53 am
Location: Hamburg, Germany

Re: Drawing a better star

Postby chris » Tue Jul 27, 2010 10:17 am

t00fri wrote:another related question to ask is how your stars behave, once the sensitivity is increased from visual to a 200 mm photographic lens, say. In Celestia the automag might be a relevant testing ground for this. Anyway, in this case, the distance to the stars remains large throughout.

We see that the two bright stars really blow up in size with the glare regime being very conspicuous. An uncountable number of background stars is visible with the star size remaining tiny.


In fact, with glare described as a Gaussian, extremely bright stars did not look like the ones in your image. With a Gaussian, the edges of the star get sharper as the brightness increases. This matches what we see for the core PSF, but the glare behaves differently.

Here's a very relevant paper titled "Physically-Based Glare Effects for Digital Images": http://citeseerx.ist.psu.edu/viewdoc/do ... 1&type=pdf

The authors describe the PSF for the eye as the sum of three terms: a central Gaussian, a theta^-2 term, and a theta^-3 term (where theta is the angle from the center of the light source.) Here's a sample image of the Southern Cross where Gaussian glare is replaced by G(1/(1 + k*r^3)), where G is the glare brightness, k is a constant that sets the glare falloff rate, and r is the distance in pixels. I deliberately did not the angular distance, as it's more desirable to resolve stars at high zoom factors than it is to try and realistically reproduce all the quirks of a real imaging system (and I realize that's what I did with the diffraction spikes, but they're aesthetically pleasing :) ).

crux.png
New glare function


Where would the hardware-specific profile enter in your approach? Once I increase the amount of collected light by some device other than the eye, I need to know its spectral sensitivity! A CCD, for example is way more sensitive in the blue regime than normal film.


You could multiply the final pixel colors by RGB factors right before the linearToSRGB step.

--Chris
User avatar
chris
Site Admin
 
Posts: 4218
Joined: Mon Jan 28, 2002 12:21 pm
Location: Seattle, Washington, USA

Re: Drawing a better star

Postby W0RLDBUILDER » Tue Jul 27, 2010 11:58 am

The diffraction spikes should be an option in the next version of Celestia. Cool! 8)
W0RLDBUILDER
 
Posts: 116
Joined: Tue Jun 01, 2010 5:49 pm

Re: Drawing a better star

Postby chris » Fri Jul 30, 2010 5:42 pm

t00fri wrote:PS: probing your above pixel formula at varying light levels might provide further evidence about its proper normalization and the correct ratio of core / glare size of bright stars.


Here's just such a sequence... Crux again, with a limiting magnitude changing in steps of one magnitude:

mag8.png
Limiting magnitude = 8

mag9.png
Limiting magnitude = 9

mag10.png
Limiting magnitude = 10

mag11.png
Limiting magnitude = 11

mag12.png
Limiting magnitude = 12


There are several free parameters:
- The limiting magnitude
- The 'saturation magnitude'--the magnitude at which a star centered exactly on a pixel will reach the maximum pixel value
- sigma^2 for the PSF
- The glare brightness; arbitrarily set now, but this should be some fraction of the total star light that gets scattered in the optical system
- The glare falloff

In the images above, the limiting magnitude and saturation magnitude both change, but the difference between the two remains constant. Increasing the distance between limiting and saturation magnitudes will allow a greater range of brightnesses to be shown without blowing out the bright stars. The tradeoff is that visual contrast between bright and faint stars is reduced.

Star colors are derived here are derived from Johnson B-V color indices. The color index is converted to an effective surface temperature. From the black body temperature, I use a piecewise cubic approximate to get the CIE xy color coordinates. These are converted to CIE XYZ, transformed to linear sRGB, and then used in the pixel shader. It is important to avoid using gamma-corrected sRGB colors in the pixel shader, as the multiplication of pixel brightness and color must be done in linear color space. My earlier images suffered from this error and thus appeared too unsaturated.

--Chris
User avatar
chris
Site Admin
 
Posts: 4218
Joined: Mon Jan 28, 2002 12:21 pm
Location: Seattle, Washington, USA

Re: Drawing a better star

Postby chris » Fri Jul 30, 2010 5:57 pm

For comparison with the images in the previous post, here's Crux again with a limiting magnitude of 12 and saturation magnitude 4. The bright stars of the Southern Cross are now not nearly so overexposed. Changing the difference between saturation magnitude and limiting magnitude amounts to gamma correction, while changing the limiting magnitude is adjusting the exposure.

satmag8.png
Limiting mag = 12.0, saturation mag = 4.0


--Chris
User avatar
chris
Site Admin
 
Posts: 4218
Joined: Mon Jan 28, 2002 12:21 pm
Location: Seattle, Washington, USA

Re: Drawing a better star

Postby CAP-Team » Mon Aug 02, 2010 11:01 am

I really like the new way of drawing stars. Is this going to be an extra option for CTRL+S or will it replace the older methods?

Any chance this wil hit SVN soon? ;)
Windows 7 Ultimate x64, Intel Core i7 2600K 3.4 Ghz, 4 GB RAM, 120 GB SSD + 1 TB hdd, nVidia GTX460 1 GB, Celestia 1.6.0.xxxx
Download my latest SVN Build
User avatar
CAP-Team
 
Posts: 194
Joined: Wed Dec 27, 2006 3:10 pm
Location: Vriezenveen, the Netherlands

Re: Drawing a better star

Postby chris » Fri Aug 06, 2010 10:30 am

CAP-Team wrote:I really like the new way of drawing stars. Is this going to be an extra option for CTRL+S or will it replace the older methods?


I'd like it to replace the older methods on capable hardware. After using this new star rendering technique, none of the old methods seem adequate.

Any chance this wil hit SVN soon? ;)


It's not ready for SVN, but I do have a patch ready for testing. PM if your interested (and are building Celestia from the SVN source.)

--Chris
User avatar
chris
Site Admin
 
Posts: 4218
Joined: Mon Jan 28, 2002 12:21 pm
Location: Seattle, Washington, USA

Re: Drawing a better star

Postby Guckytos » Sat Aug 07, 2010 12:11 am

chris wrote:
CAP-Team wrote:I really like the new way of drawing stars. Is this going to be an extra option for CTRL+S or will it replace the older methods?


I'd like it to replace the older methods on capable hardware. After using this new star rendering technique, none of the old methods seem adequate.

--Chris


Chris,

what is "capable hardware" in this case? Can you give a minimum graphics chip generation? And how would it impact on the FPS of this minimum?

Regards,

Guckytos
User avatar
Guckytos
 
Posts: 549
Joined: Tue Jun 01, 2004 5:13 am
Location: Germany

Re: Drawing a better star

Postby CAP-Team » Sat Aug 07, 2010 1:10 am

Chris, in the pictures above, do you use the standard star database or some other database?
Windows 7 Ultimate x64, Intel Core i7 2600K 3.4 Ghz, 4 GB RAM, 120 GB SSD + 1 TB hdd, nVidia GTX460 1 GB, Celestia 1.6.0.xxxx
Download my latest SVN Build
User avatar
CAP-Team
 
Posts: 194
Joined: Wed Dec 27, 2006 3:10 pm
Location: Vriezenveen, the Netherlands

Re: Drawing a better star

Postby chris » Sat Aug 07, 2010 9:11 am

CAP-Team wrote:Chris, in the pictures above, do you use the standard star database or some other database?


It's the Tycho 2 catalog down to magnitude 10--about a million stars, versus the 100,000 or so in the standard Celestia catalog.

--Chris
User avatar
chris
Site Admin
 
Posts: 4218
Joined: Mon Jan 28, 2002 12:21 pm
Location: Seattle, Washington, USA

Re: Drawing a better star

Postby chris » Sat Aug 07, 2010 9:30 am

Guckytos wrote:
chris wrote:
CAP-Team wrote:I really like the new way of drawing stars. Is this going to be an extra option for CTRL+S or will it replace the older methods?


I'd like it to replace the older methods on capable hardware. After using this new star rendering technique, none of the old methods seem adequate.

--Chris


Chris,

what is "capable hardware" in this case? Can you give a minimum graphics chip generation? And how would it impact on the FPS of this minimum?



Any NVIDIA card from the GeForce FX on will work. ATI Radeon cards will work as long as they are from the X1xxx series or later (anything 2005 or later should be OK.) The new stars should actually be faster, since more work gets pushed onto the GPU. In fact, with some modifications to the octree processing, the new star code could be quite a bit faster. The amount of CPU work could be reduced to a bare minimum; I recall that when I last profiled the star code, a significant amount of time was spent computing apparent magnitudes for stars. This step could be eliminated altogether if the star octree traversal and shader were written to work with absolute luminosities instead of magnitudes.

--Chris
User avatar
chris
Site Admin
 
Posts: 4218
Joined: Mon Jan 28, 2002 12:21 pm
Location: Seattle, Washington, USA

Re: Drawing a better star

Postby CAP-Team » Sun Aug 08, 2010 12:28 pm

A disadvantage of this new star rendering is that it's perfect as long as you don't travel between stars.

If you select a star and then go to it, it brightens twice. First you approach the glare and when that's full screen, you approach the star it self.
But I guess it's hard to find a decent way to transit from a big glare to the star itself.
Windows 7 Ultimate x64, Intel Core i7 2600K 3.4 Ghz, 4 GB RAM, 120 GB SSD + 1 TB hdd, nVidia GTX460 1 GB, Celestia 1.6.0.xxxx
Download my latest SVN Build
User avatar
CAP-Team
 
Posts: 194
Joined: Wed Dec 27, 2006 3:10 pm
Location: Vriezenveen, the Netherlands

Re: Drawing a better star

Postby Boux » Wed Aug 11, 2010 5:39 am

I have been playing with Chris's code (big thanks for sharing!).
The new star rendering is very nice and can be gorgeous with some tweaking.
First, I have got rid of the 1 Ly solar system size limit so that the transition between shader and mesh rendering is smooth.
Then I have been playing with the variables and I found that brightnessBias is the most controllable.
The screenshots below - /!\ big pics! - are made with brightnessBias set to 0.5, 0.7 and 0.8

EDIT Aug 12 --> brightnessBias back to (0.0f)

The first shot simulates a bare-eyes sight from someone's backyard:
Image

The second shot simulates the same scene as seen through hypothetic binoculars:
Image

Now, let's try with a digital camera on some sort of equatorial stand with a few minutes long exposure time:
Image

Next, this small telescope that we just found at the nearby pawn shop will allow us to do some zooming in:
Image

How about fitting a ccd sensor to our telescope?
Image

OK, enough experimentation for the time being and let's go for more eye candy with our pocket Hubble toy:

Galactic center
Image

Carina
Image

Andromeda
Image

Southern Cross
Image

Now I am going to tweak some more variables :D
Last edited by Boux on Thu Aug 12, 2010 2:18 am, edited 1 time in total.
Intel core i7 3770 Ivy Bridge @ 4.4 GHz -16 GB ram - 128 GB SSD cache - AMD Radeon 7970 3 GB o'clocked - Windows 7 64 Ultimate / Linux Kubuntu
Boux
 
Posts: 439
Joined: Wed Aug 25, 2004 12:40 am
Location: Brittany, close to the Ocean

Re: Drawing a better star

Postby Boux » Wed Aug 11, 2010 8:50 am

As a reference to t00fri's post re alpha cent picture...
Some not so bad shots...
Celestia's sensor is doing pretty well and does not leak light :wink:
Done with brightnessBias(0.65f)
EDIT Aug 12 --> brightnessBias back to (0.0f)
What is weird is that there are more visible differences between fuzzy points and point rendering on my (big) display than on the smallish cropped screen captures.

Fuzzy points:
Image

Points:
Image

Scaled discs:
Image

Scaled discs with a tad more glare effect would be very close. Will check that.
BTW, we need more stars in Celestia!
 
Last edited by Boux on Thu Aug 12, 2010 2:19 am, edited 1 time in total.
Intel core i7 3770 Ivy Bridge @ 4.4 GHz -16 GB ram - 128 GB SSD cache - AMD Radeon 7970 3 GB o'clocked - Windows 7 64 Ultimate / Linux Kubuntu
Boux
 
Posts: 439
Joined: Wed Aug 25, 2004 12:40 am
Location: Brittany, close to the Ocean

Re: Drawing a better star

Postby chris » Wed Aug 11, 2010 9:10 am

Boux wrote:I have been playing with Chris's code (big thanks for sharing!).
The new star rendering is very nice and can be gorgeous with some tweaking.
First, I have got rid of the 1 Ly solar system size limit so that the transition between shader and mesh rendering is smooth.
Then I have been playing with the variables and I found that brightnessBias is the most controllable.
The screenshots below - /!\ big pics! - are made with brightnessBias set to 0.5, 0.7 and 0.8


The new star rendering is only enabled when point stars mode is selected. The brightnessBias setting will only affect the old star rendering. The adjustable parameters for the new star rendering are the limiting magnitude (adjusted with the square bracket keys) and the various settings in the renderShaderStars method. The three variables that control how star brightness are mapped to pixel values are the limiting magnitude, saturation magnitude, and the just visible pixel value. Here are the values from the code:

Code: Select all
// Saturation magnitude is the magnitude at which a star centered on a pixel                                                                               
// will have the maximum pixel value.                                       
float saturationMag = faintestMag - 4.5f;

// Minimum pixel value (wihout gamma correction) that is visible; this will vary                                                                           
// based on display device and viewing conditions                                                                             
float justVisiblePixelValue = 1.0f / 300.0f;


Roughly speaking, stars with an apparent magnitude equal to the limiting magnitude will have a pixel value equal to the just visible value, and stars at the saturation magnitude will have a pixel value of 1.0. Gamma correction and that the stars are Gaussians rather than points complicates things slightly, but this should give an idea of the physical meaning of the parameters.

One thing missing from your screenshot is a background of faint stars. By adjusting the brightnessBias to a very high value, every star appears bright. For realistic images, there should be a rich field of faint stars in the image.

--Chris
User avatar
chris
Site Admin
 
Posts: 4218
Joined: Mon Jan 28, 2002 12:21 pm
Location: Seattle, Washington, USA

PreviousNext

Return to Ideas & News

Who is online

Users browsing this forum: No registered users and 1 guest