[Release] System Features: Rings

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

Moderators: another_commander, winston

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 »

@phkb Thank you so much!

The newest version is now available via the extension manager:

07/10/2018 - Version 2.9:
* better handling of the alpha channel
User avatar
RockDoctor
---- E L I T E ----
---- E L I T E ----
Posts: 765
Joined: Sat May 01, 2010 9:05 pm
Location: Scotland

Re: [Release] System Features: Rings

Post by RockDoctor »

Prester John wrote: Sun Oct 07, 2018 6:00 pm
You just need a lot more memory on your PC, for all these graphics... :? Right?
I'm not really sure. I know that (some) of these effects are done using "shaders", which somehow offloads the processing required to a graphics sub-system away from the general processing unit. And I recall (from when I last paid attention to such matters, in the 1990s) that graphics cards sometimes (generally? I dunno) have separate memory to the main processor. But how all that adds up, or what bits go where is just a black hole to me.
If I've got work to do on the laptop, it involves text, and occasionally changing the font of the text (but generally, it's the words that matter, not the appearance), so as long as my computer does that, the rest is someone else's problem. Where's my Perilomatic (R) Sunglasses?
--
Shooting aliens for fun and ... well, more fun.
"Speaking as an outsider, what do you think of the human race?" (John Cooper Clark - "I married a Space Alien")
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: [Release] System Features: Rings

Post by Svengali »

@RockDoctor: °sigh°
@Prester John: Not so much memory. It's more a graphics card which can handle this.

@gsagostinho:The rings are looking great now, gsagostinho!

And after taking a look at the shader - some ideas:

1. It could be worth using Oolites fogUniform for the atmosphere instead. Then you can get rid of quite a bunch of instructions easily. Shift the work to Oolite .-)

2. Let's help the compiler to do the right thing.

Code: Select all

vec3 offset = (up * uFloat2 * -y * 2.0) + (right * uFloat2 * x * 2.0);
could be simplified to

Code: Select all

vec3 offset = ((up * -y) + (right * x)) * uFloat2 * 2.0;

3. Another one to help the compiler.

Code: Select all

r *= min(1.0, distance/5000000.0) - max(0.0, 1.0 - min(1.0, distance/5000000.0)) * sin(r2 * 3178.4 + phase);
doesn't need the max().

Code: Select all

r *= min(1.0, distance/5000000.0) - (1.0 - min(1.0, distance/5000000.0)) * sin(r2 * 3178.4 + phase);
The value will never get negative. And most compilers will reuse the min(1.0, distance/5000000.0), so I left it in. But there's no guarantee that the compiler will reuse it... <mumbles something about stupid things>


4. You could also get rid of some branching

Code: Select all

if (det < 1.0 && dist > 0.0) {
	float dp = (det - 0.8) * 5.0;
	if (dp < 0.2) {
		dp = 0.2;
	}
	r *= dp * 0.25;
	g *= dp * 0.25;
	b *= dp * 0.25;
}
could become

Code: Select all

float dark = float(det < 1.0) * float(dist > 0.0);
float dp = max(0.05,(det * 1.25) - 1.0);
dp = (dp * dark) + (1.0 - dark);
r *= dp;
g *= dp;
b *= dp;
A similiar approach could be used for the threshold calculations.

It's just a start, I know, but better than nothing.
Optimizations will take eat time.

Edit: Optimized further, got rid of logical_if.
Last edited by Svengali on Fri Oct 19, 2018 11:26 am, edited 2 times in total.
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 »

Thank you SO much, Svengali! Really appreciate this, I have just incorporated your suggestions and they work exactly as they should, so I just made a new release.
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 »

I just made some more updates:

- more optimizations
- rings get more transparent when entering an atmosphere
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 »

13/10/2018 - Version 2.10.2:
* some more minor optimizations
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: [Release] System Features: Rings

Post by phkb »

There seems to be a fault in the latest version. Here's a shot using a plain 1.86 and just the System Rings OXP (so no chance of any conflicts), at Riedquat (G1)
Image
(unless, of course, this is my graphics card going crazy on me...)
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, I think I know what happened and it should be fixed now. Could you please update your OXP and try again?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: [Release] System Features: Rings

Post by phkb »

Ah, much better! Thanks!
User avatar
Milo
---- E L I T E ----
---- E L I T E ----
Posts: 466
Joined: Mon Sep 17, 2018 5:01 pm

Re: [Release] System Features: Rings

Post by Milo »

After having my ship destroyed, I got the following exception:
Warning: removeFrameCallback(): invalid tracking ID.
Active script: System Features Ring effect script 2.10.3
systemfeatures-rings-effectScript.js, line 30:
removeFrameCallback(this.$fcb);
User avatar
RockDoctor
---- E L I T E ----
---- E L I T E ----
Posts: 765
Joined: Sat May 01, 2010 9:05 pm
Location: Scotland

Re: [Release] System Features: Rings

Post by RockDoctor »

Milo wrote: Fri Jun 19, 2020 4:07 pm
After having my ship destroyed, I got the following exception:
Warning: removeFrameCallback(): invalid tracking ID.
Active script: System Features Ring effect script 2.10.3
systemfeatures-rings-effectScript.js, line 30:
removeFrameCallback(this.$fcb);
What did you do? (So I can not-do that.)
I've never had a problem with pelting through a ring at torus drive speeds or under full military injectors - but I always flinch as I get the ground-rush which BASE jumpers describe.
--
Shooting aliens for fun and ... well, more fun.
"Speaking as an outsider, what do you think of the human race?" (John Cooper Clark - "I married a Space Alien")
User avatar
Milo
---- E L I T E ----
---- E L I T E ----
Posts: 466
Joined: Mon Sep 17, 2018 5:01 pm

Re: [Release] System Features: Rings

Post by Milo »

I haven't looked into it yet, but it seems to be happening around the time I arrive at the station after my ship is destroyed (I'm testing shields so this is happening a lot...). I can more consistently reproduce it now by loading a saved game after being returned to the station after getting my ship destroyed. I'm using Ship Repurchase, unsure if that makes a difference.
User avatar
RockDoctor
---- E L I T E ----
---- E L I T E ----
Posts: 765
Joined: Sat May 01, 2010 9:05 pm
Location: Scotland

Re: [Release] System Features: Rings

Post by RockDoctor »

Milo wrote: Fri Jun 19, 2020 9:13 pm
I'm using Ship Repurchase, unsure if that makes a difference.
I've never used that one. Which makes it a potential target, straight off.
--
Shooting aliens for fun and ... well, more fun.
"Speaking as an outsider, what do you think of the human race?" (John Cooper Clark - "I married a Space Alien")
Post Reply