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.
Topic author
chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Re: Drawing a better star

Post #41by chris » 15.08.2010, 18:48

Boux wrote:I found something interesting running the MSI Afterburner monitoring tool.
The test has been done at the location Chris was using (9 light years from earth, stars rendering only, 45 FOV).
Here is the graph:
Image
You can see that GPU load starts dropping at Lim Mag 3 to reach a minimum at Lim Mag 10.
At Lim Mag 12, GPU load starts increasing again up to the maximum at Lim Mag 15.09.
There is something happening here. Could be CPU load reaching a peak and the GPUs starting waiting for data.
GPUs temperatures variations are consistent with the load.
This is a crossfire setup. Actual drop on a single GPU would likely be more in the 50-60% range.

Here's what I think is happening...

* When the limiting magnitude is low (i.e. few stars are drawn), there's not much work for the CPU to do. The GPU is kept busy repeatedly clearing the framebuffer at an extremely high rame rate.

* As the limiting magnitude increases, the CPU has to process more and more stars. The GPU has only slightly more work to do, as the number of stars drawn isn't that large and they only cover a few pixels.

* When the limiting magnitude gets very large, the stars become bright and cover a lot of pixels. This requires a lot of pixel shader processing and graphics memory bandwidth, and the GPU becomes the bottleneck again.

It's important not to get too caught up about performance now; correctness is more important at this stage. Also, the performance of the new star rendering is already faster except when very large stars are rendered. With the new code, more work is offloaded from the CPU to the GPU. This is desirable because the shaders always run in parallel on GPU cores, and the typical GPU has a lot more cores than a CPU. It's not too hard to modify the code so that the CPU is doing less work. Another very useful optimization would be switching the star rendering to use vertex buffers so that the CPU and GPU can better operate in parallel with each other.

--Chris

Verz Veraldi
Posts: 55
Joined: 16.09.2010
With us: 14 years 2 months
Location: In front of my computer

Re: Drawing a better star

Post #42by Verz Veraldi » 27.09.2010, 12:56

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

Galactic center
"the image"

How do you get this milkyway model? 8O
Finally figured out how to add signature...
Core 2 Duo E7500 2.93 GHz, 4GB RAM, Nvidia GeForce 9600GT 1GB DDR3 Mem, Windows 7 32bit...

Boux
Posts: 435
Joined: 25.08.2004
With us: 20 years 2 months
Location: Brittany, close to the Ocean

Re: Drawing a better star

Post #43by Boux » 27.09.2010, 17:18

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

Galactic center
"the image"

How do you get this milkyway model? 8O

It is a personal add-on that I created for my own purpose.
As it may - or may not - contain copyrighted material that I am too lazy to get clearance for, it is not ready for prime time.
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

Verz Veraldi
Posts: 55
Joined: 16.09.2010
With us: 14 years 2 months
Location: In front of my computer

Re: Drawing a better star

Post #44by Verz Veraldi » 28.09.2010, 12:16

oh i see... i hope it will be shared soon if you want.
Finally figured out how to add signature...
Core 2 Duo E7500 2.93 GHz, 4GB RAM, Nvidia GeForce 9600GT 1GB DDR3 Mem, Windows 7 32bit...

Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 18 years 1 month
Location: Out there...

Re: Drawing a better star

Post #45by Reiko » 01.11.2010, 19:00

Will this work with an Nvidia 9400 GT?

DBrady
Posts: 66
Joined: 14.07.2003
With us: 21 years 4 months
Location: Sydney

Re: Drawing a better star

Post #46by DBrady » 09.03.2011, 13:47

Image
Click picture for a larger view.

I've created a .exe with diffraction spikes enabled if anyone wants to play around with it. For windows only. Just replace your current celestia.exe with the one below, back up your old one first! The fantasy picture above had a limiting magnitude of ~9.5. Use "[" and "]" to adjust the limiting magnitude.

http://rapidshare.com/files/451727281/celestia.exe

And a quote from Chris just so there's no misunderstanding
Purely artistic, with no attempt to model the optics of a reflecting telescope.
Slan

Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 18 years 1 month
Location: Out there...

Re: Drawing a better star

Post #47by Reiko » 10.03.2011, 05:57

DBrady wrote:Image
Click picture for a larger view.

I've created a .exe with diffraction spikes enabled if anyone wants to play around with it. For windows only. Just replace your current celestia.exe with the one below, back up your old one first! The fantasy picture above had a limiting magnitude of ~9.5. Use "[" and "]" to adjust the limiting magnitude.

