It is currently Tue, 21-11-17, 17:14 GMT

All times are UTC




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu, 21-03-13, 15:00 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4508
Location: Hamburg, Germany
Hi all,

some days ago, I promised to Martin (aka Cham) to enter into a discussion here at CelestialMatters about existing options to reduce the familiar granulariy that remains after using standard Sprite rendering techniques.

Symptoms
+++++++++++++

The remaining granularity I am referring to is best illustrated by two examples one from Cham's 3d nebulae and one from my galaxies in celestia.Sci:

3D Nebula (Cham's 7_Neb5_1.jpg):
=================================
a) Normal view from far away
------------------------------------
[Click on image by all means for a bigger view]
Image

b) Close-up view
----------------------
Image

The granularity is clearly visible

Galaxy (M 74, celestia.Sci)
===========================
a) Normal view from far away
--------------------------------------
[Click on image by all means for a bigger view]
Image

b) Close-up view
---------------------
Image

Also here granularity is clearly visible.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Let us ask in this thread, what can be done here to improve the close-up impressions significantly?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Background Info
++++++++++++++++++
First of all, let me recall that the reason for this granularity in the usual Sprite-based rendering is quite easy to understand. Here is a brief reminder:

In OpenGL rendering based on Sprites, one maps suitable (polygone) subsets from a mathematical point-template of e.g a 3D nebula to an extended 2D object like a 2D texture. This leads to the desired coverage of the object with many such mini sprites in different relative orientations. Usually --as an important degree of freedom-- one uses these sprites in different sizes from a chosen size distribution.

The total set of points characterizes the geometrical shape of the object to be rendered. The templates can be generated with Mathematica (Cham) or Maple (me) or GIMP,..

A typical shape for such a Sprite texture for our purposes would look like this:
Image

There is a crucial constraint here: the drawn radially symmetric function MUST vanish towards the border of the square (or there must be total transparency) otherwise the rendering looks horrible: you then can see all the square boundaries of your sprites in the rendered object!

The requirement that the bright radial shape vanishes at the border already implies the residual black (or transparent) space in-between the various sprites.
Here is a simplified illustration using just four sprites covering a plane surface:

Image

Of course this illustration is enormously blown up, but in the end, it's the reason for the remaining granularity seen e.g. above.

A non-granular 3D rendering of Nebulae
+++++++++++++++++++++++++++++++++++++

Let me go in medias res by presenting a much improved 3D nebula rendering technique without ANY granularity.

The method is known to me since quite a while. It's simple to implement in OpenGL and it is FAST.

Here I even found a great YouTube video describing it in much detail. Just take your time and watch it. It's easy to understand....and there are demos all along!

+++++++++++++++++++++++++++
http://youtu.be/CaTI2d0tQME
+++++++++++++++++++++++++++
Image

Let me stop here for now and wait for feedback!

Fridger


Last edited by t00fri on Thu, 21-03-13, 21:07 GMT, edited 3 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu, 21-03-13, 15:10 GMT 
Offline
User avatar

Joined: Sun, 02-09-07, 20:19 GMT
Posts: 196
Location: Montreal
Thanks for opening this **crucial** topic.

The video above is the one I've presented on Shatters.net, a few weeks ago. I have some to say about this. It's of little use for Celestia and it's good for video games only.

Unfortunately, I have to run to the job right now, but I have some to say, from all my experiments with sprites models. Back in a few hours.


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 21-03-13, 15:57 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4508
Location: Hamburg, Germany
Cham wrote:
Thanks for opening this **crucial** topic.

The video above is the one I've presented on Shatters.net, a few weeks ago. I have some to say about this. It's of little use for Celestia and it's good for video games only.

Unfortunately, I have to run to the job right now, but I have some to say, from all my experiments with sprites models. Back in a few hours.


Well I must have overlooked your posting of this video in shatters.net. But for familiar reasons ;-) I have given up reading shatters.net carefully...

For sure the method explained in this YouTube video MUST and CAN be substantially improved, leading to much more realistic renderings. But I thought the video gives a pretty good outline of the basic line of approach.

The approach is actually conform with standard OGL methods of 3D texture rendering. The latter methods are always represented as a stack of 2D textures and then blended together.

The video just emphasized some further tricks that allow to generate such 3d nebulae even on the fly e.g. in games. That is not of much interest for us.

Fridger


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 21-03-13, 16:08 GMT 
Offline
Site Admin
User avatar

Joined: Thu, 30-08-07, 22:52 GMT
Posts: 2726
Location: France, South, not far from Montpellier
Cham wrote:
...I have some to say about this. It's of little use for Celestia and it's good for video games only.


Hey Cham, remember we are not talking anymore, here @CM, about the old deprecated Celestia but more about some more exiting stuff under the supervision of our good old Fridger! :P

For video games only? I don't think so! The method is simple and may be pretty cool to avoid using too much calculating power. Now who said it should be "just" what the video shows here?

Let's say the video present a cloud of polygons. Let's imagine a point in the center of this cloud and let's call it a seed.

Now what if the nebulae was created with multiple seeds? :o

More, what if we add a mipmap system for the texture allowing a long and short distance viewing?

