Page 334 of 460

Re: Screenshots

Posted: Sun Jul 16, 2017 4:53 pm
by gsagostinho
Messing around with the System Features Rings OXP, trying to get more variety in ring size, thickness, allowing large planets also to NOT have rings, etc.:

Image

Image

Image

Image

Questions:
- does anyone know why the rings disappear after a certain distance (around 2.7 OU). This is particularly noticeable for people using distant suns, extra planets and/or torus to sun oxp's.
- if the rings could be set to 0.7-0.8 opacity they probably would look much better, but I found no way of having semi-transparent objects in Oolite. Is that possible, and if so is this documented somewhere?

Re: Screenshots

Posted: Sun Jul 16, 2017 6:28 pm
by Norby
gsagostinho wrote: Sun Jul 16, 2017 4:53 pm
semi-transparent objects in Oolite
There is a way using shaders as in Flying Dutchman OXP:
Image

Re: Screenshots

Posted: Sun Jul 16, 2017 6:38 pm
by another_commander
Check also the atmosphere shaders in the current trunk builds. Atmospheres fade out if you are too close or too far from the planet and this is done by adjusting the alpha of the atmosphere drawable entity.

Re: Screenshots

Posted: Sun Jul 16, 2017 7:30 pm
by gsagostinho
Thanks guys, I will check it out and see if I manage to solve the issues.

Re: Screenshots

Posted: Sun Jul 16, 2017 7:54 pm
by gsagostinho
@another_commander if I understand correctly the atmosphere shader, you are basically using a variable named newOpacity to control opacity, ranging between 0.0 and 1.0. This variable is then used together with a vector of 3 elements to give the final 4 element vector gl_FragColor = vec4(totalColor, newOpacity); is that correct? If so, then I don't get why I am running into troubles because I tried something very similar: in the end of the fragment shader's code used by the Rings OXP, after all calculations for each of the three RGB components is done, we have gl_FragColor = vec4(r,g,b,1.0);. Changing r g and b does change the colour of the rings, but changing the last value to something lower than 1.0 does NOT change the opacity of the rings. Is there something else I need to check for this to work?

@Norby as for the Flying Dutchman OXP, that work does not use half-transparency, it uses either full transparency or full opacity.

Re: Screenshots

Posted: Sun Jul 16, 2017 8:02 pm
by Cody
I have an extra line in the atmosphere shader - newOpacity *= 0.6; and adjust the 0.6 to my taste, inserted thus:

Code: Select all

float dp = abs(dot(nvEyeVector, vec3(0.0,0.0,1.0)));
		if (dp > 0.16) {
			newOpacity = min(1.0, pow(0.16/dp,2.0)) * quant;
		}
		else
		{
			newOpacity = pow(dp/0.16,5.0) * quant;
		}
		newOpacity *= 0.6;
	}

	gl_FragColor = vec4(totalColor, newOpacity);
}
Does that provide a clue, or am I missing the point?

Re: Screenshots

Posted: Sun Jul 16, 2017 8:20 pm
by gsagostinho
@Cody Thanks but unfortunately I don't think that helps either. You are simply multiplying the opacity value by a constant as to get more transparency, but the point is that the effect is working so that's why you can scale it with that multiplication. The issue with the ring's shader is that no matter what I use as the 4th input to of gl_FragColor, e.g. gl_FragColor = vec4(r,g,b,0.2);, I always get full opacity, as if the last component was a 1.0.

Re: Screenshots

Posted: Sun Jul 16, 2017 10:33 pm
by gsagostinho
Managed to apply ambient light to the rings:

Image

Image

Image

Re: Screenshots

Posted: Mon Jul 17, 2017 4:36 am
by phkb
gsagostinho wrote:
Managed to apply ambient light to the rings:
Awesome! Is this an easy-to-apply tweak?

Re: Screenshots

Posted: Mon Jul 17, 2017 12:21 pm
by gsagostinho
phkb wrote: Mon Jul 17, 2017 4:36 am
gsagostinho wrote:
Managed to apply ambient light to the rings:
Awesome! Is this an easy-to-apply tweak?
It actually is. The last statement in systemfeatures-rings.fragment is

Code: Select all

                    gl_FragColor = vec4(r,g,b,1.0);
Simply replace it with:

Code: Select all

                    vec3 diffuseColor = gl_LightSource[1].diffuse.rgb; // Diffuse light

                    vec3 totalColor = vec3(0);
                    totalColor += vec3(r,g,b) * diffuseColor;

                    gl_FragColor = vec4(totalColor, 1.0);
That said, I do plan to release these modifications if cim finds them interesting. I am just waiting for his answer, as well as trying to figure out the ring transparency and draw distance issues.

Re: Screenshots

Posted: Mon Jul 17, 2017 12:41 pm
by spara
I don't think you can do much about the drawing distance. To my understanding it's a built-in limitation.

Re: Screenshots

Posted: Mon Jul 17, 2017 12:53 pm
by Norby
gsagostinho wrote: Mon Jul 17, 2017 12:21 pm
ring transparency and draw distance issues.
Just an idea against the sudden appearance when you enter into the distance limit: start at full transparency and reduce slowly to the final opacity when you come closer.

Re: Screenshots

Posted: Mon Jul 17, 2017 1:01 pm
by gsagostinho
spara wrote:
I don't think you can do much about the drawing distance. To my understanding it's a built-in limitation.
Yes, I am also afraid that will be the case. But that said, I have the impression that certain objects are visible much further away. I have to test this, but I have the impression that those solar stations from WildShips can be spotted much further away than that (even with the Distant Suns OXP, you can see their silhouette against the sun). But perhaps I am wrong and the stations aren't that far away. If that's the case, then nothing to be done.
Norby wrote:
gsagostinho wrote: Mon Jul 17, 2017 12:21 pm
ring transparency and draw distance issues.
Just an idea against the sudden appearance when you enter into the distance limit: start at full transparency and reduce slowly to the final opacity when you come closer.
Yes, that's a great idea. If I manage to find a solution for this transparency issue then this could be a possible solution :)

Re: Screenshots

Posted: Mon Jul 17, 2017 5:30 pm
by Tichy
Wow this is a great improvement over the older rings! :o

Re: Screenshots

Posted: Mon Jul 17, 2017 6:55 pm
by Commander_X
gsagostinho wrote:
Yes, that's a great idea. If I manage to find a solution for this transparency issue then this could be a possible solution :)
I guess one of the issues you're facing in not being able to use the alpha component of the colour is that the material for rings doesn't consider alpha.
I am not sure how/where is the rings material spawned from, although I've been trying to tweak the rings a while ago (with an attempt to get rid of these Moire patterns) -- I left that at an "in-work" status :roll: .