http://rapidshare.com/files/451727281/celestia.exe

And a quote from Chris just so there's no misunderstanding
Purely artistic, with no attempt to model the optics of a reflecting telescope.
Thank you! :blue:

But it doesn't work. I get an error message saying missing msvcp100.dll
I tried downloading it and putting in the Celestia directory and it still doesn't work. :(

Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 18 years 1 month
Location: Out there...

Re: Drawing a better star

Post #48by Reiko » 10.03.2011, 06:26

Ok finally got it to work. I had to install Microsoft Visual C++ 2010 Redistributable Package (x86) and then delete the dll I put in the Celestia folder.
:D

bh
Posts: 1547
Joined: 17.12.2002
With us: 21 years 11 months
Location: Oxford, England

Re: Drawing a better star

Post #49by bh » 10.03.2011, 14:38

That's very pretty Mr Brady... shame I'm on mac...
regards...bh.

W0RLDBUILDER
Posts: 122
Joined: 02.06.2010
With us: 14 years 5 months

Re: Drawing a better star

Post #50by W0RLDBUILDER » 08.04.2011, 18:31

I can't download that.
RapidShare wrote:Unassigned file limit of 10 downloads reached.
Does anyone care to post it somewhere else?

Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 18 years 1 month
Location: Out there...

Re: Drawing a better star

Post #51by Reiko » 24.07.2011, 05:24

