[Release] System Features: Rings

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

[Release] System Features: Rings

Post by gsagostinho »

System Features: Rings
======================

Version: 2.10.3
Required Oolite Version: 1.84
Author: cim, Gilberto Agostinho (gsagostinho)
License: CC-BY-SA 3.0

About
=====

This OXP adds some dust rings to a few planets in each galaxy. Whether those rings are traditional gas giant rings or debris rings from industry or long-past battles depends on your planet texture OXP. A shader-supporting graphics card is required, the more recent the better. Older shader-supporting cards may be too slow to render the rings at an adequate framerate.

Version history
===============


16/10/2018 - Version 2.10.3:
- Fixing a newly introduced bug in the visuals of the gaps in the rings.

13/10/2018 - Version 2.10.2:
- some more minor optimizations.

09/10/2018 - Version 2.10.1:
- more optimizations.
- rings get more transparent when entering an atmosphere.

09/10/2018 - Version 2.10:
- optimized some of the shader's code (thanks Svengali!).

23/09/2017 - Version 2.8.1:
- bug in the description text now properly solved, it was still present due to a small oversight (thanks again, Cody).

23/09/2017 - Version 2.8:
- changed description text to "This planet has rings."
- fixed a bug in which the description text appears many times (thanks Cody and Norby).

19/09/2017 - Version 2.7:
- added "use strict"; to scripts which removes some warnings in the log.
- rings are now a little bit more common (1/8 of planets will have them).
- the description of a system will now tell whether it has rings or not (thanks phkb for the help implementing this!).
- close-up grain density now proportional to the colour intensity of the ring lane.
- fixed bug in which Ribior's main station would spawn inside rings (thanks to spara, cim and all others for the suggestions and spara for doing the all hard work for the fix).

27/08/2017 - Version 2.6:
- the sinusoidal functions which create the variations of colour intensity now fade in one by one according to the distance, which solves the Moire pattern problems.
- shading applied at close distances so that the grains look like rocks.

17/08/2017 - Version 2.5:
- fix for a small bug affecting certain cards (wrong type for second argument of pow).

03/08/2017 - Version 2.4:
- change to shader to fix a bug with certain ATI cards.

24/07/2017 - Version 2.3:
- code refactoring.
- rings fade into blue when entering the atmosphere (such as when using PlanetFall).

20/07/2017 - Version 2.2:
- smaller ring bands and grains only visible at closer distance.
- improved the issues with moire pattern, in particular at lower resolutions.

20/07/2017 - Version 2.1:
- the large gaps in the rings are now randomized making each system more unique.
- the colour gradient function is also randomized for more unique rings.
- renamed the effect script.

19/07/2017 - Version 2.0:
- rings now have different relative sizes to the planet.
- they also have different radial length.
- applied a slight yellow tint.
- applied ambient light.
- shadows are darker.
- changed the spawning algorithm which, among other things, make the rings more common.
- ring now uses a colour gradient instead of a texture (which is now only used to generate noise).

Version 1.2:
- use 1.80 features, repackage.

Version 1.1:
- improved ring texture and appearance contributed by ZygoUgo.

Version 1.0:
- initial non-beta release.

Links
=====

Download it via the extension manager in the game.

Elite Wiki: http://wiki.alioth.net/index.php/System_Features_Rings
Bulletin Board thread: viewtopic.php?f=4&t=12544

Screenshots
===========

Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Last edited by gsagostinho on Tue Oct 16, 2018 9:00 pm, edited 18 times in total.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: [Release] System Features: Rings

Post by spara »

Awesome work. 8) 8) 8)
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho »

Thanks, spara! :D

* * *

I have just uploaded a slightly improved version of this OXP to my Dropbox. Now the large gaps in the rings, as well as the colour gradient function, are more randomized so each system looks even more unique. The lower resolution images here in the forum do not show the rings very well as they create quite a lot of aliasing, so here are some high res screenies: https://www.dropbox.com/sh/hyjoyjflt3gu ... FHYea?dl=0

I would be very interested if anyone is suffering with performance while using this OXP, in particular when comparing to version 1.x by cim. I have just started messing around with GLSL shaders so there is a non-zero chance I am doing something suboptimal.

For testing purposes, if you want rings on every system please backup your Scripts/systemfeatures-rings.js file then replace it with the following:

Code: Select all

this.author      = "cim and gsagostinho"; 
this.copyright   = "(c) 2011-2017 cim and gsagostinho"; 
this.licence = "CC-BY-SA 3.0";
this.version     = "2.1"; 
this.name = "System Features: Rings";

this.systemWillPopulate = function() {
    	system.setPopulator("system-features-rings",
				{
					callback: this._addRing.bind(this),
					coordinates: system.mainPlanet.position,
					priority: 1000
				});
}

this._addRing = function() {		
		var ring = system.addVisualEffect("systemfeatures-rings",system.mainPlanet.position);
		ring.orientation = system.mainPlanet.orientation;
		ring.orientation = ring.orientation.rotate(ring.orientation.vectorRight(),Math.PI/2);

}
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: [Release] System Features: Rings

Post by Cody »

I run with a low ambient light level - is that why the 'shadow' disappears the rings completely?
I'm not seeing any appreciable performance hit, btw.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho »

