[Release] System Features: Rings

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

Moderators: winston, another_commander

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

Re: [Release] System Features: Rings

Post by gsagostinho » Sun Oct 07, 2018 11:05 pm

@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
Deadly
Deadly
Posts: 243
Joined: Sat May 01, 2010 9:05 pm
Location: Scotland
Contact:

Re: [Release] System Features: Rings

Post by RockDoctor » Tue Oct 09, 2018 6:32 pm

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.
"I'm just stepping out of the airlock for a breath of fresh vacuum. I may be gone some time."

User avatar
Svengali
---- E L I T E ----
---- E L I T E ----
Posts: 2365
Joined: Sat Oct 20, 2007 2:52 pm

Re: [Release] System Features: Rings

Post by Svengali » Tue Oct 09, 2018 8:46 pm

@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: 563
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho » Tue Oct 09, 2018 9:21 pm

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: 563
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho » Tue Oct 09, 2018 11:11 pm

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: 563
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho » Sat Oct 13, 2018 10:30 pm

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

User avatar
phkb
Commodore
Commodore
Posts: 2357
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: [Release] System Features: Rings

Post by phkb » Tue Oct 16, 2018 12:56 pm

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: 563
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] System Features: Rings

Post by gsagostinho » Tue Oct 16, 2018 8:59 pm

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
Commodore
Commodore
Posts: 2357
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: [Release] System Features: Rings

Post by phkb » Tue Oct 16, 2018 10:44 pm

Ah, much better! Thanks!

Post Reply