And what if the texture are in fact in grayscale and colored by the code depending on the elements found inside the nebulae? That could be a method to achieve an automatic generation depending on some catalogues...

AND also, don't forget we would be free to create beautiful textures with plenty of nice details!

So from my idiotic arty point of view, this method deserve some real testing!


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 21-03-13, 19:11 GMT 
Offline
User avatar

Joined: Sun, 02-09-07, 20:19 GMT
Posts: 196
Location: Montreal
I already saw that technique exploited in some video games before, in the time I was playing FPS (First Person Shooters, Like Quake3, Borderlands, etc). It's a well know effect for the video game industry. The effect is easy to implement, but the results are gross approximations, at best. The net effect is really not convincing and way too approximate. From certain view angles, you can easily feel the texture mapped on a surface, even if the plane is blending away. This technique could have some uses in Celestia ONLY for very low res textures (no details), and it's not very convincing either.

In the case of sprites, I could in principle generate models with large sprites. But then there are a few problems :

1. Large sprites overlap on other sprites, and this may have a strong impact on the frame rate (because of all the sprite blending the GPU has to calculate). So the small sprites are favored.

2. Large sprites tend to give a rendering mess : the view becomes highly saturated and we don't see much interesting things, even if the large sprites are transparent. This problem is related to the first one above.

3. Even when we can reduce both problems above (with less large sprites), the large sprites tend to have an ugly circular bending pattern in them (just look at the default rendering of galaxies. It's really ugly at close range or at low FOV !). This is most noticeable with gray shades. Maybe 16bit sprites could solves this, but I'm pretty sure the impact on the frame rate would be huge !


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 21-03-13, 19:27 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4508
Location: Hamburg, Germany
Martin,

here I have to disagree, since I did already several OGL + C++ code experiments with this approach.

First of all, I would certainly put 2D Perlin noise onto each 2D plane (which is a "monster" sprite if you like). Moreover the smoothness of the 3d effect only depends on the number of planes that one allows for. For games this number is clearly put at a tolerable minimum for real time effects. In contrast, we generate the nebula only ONCE in the initialization phase of Celestia or celestia.Sci. It is then stored and subsequently recalled from RAM or even from superfast GPU memory. Next I would use fast shaders and other modern tools that are executed on the GPU! I doubt that you tried all this before...

One thing I can promise: NO granularity ;-) We'll see what the price will be for that... ;-)

Fridger

PS: actually, the rendering of my elliptical galaxies does NOT use sprites and has NO granularity whatsoever. It is fully 3D, rendered with shader technology and is quite similar to the approach we are discussing. Here is an example with comparison to the SDSS photo:

[Click on image for a bigger view]
Image

or see here the E2 elliptical galaxy NGC 3226 in the celestia.Sci splash image:

Image

The smoothness arises here through the interpolations done in the fragment shader.


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 21-03-13, 20:07 GMT 
Offline
User avatar

Joined: Sun, 02-09-07, 20:19 GMT
Posts: 196
Location: Montreal
Well, on your first picture above (and all the screen captures that you showed in the past), we easily see the circular bending problem (onion-like effect in the blending). It feels unatural. I don't like this rendering.

The "granulity" is still visible on your galaxy, in the second image. This galaxy is still made of point sprites, as I can see.


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 21-03-13, 20:16 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4508
Location: Hamburg, Germany
Cham wrote:
Well, on your first picture above (and all the screen captures that you showed in the past), we easily see the circular bending problem (onion-like effect in the blending). It feels unatural. I don't like this rendering.

Well, it is of course up to you whether you like the rendering or not.

I would call my rendering of the ellipticals almost photo-realistic. Moreover, it exhibits a standard de Vaucouleurs 'radius^(1/4)' law for the brightness profile of ellipticals. That was not so easy...

Clearly you can blow up the picture so enormously that some light residual "onion' effect is still visible. It is NOT visible in normal views, though.
Quote:
The "granulity" is still visible on your galaxy, in the second image. This galaxy is still made of point sprites, as I can see.


Yes, the celesltia.Sci splash image is about half a year old and represents some sort of default rendering. I'll discuss options for improving the granularity of spiral galaxy rendering tomorrow.

Fridger


Last edited by t00fri on Thu, 21-03-13, 20:50 GMT, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu, 21-03-13, 20:36 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4508
Location: Hamburg, Germany
Sorry, I discovered that the above M60 image was already about 1 year old. The "onion" effect is mostly gone in my new renderings. Here is M60 again, from a screenshot 10 minutes ago:

Image

Fridger


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 21-03-13, 21:21 GMT 
Offline
User avatar

Joined: Sun, 02-09-07, 20:19 GMT
Posts: 196
Location: Montreal
It appears to be much better.

The galaxy still has a granulity, though, but this isn't a problem with me since real galaxies do have a granulity on all the pictures.

_________________
"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!"


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 21-03-13, 21:38 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4508
Location: Hamburg, Germany
Cham wrote:
It appears to be much better.

The galaxy still has a granulity, though, but this isn't a problem with me since real galaxies do have a granulity on all the pictures.


Good...