Cody wrote: Thu Jul 20, 2017 11:52 am
I run with a low ambient light level - is that why the 'shadow' disappears the rings completely?
Hi Cody, I also use a lower ambient light level but apparently you use an even lower value than me! :) I think that what is happening is that the rings are not disappearing, but that because the thin bands appear when you are close, you can see the stars from the holes, and since the rings are solid black on your very low amb light configuration, they look just like the regular sky. Could you please make me a test and take a screenshot of the shadow part from a good distance (something like my first screenie in the first post)? From that distance, the ring will be completely solid except for one or two large bands, and so even if it is solid black due to the ambient light it should not show any stars.

If you want to tweak the darkness of the shadow, please take a look on lines 114-116:

Code: Select all

						r *= dp * 0.25; // making shadows darker by multiplying cim's calculations by 0.25
						g *= dp * 0.25;
						b *= dp * 0.25;
This value of 0.25 was added by me to make the shadows darker and match the planet dark side. If you think the rings are too dark, try raising it for all three variables. The equivalent value used by the shadows of version 1.x was dp * 0.25.
I'm not seeing any appreciable performance hit, btw.
That's great to know! 8)
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho »

@Cody Please take a look at this this screenshot and see how the stars are quite visible through the holes in the rings when close to them. So in your case, the rings are being masked by the dark sky.

Image
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: [Release] System Features: Rings

Post by Cody »

At distance, no real problem - though dark, the rings still obscure the background stars. Ambient level is 0.025
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: [Release] System Features: Rings

Post by another_commander »

No noticeable performance drop on my low-end system. But I see severe moiré patterns, much more intense than in the old version and it is quite jarring, to be honest.
Image
Image
Image
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho »

Cody wrote:
At distance, no real problem - though dark, the rings still obscure the background stars. Ambient level is 0.025
Ambient level is 0.025?! That's really dark! :shock: :D I use the Realistic Stars OXP which lowers it to 0.1 but you take the cake :)

Anyway, so that's what I was suspecting.Your easiest option would be to raise that value that multiply those three lines I mentioned before. Try raising it from 0.25 to 0.5 or 1.0 and see how it looks. The issue is that the smaller bands are only visible when you get closer to them, so from far away the rings are solid but closer they have holes. Give it a try and let me know how it goes.
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho »

another_commander wrote: Thu Jul 20, 2017 1:02 pm
No noticeable performance drop on my low-end system. But I see severe moiré patterns, much more intense than in the old version and it is quite jarring, to be honest.
Could that be because of different resolution? In my system, I had severe moire patterns with the previous version and now the situation is much much better. Do you know what planet is it on these screenshots of yours?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: [Release] System Features: Rings

Post by another_commander »

gsagostinho wrote: Thu Jul 20, 2017 1:07 pm
Do you know what planet is it on these screenshots of yours?
Lave, just after exiting the station. And yes, going to higher resolution (from 800 x 600 to 1440 x 900) changes the situation to somewhat better, but it's still very intense.
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho »

@another_commander Thanks, I will inspect that.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: [Release] System Features: Rings

Post by Cody »

Yeah, I forgot to mention the more-intense moiré patterns (at my current max resolution of 1280x1024).
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho »

Ok guys, so I did some experiments as well as some research and it seems to me that not much can be done with the current approach to the rings. The Moire patterns appear due to the fact that a row of nearby pixels are oscillating from black to bright in a very small area (ship at a medium-getting-close distance from rings, they just start to become individualized and noisy). When we get closer, things get fine, and far away is also fine. This problem is greatly aggravated by resolution, as the higher resolution a screen has the higher frequency of oscillation of pixels it can handle. So while the problem is perceivable at 1080p, it is nowhere as bad as in 800x600. See here some comparisons (I took the shots both at 1920x1080 and 800x600 in-game, then cropped the 1080p so that resizing it for the forum does not introduce more moire patterns, but each pair of shots is from an identical situation):

Image
Image
Image
Image

I tried tweaking the code so that the smaller bands and the noise would only appear at close distance, but then the whole thing look strange when looking at the ring nearly horizontally:

Image

As for the previous version having less Moire patterns, are you sure about that? Perhaps because it used the texture for the small details made it less susceptible to it, but in my system, I see basically the same amount of moire patterns as before, perhaps even less now, e.g. these are screenshots when this was still a work in progress and in which I only had tweaked the colours and sizes of the rings but not touched the code that produces the holes, noise, texture, etc.: https://bb.oolite.space/viewtopic.php?f= ... 95#p257661

Anyway, here are a couple of approaches that comes to my mind:

- leaving things as they are :( (though I am still trying to tweak the values to at least minimize the issue)
- making the ring solid no matter the distance. This will make it look good from far and medium distances, but not good at closer distances
- if using transparency would be possible, I could make the rings more transparent the closer one is, so it would look like the ring is made out of very thin dust. I imagine this would look really good, but then we are once again on that issue of transparency... Anyway, this shot below (faked using GIMP) shows what I imagine it could look like:

Image

Or does anyone has some other concrete advices on how to tackle this?
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho »

Ok, after a lot of tweaking and testing I think I managed to get some better results and virtually eliminate any moire pattern resulting from the bands (holes) in the ring (they are still a little bit present due to the colour gradients, but this is much less noticeable even at very low resolutions). I tweaked a lot the equation that handles the noise and smaller bands, so that it becomes active only at a much nearer distance. This gives the granularity at very close distances while looking better from far away. I tested both at 800 x 600 and 1920 x 1080, please screenshots are here:

https://www.dropbox.com/sh/71b22arsy0fe ... qh1ha?dl=0

So version 2.2 is already uploaded to my Dropbox. I would really appreciate if you guys can give me some more feedback with this one! (and thanks a lot for all the feedback so far with all my OXPs!) :D
Post Reply