BGS - The BackgroundSet

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

Moderators: winston, another_commander

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: BGS - The BackgroundSet

Post by Norby »

Tricky is missing and not responding to PMs so I uploaded BGS into my account in oxz admin. If this mean that I am the new maintainer then I am happy to accept this position, but no problem if anybody wants to get it back.

Based on the reactions I think the old effect stay as default and the new ones (both Svengali's simple texture and my harsh) can be available in OXPConfig.
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: BGS - The BackgroundSet

Post by Cody »

Tricky probably has his head hooked into ED - perhaps I'll try and attract his attention.
Norby wrote:
Based on the reactions I think the old effect stay as default and the new ones (both Svengali's simple texture and my harsh) can be available in OXPConfig.
<nods> Seems sensible.
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
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: BGS - The BackgroundSet

Post by Svengali »

Norby wrote:
Based on the reactions...
*grins* The joys of design decisions.

Just as sidenote. It's easily possible to use atan(y_over_x) instead of sqrt (see pics 1-4). The pics 1-3 are showing sqrt (standard jump, galactic jump and misjump), pic 4 atan(y_over_x). Pic 5 shows sqrt with a changed hexagon algorithm and pic 6 shows the texture using a alpha channel which is used as multiplier for discarding the change of the framebuffer.
Image
User avatar
kanthoney
Commodore
Commodore
Posts: 281
Joined: Thu Nov 07, 2013 10:21 pm

Re: BGS - The BackgroundSet

Post by kanthoney »

Svengali wrote:
The goal for a new shader was better performance, specially when using older gfx-cards. Using sqrt instead of atan2 gets rid of 13 ALU (or atan(y_over_x) 7 ALU) and lots of instructions, but it has consequences (hexagons and distribution of stars). It's a 'either - or' choice, not a problem - hence the question about Oolites OO_REDUCED_COMPLEXITY (which is gone it seems).
I don't know if it helps, but there's some code in the planet shader that approximately calculates atan:

Code: Select all

/* Approximation of atan(y/z) with quadrant rectification, scaled to -0.5..0.5 instead of -pi..pi.
It is assumed that the values are in range. You are not expected to understand this.
*/
float TexLongitude(float z, float y)
{
const float k2Pi = 6.283185307179586;
const float kMagic = 0.2732395447351; // (4 - pi) / pi
float ratio = z / y;
float r1 = 1.0 / ((ratio + kMagic / ratio) * k2Pi); // Result when abs(z) >= abs(x).
float r2 = 0.25 * sign(ratio) - ratio / ((1.0 + kMagic * ratio * ratio) * k2Pi); // Result when abs(z) <= abs(x).
float result = (abs(ratio) > 1.0) ? r1 : r2;
// Adjust for sector.
// Equivalent to (z < 0.0) ? ((y > 0.0) ? 0.75 : -0.25) : 0.25.
// Well, technically not equivalent for z < 0, y = 0, but you'll very rarely see that exact case.
return result + step(z, 0.0) * sign(y) * 0.5 + 0.25;
}
I don't know how it works, either!
Edit: Forgot to say - thanks kanthoney .-)
No problem!
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: BGS - The BackgroundSet

Post by cim »

Svengali wrote:
hence the question about Oolites OO_REDUCED_COMPLEXITY (which is gone it seems).
Yes. There were very few graphics cards which could cope with shaders at all but not with the things excluded in OO_REDUCED_COMPLEXITY, so if you used OO_REDUCED_COMPLEXITY to tune down the heavy shaders - things like the BGS hyperspace effects and the planetary rings - you'd end up also requiring users to exclude a lot of other things.
Norby wrote:
Based on the reactions I think the old effect stay as default and the new ones (both Svengali's simple texture and my harsh) can be available in OXPConfig.
Another option, since it's a transient effect: check whether graphics are set to "shaders on" or "extra detail", and use the old effect as default in "extra detail" and the new effect as default in "shaders on".
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: BGS - The BackgroundSet

Post by Svengali »

The final one? -> https://app.box.com/s/5nf7wj4bghftsovw5fdhpnn2iay4l6uc (29.3 KB)

Suggested input parameters (ovSpecials x and y), set through .bgsHyperControl in BGS-M.js:
0,0 - Standard
0,3 - Misjump
2,0 - Galactic jump

If you want a more colorful thing:
3,-3 - Deep Blue
-1.4,4.8 - Orange
-1.8,-2.2 - Green
kanthoney wrote:
I don't know if it helps, but there's some code in the planet shader that approximately calculates atan:
Thanks .-) The TexLongitude is fast, but asin(dot(normalize(cen),vec2(0.0,-1.0))) is a tick faster and uses less registers and instructions. I'm not so good at these things and probably I'm doing it all overly complicated .-)
cim wrote:
Svengali wrote:
hence the question about Oolites OO_REDUCED_COMPLEXITY (which is gone it seems).
Yes.
Ok. Thanks cim.
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: BGS - The BackgroundSet

Post by Cody »

Svengali wrote:
The final one?
Hmm...
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
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: BGS - The BackgroundSet

Post by Svengali »

Cody wrote:
Hurray :mrgreen:
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 675
Joined: Sat Aug 09, 2014 4:16 pm

Re: BGS - The BackgroundSet

Post by Commander_X »

Svengali wrote:
Blending is not supported by Oolite for AddOns. The alpha channel is used for brightness.
Thank you for the heads up. I was dabbling with the BGS shaders, and struggled (SIC!) to a similar conclusion.
One last question: would it be hard to replace the black rectangle of death of the docking transition in BGS with the (say) manifest image background?
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: BGS - The BackgroundSet

Post by Norby »

I set these in the first line of the screenshots below:
3,-3 - Standard jump (blue)
2,0 - Galactic jump (purple)
0,3 - Misjump (red)

I tried with the old "lightning" texture in the second line, this is much closer to the original effect in the third line.

ImageImageImage

So I think the second line should be the new default in "shaders on" mode, the third line in "extra detail" mode and the first will be available in OXPConfig.

Edit: alternative idea is moved to my next post.
Last edited by Norby on Fri May 29, 2015 11:51 pm, edited 2 times in total.
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: BGS - The BackgroundSet

Post by Cody »

My machine is set to extra detail, and I don't much like the two orange ones - blue and purple are fine, but please not orange.
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
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: BGS - The BackgroundSet

Post by Norby »

This is red, not orange, but I can set it to more red. You can see below when set to 3 (the previous), 4, and 5. I think 4 is enough.

Image


I have an alternative idea to avoid OXPConfig and show variations: the effect can depend on the distance of the jump to show different distorsions in various speeds caused by the nonlinear distance vs. travel time formula. Galaxy jump effects can be different also based on the number of galaxy assuming different distances.
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: BGS - The BackgroundSet

Post by Cody »

Guess I'll have to start using OXPConfig.

Centre for standard jump, top left for gal jump, and bottom right for misjump - but that's only my preference.
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
Getafix
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 979
Joined: Tue Apr 01, 2008 12:55 pm
Location: A small ice asteroid, orbiting Oresrati in Galaxy 8 (a.k.a. northwest Armorica).
Contact:

Re: BGS - The BackgroundSet

Post by Getafix »

Cody wrote:
...but that's only my preference.
No it's not! :wink:
"Any sufficiently advanced information is indistinguishable from noise." [Newman, Lachmann, Moore]
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: BGS - The BackgroundSet

Post by Cody »

Getafix wrote:
Cody wrote:
...but that's only my preference.
No it's not!
Innate good taste - very few have it!
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!
Post Reply