Technically, the rendering of the elliptical galaxies is actually done as follows.

During the initialization of celestia.Sci a spherical shell of points with unit radius is computed and stored away. During the actual OGL rendering process these points are recalled from memory and scaled with a scaling vector (xs,ys,zs) according to the ellipticity of the galaxy. Next, via further fast rescalings, an onion-type sequence of smaller ellipsoids is transferred to the shaders. In the vertex shader the proper orientation and physical size is realized via matrix transforms. In the second shader, the so-called fragment shader, a smooth color interpolation between these concentric onion shells is done (automatically, as usual).

Fridger


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 22-03-13, 17:50 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4508
Location: Hamburg, Germany
Let me continue with discussing possible remedies against the granularity that is clearly present in the present default rendering of spiral galaxiers in celestia.Sci. I have previously explained in this thread why this is so in standard Sprite-based renderings. It was also obvious that Cham is sitting in the same boat with his irregular nebulae.

Since I have the celestia.Sci source code in front of me, I can check out any attempts of impovement right away within a minute or so ;-).

I hope I showed above that there is no problem with the rendering of elliptical (and S0) galaxies in celestia.Sci. I consider it close to photo-realistic (on the SDSS resolution scale at least).

The main problem concerns spiral galaxies and this is a TOUGH one! Since a long time I am experimenting to find significant rendering improvements. Indeed there are many, but each time there is also an appreciable price to pay. So far it was so high that I always returned to the default rendering.

Let's see what I can offer at this time...

As a reference, let me first recall the "grand spiral" M 74 with the default rendering:

[Click on image by all means for a bigger view]
[ If you use a modern Firefox browser you MUST next hit F11]

Image

Let me just enumerate a few points that come to mind, in order to reduce the black (transparent) space between adjacent Sprites.

  • one may modify the size distribution of the used sprites. By default, it is a power law:

    d (#sprites )/d size = size ^ gamma, gamma >0.

    Qualitatively this means that there are a few big sprites and very many small ones.
  • With y being the thickness coordinate of the spiral (according to Celestia conventions), one may displace the (x,z) location of points below the top ones (on the surface). This may lead to a filling of the black areas...
  • One may simply increase the number of points in y-direction...

Here is what one gets for M74 and NGC 3338 with a mix of these three options:

[Click on image by all means for a bigger view]
Image
[Click on image by all means for a bigger view]
Image

What can we observe:

  • The granularity is clearly reduced. No doubt.
  • But the overall appearance has lost its "fluffyness". It looks a bit like made of concrete! ;-)
  • It is much slower! (this could be remedied by means of more modern OGL coding => VBO)


Do you like it? I don't, really. For me the price is too high once more...

In the end I find the default rendering NOT all that bad ;-)
In any case it's a big improvement compared to Celestia 1.6.1...

Reactions, please?

Fridger


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 22-03-13, 18:24 GMT 
Offline
User avatar

Joined: Sun, 02-09-07, 20:19 GMT
Posts: 196
Location: Montreal
Fridger,

indeed, we are both experiencing EXACTLY the same issues with sprites !

I MUCH prefer your first picture above. The galaxy rendering is very similar to my current nebula models. I think granulity isn't a bad thing, actually, and may be seen as a good compromise for clarity and efficiency (good frame rate). I think that this "fluffy" or "coarse granulity" is in fact pretty "natural" for a 3D space simulator.

I don't think it's a good idea about getting obssessive with "realism" and "exact accuracy" for a 3D space simulator, but this is another subject.

I experienced the same problems as for your second and third pictures. When the sprites are too big or too densely packed, the global rendering sucks ! There's a problem with luminosity and opacity : traveling within such a dense model isn't very satisfying visually (we don't see anything in a thick fog), and the impact on frame rate may be severe.

About the spacing between sprites, I defined a "filter" in Mathematica which helps in optimizing the density. We don't want sprites to be too far away from each other (dull rendering) or too close (luminosity and frame rate problems) :

Code:
SpriteSize[r_] := MinSprite + (MaxSprite - MinSprite) r;

MinSeparation[r_] := SpriteOverlap * SpriteSize[r];
KeepPoint[{p_, q_}] := Norm[p] < Norm[q]||Norm[p - q] > MinSeparation[Norm[p]];
FilterOnce[pts_] := With[{nf=Nearest[pts]}, Select[pts, KeepPoint[nf[#,2]]&]];

NewCloudsCoords = FixedPoint[FilterOnce, CloudsCoords];


I apply the filter "FilterOnce" to remove some points in the data called "CloudsCoords". The density optimized distribution of points is then "NewCloudsCoords".


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 22-03-13, 20:22 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4508
Location: Hamburg, Germany
Good, so we agree.

Returning to the default rendering in celestia.Sci: here is NGC 3338 that I showed above with modified reduced granularity.

[Click on image by all means and hit F11 subsequently in FireFox!]
Image

Fridger


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 22-03-13, 20:28 GMT 
Offline
User avatar

Joined: Sun, 02-09-07, 20:19 GMT
Posts: 196
Location: Montreal
Looks very nice. What's the view from the inside ?

Get "close and personal" !

_________________
"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!"


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group