Page 44 of 50

Re: BGS - The BackgroundSet

Posted: Thu May 28, 2015 12:58 pm
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.

Re: BGS - The BackgroundSet

Posted: Thu May 28, 2015 1:01 pm
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.

Re: BGS - The BackgroundSet

Posted: Thu May 28, 2015 2:28 pm
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

Re: BGS - The BackgroundSet

Posted: Thu May 28, 2015 4:28 pm
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!

Re: BGS - The BackgroundSet

Posted: Thu May 28, 2015 5:08 pm
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".

Re: BGS - The BackgroundSet

Posted: Fri May 29, 2015 12:06 pm
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.

Re: BGS - The BackgroundSet

Posted: Fri May 29, 2015 12:19 pm
by Cody
Svengali wrote:
The final one?
Hmm...

Re: BGS - The BackgroundSet

Posted: Fri May 29, 2015 5:55 pm
by Svengali
Cody wrote:
Hurray :mrgreen:

Re: BGS - The BackgroundSet

Posted: Fri May 29, 2015 10:17 pm
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?

Re: BGS - The BackgroundSet

Posted: Fri May 29, 2015 11:31 pm
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.

Re: BGS - The BackgroundSet

Posted: Fri May 29, 2015 11:44 pm
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.

Re: BGS - The BackgroundSet

Posted: Sat May 30, 2015 12:07 am
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.

Re: BGS - The BackgroundSet

Posted: Sat May 30, 2015 12:16 am
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.

Re: BGS - The BackgroundSet

Posted: Sat May 30, 2015 5:13 am
by Getafix
Cody wrote:
...but that's only my preference.
No it's not! :wink:

Re: BGS - The BackgroundSet

Posted: Sat May 30, 2015 10:26 am
by Cody
Getafix wrote:
Cody wrote:
...but that's only my preference.
No it's not!
Innate good taste - very few have it!