@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:
vec3 offset = (up * uFloat2 * -y * 2.0) + (right * uFloat2 * x * 2.0);
could be simplified to
Code:
vec3 offset = ((up * -y) + (right * x)) * uFloat2 * 2.0;
3. Another one to help the compiler.
Code:
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:
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:
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:
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.