I had the one DBrady posted but lost it in a hard drive crash. :(

abramson
Posts: 408
Joined: 22.07.2003
With us: 21 years 3 months
Location: Bariloche, Argentina

Re: Drawing a better star

Post #52by abramson » 25.07.2011, 17:05

W0RLDBUILDER wrote:I can't download that. Does anyone care to post it somewhere else?

I am still posting my builds from SVN. Not many updates because there aren't so many changes in the code, just in data files. Anybody can get them from here:

WIN32 builds, with better stars and fading orbits

I'm using Chris' newstars from 28 September 2010. If there have been changes to render.cpp after that, my builds won't have them. Hopefully the newstars will be commited to the SVN sometime...

Cheers,

Guillermo

Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 18 years 1 month
Location: Out there...

Re: Drawing a better star

Post #53by Reiko » 25.07.2011, 23:09

abramson wrote:
W0RLDBUILDER wrote:I can't download that. Does anyone care to post it somewhere else?

I am still posting my builds from SVN. Not many updates because there aren't so many changes in the code, just in data files. Anybody can get them from here:

WIN32 builds, with better stars and fading orbits

I'm using Chris' newstars from 28 September 2010. If there have been changes to render.cpp after that, my builds won't have them. Hopefully the newstars will be commited to the SVN sometime...

Cheers,

Guillermo

Does it have the spikes in the stars?

abramson
Posts: 408
Joined: 22.07.2003
With us: 21 years 3 months
Location: Bariloche, Argentina

Re: Drawing a better star

Post #54by abramson » 25.07.2011, 23:36

Reiko wrote:Does it have the spikes in the stars?

No, Reiko. I'm sorry for the confusion. My builds have just Chris' "better" stars. No diffraction spikes.

G

Avatar
Joe
Posts: 162
Joined: 29.02.2004
With us: 20 years 8 months
Location: United Kingdom

Re: Drawing a better star

Post #55by Joe » 26.07.2011, 08:34

abramson wrote:No, Reiko. I'm sorry for the confusion. My builds have just Chris' "better" stars. No diffraction spikes.

Like Reiko, I was trying to produce with your builts the stars with spikes, wondering what was I did wrong. Thanks for the clarification Abramson. Any clue to modify the source to get the spike stars? I tried but failed 8O
Joe
8O

Reiko
Posts: 1119
Joined: 05.10.2006
Age: 41
With us: 18 years 1 month
Location: Out there...

Re: Drawing a better star

Post #56by Reiko » 12.11.2011, 20:48

Yes how do we make an .exe with the artistic diffraction spikes or is somebody else planning on making one in their spare time?
DBrady had made one but he deleted it off of rapidshare. :(

ajtribick
Developer
Posts: 1855
Joined: 11.08.2003
With us: 21 years 3 months

Re: Drawing a better star

Post #57by ajtribick » 16.11.2011, 21:37

So any progress on getting this finished into the main code for 1.7?

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

Re: Drawing a better star

Post #58by t00fri » 16.11.2011, 22:32

ajtribick wrote:So any progress on getting this finished into the main code for 1.7?

The star shader code and corresponding parameter values from ChrisL's patch

viewtopic.php?f=10&t=16031&start=0

are part of the VESTA library @Copyright ASTOS Solutions GmbH. You can check for yourself in the VESTA file StarsLayer.cpp e.g. in Chris' Cosmographia repository:

http://code.google.com/p/cosmographia/s ... sLayer.cpp

You can also download the whole VESTA library from ASTOS (after registration), which I did. Since the licence of VESTA is a bit tricky, I don't think they would allow copying just their star shaders and related code into Celestia. Unlike Celestia, the entire 3D rendering of Cosmographia is done by means of VESTA.

Since ChrisL did work for ASTOS, it is best if he specifies which star code was first and how it may now be used in other software, including Celestia(.Sci). Since meanwhile, I developed the star rendering of Celestia.Sci quite a bit further, along with the rendering of all globular cluster stars with the same star shaders, I would appreciate knowing more precisely how the correct quotations go here....

Fridger
Image

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

Re: Drawing a better star

Post #59by chris » 17.11.2011, 17:54

t00fri wrote:
ajtribick wrote:Since ChrisL did work for ASTOS, it is best if he specifies which star code was first and how it may now be used in other software, including Celestia(.Sci). Since meanwhile, I developed the star rendering of Celestia.Sci quite a bit further, along with the rendering of all globular cluster stars with the same star shaders, I would appreciate knowing more precisely how the correct quotations go here....

The work for ASTOS was first, but the two implementations were developed separately albeit using largely the same technique and equations. There are some important differences... The shader from VESTA uses precalculated apparent magnitudes for the stars and assumes that all stars lie on a sphere of radius 1; the Celestia shader uses the full 3D position of stars and computes apparent brightness from intrinsic brightness and distance.

--Chris

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

Re: Drawing a better star

Post #60by t00fri » 17.11.2011, 19:13

chris wrote:
ajtribick wrote:
t00fri wrote:Since ChrisL did work for ASTOS, it is best if he specifies which star code was first and how it may now be used in other software, including Celestia(.Sci). Since meanwhile, I developed the star rendering of Celestia.Sci quite a bit further, along with the rendering of all globular cluster stars with the same star shaders, I would appreciate knowing more precisely how the correct quotations go here....

The work for ASTOS was first, but the two implementations were developed separately albeit using largely the same technique and equations. There are some important differences... The shader from VESTA uses precalculated apparent magnitudes for the stars and assumes that all stars lie on a sphere of radius 1; the Celestia shader uses the full 3D position of stars and computes apparent brightness from intrinsic brightness and distance.

--Chris

Chris,

firstly, you mixed up Andrew's and my post in your above quote.

Second: I am not sure whether my English is adequate to disentangle correctly the implications from your reply. Were you saying that you independently developed BOTH, the star shader code for VESTA and the almost identical code distributed in your better_star patch? Except that you had submitted the code to VESTA@ASTOS already before you sent me and others the star patch (that largely was under the Copyright@ASTOS by then?).

I think you will agree that the differences you mentioned are really minor.
Like the evaluation of the z_coordinate via

position.z = sqrt(1.0 - dot(position.xy, position.xy)) * sign(gl_Color.a - 0.5);\n"

in case of the "spherical" sky (VESTA). There, the appMag value is transferred in the unused z-coordinate slot, while in the Celestia patch case, it's a vertex attribute (what else?) and the z-coordinate is a regular entry in the vertex array.

The far less trivial aspects are almost totally identical, notably also the linearToSRGB(vec3 color) part!

Incidentally, the vertex shader can be massively simplified analytically and thus requires considerably fewer arithmetic operations than the VESTA or your patch code. As to the magnitude dependence, one easily finds for example that the vertex shader code only depends on the ratio.

relMag = (saturationMag - appMag)/(saturationMag - faintestMag)

with the denominator now being traded as a constant (e.g. -4.5).

Furthermore, both (vertex and fragment) shaders only depend on the product of b * exposure rather than on both quantities separately. So your two transfers as separate uniform variables b and exposure are reluctant as well. Etc.

Anyway, you did not reply to the main part of my above question: How can we use that star shader code (or improvements thereoff) for Celestia or Celestia.Sci, given that tacitly it was copyrighted by ASTOS solutions long ago??

Fridger
Image


Return to “Ideas & News”