DrawDistance for effects And planets

An area for discussing new ideas and additions to Oolite.

Moderators: another_commander, winston

User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1474
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

DrawDistance for effects And planets

Post by Frame »

Could drawdistance be the same for Effects as for Planets ? and the planets/sun drawdistance be that of 1.84 instead of the currently 10 million KM. I cannot it seems be able to build it myself to test.

Currently the effects fall for the about 2.8 KM s draw distance for standard objects.
IMO effects should not suffer from this.

Planets in the current github build dissapear at 10 million km

I Tried simulating a real size sun but it gets into the front of planets when it should not
in 1.84, alternatively i could make all planets but the main one effects but that opens
a whole other set of problems :).
Bounty Scanner
Number 935

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5730
Joined: Wed Feb 28, 2007 7:54 am

Re: DrawDistance for effects And planets

Post by another_commander »

Frame wrote:
Thu Jan 12, 2017 12:16 am
and the planets/sun drawdistance be that of 1.84 instead of the currently 10 million KM.
Not sure what the actual problem might be here, but there is no change between 1,84 and 1,85 on how draw distances are handled. 1.84 also has a 10MKm MAX_CLEAR_DEPTH set.

User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1474
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Re: DrawDistance for effects And planets

Post by Frame »

another_commander wrote:
Thu Jan 12, 2017 12:23 pm
Frame wrote:
Thu Jan 12, 2017 12:16 am
and the planets/sun drawdistance be that of 1.84 instead of the currently 10 million KM.
Not sure what the actual problem might be here, but there is no change between 1,84 and 1,85 on how draw distances are handled. 1.84 also has a 10MKm MAX_CLEAR_DEPTH set.

in 1.84:Effects cut of rendering at about 2.8 MKm. Even very large ones. oh well, should have made a video :).

But in this case i made a very large sun and scaled it to apparent size.

The drawdistance for planets in 1.84 seems to be unlimited, not 10 MKm.
In 1.85 however it stops rendering at 10MKm
Bounty Scanner
Number 935

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5730
Joined: Wed Feb 28, 2007 7:54 am

Re: DrawDistance for effects And planets

Post by another_commander »

What is the exact version string of the nightly you use to test 1.85?

User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1474
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Re: DrawDistance for effects And planets

Post by Frame »

another_commander wrote:
Fri Jan 13, 2017 1:36 pm
What is the exact version string of the nightly you use to test 1.85?
I downloaded the src via github applied pull request 153, then make debug = 0, like in the thread that was originally in the screenshots thread.
video.

If i write Oolite.versionString it just writes 1.85
Bounty Scanner
Number 935

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5730
Joined: Wed Feb 28, 2007 7:54 am

Re: DrawDistance for effects And planets

Post by another_commander »

OK, what you have there is NOT 1.85 trunk. PR#153 has NOT been merged into the main source yet. Standard 1.85 trunk should behave exactly like 1.84 on planet draw distances. You can test by downloading the latest nightly binary from http://terrastorage.no-ip.info/oolite/status_win64.html and installing it in a clean folder.

User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1474
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Re: DrawDistance for effects And planets

Post by Frame »

still the same. effects cut of rendering at about 2.6... Se video.
Oh btw forgot to record, planets do cut off at 10 MKm. I can make a new video of it if you like.

Edit, sry its actually less, at about 4.4 MKm.

https://www.youtube.com/watch?v=LRmVheh9erk
Bounty Scanner
Number 935

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5730
Joined: Wed Feb 28, 2007 7:54 am

Re: DrawDistance for effects And planets

Post by another_commander »

Could it be the new atmosphere shader? Try this: In the 1.85 folder, go to Resources/Shaders and rename the file oolite-default-atmosphere.fragment to something else. This will force a fall-back to the previous (1.84) style of atmosphere rendering. Then repeat the test. Do planets still disappear at 4.4MKm?

User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1474
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Re: DrawDistance for effects And planets

Post by Frame »

another_commander wrote:
Fri Jan 13, 2017 8:32 pm
Could it be the new atmosphere shader? Try this: In the 1.85 folder, go to Resources/Shaders and rename the file oolite-default-atmosphere.fragment to something else. This will force a fall-back to the previous (1.84) style of atmosphere rendering. Then repeat the test. Do planets still disappear at 4.4MKm?
Affirmative.. It is the planet atmosphere shaders that causes the planets to vanish, i can see all planets from very far out now. Currently viewing Jupiter from 0.26 AU or ca 39 MKm.

So it is the shaders!. Does this complicate matters ?.
Bounty Scanner
Number 935

Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 420
Joined: Sat Aug 09, 2014 4:16 pm

Re: DrawDistance for effects And planets

Post by Commander_X »

Frame wrote:
Fri Jan 13, 2017 8:57 pm
So it is the shaders!. Does this complicate matters ?.
Although I don't understand why is it happening to you, you can try this change in the oolite-default-atmosphere.fragment file:
instead of last lines reading

Code: Select all

	}

	gl_FragColor = vec4(totalColor, newOpacity);
}
try

Code: Select all

	} else {
		discard;
	}

	gl_FragColor = vec4(totalColor, newOpacity);
}
This should cut-off the last line outside the activation distance.
My only bet is that something in this line doesn't pan out for what you're trying.

User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1474
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Re: DrawDistance for effects And planets

Post by Frame »

Commander_X wrote:
Sat Jan 14, 2017 1:34 am
Frame wrote:
Fri Jan 13, 2017 8:57 pm
So it is the shaders!. Does this complicate matters ?.
Although I don't understand why is it happening to you, you can try this change in the oolite-default-atmosphere.fragment file:
instead of last lines reading

Code: Select all

	}

	gl_FragColor = vec4(totalColor, newOpacity);
}
try

Code: Select all

	} else {
		discard;
	}

	gl_FragColor = vec4(totalColor, newOpacity);
}
This should cut-off the last line outside the activation distance.
My only bet is that something in this line doesn't pan out for what you're trying.
Thanks for the input, i tried that, but that does not "fix" it, it makes planets pop-vanish and pop-appear again, like here.

https://youtu.be/3b93gSznkBA
Bounty Scanner
Number 935

Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 420
Joined: Sat Aug 09, 2014 4:16 pm

Re: DrawDistance for effects And planets

Post by Commander_X »

The atmosphere effect seems to be behaving correctly, i.e. becomes transparent (newOpacity=0.0) a bit before the "central lighting" appears.

If I understood correctly, you scaled the planets way more than they are in the game. The shader uses the collisionRadius uniform (which should be the atmosphere's radius, because it is a sphere) in the calculations. If you didn't apply the right scaling to this entity as well, it might happen so that at higher distances the planet and atmosphere spheres have roughly (approximated) the same radius. What I'm trying to say is that if, e.g., the atmosphere_radius=planet_radius + extra, and not planet_radius * X%, then that "extra" could be your culprit.
Also your screen has an extra overlay (the yellow E:D like reticule) - do you get the same result without it present on the screen (say, if you look aft but you have it targeting something in front)?

I cannot say I've noticed this behavior in game, i.e. the planets "melt" nicely when small enough.

User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1474
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Re: DrawDistance for effects And planets

Post by Frame »

Commander_X wrote:
Sat Jan 14, 2017 8:08 pm
The atmosphere effect seems to be behaving correctly, i.e. becomes transparent (newOpacity=0.0) a bit before the "central lighting" appears.

If I understood correctly, you scaled the planets way more than they are in the game. The shader uses the collisionRadius uniform (which should be the atmosphere's radius, because it is a sphere) in the calculations. If you didn't apply the right scaling to this entity as well, it might happen so that at higher distances the planet and atmosphere spheres have roughly (approximated) the same radius. What I'm trying to say is that if, e.g., the atmosphere_radius=planet_radius + extra, and not planet_radius * X%, then that "extra" could be your culprit.
Also your screen has an extra overlay (the yellow E:D like reticule) - do you get the same result without it present on the screen (say, if you look aft but you have it targeting something in front)?

I cannot say I've noticed this behavior in game, i.e. the planets "melt" nicely when small enough.
The Reticle is just a model effect vector().interpolated to about 50000 km from the player at any one time towards the target. It is working totally independant and will target anything. Even stations.

But, wouldn't

Code: Select all

discard
Tell it to render nothing ? as in being totally transparent thus behaving like expected.

https://www.opengl.org/sdk/docs/tutoria ... iscard.php

Well, I went ahead and tested it with this instead

Code: Select all

else
	{
		newOpacity = 0.01;
	}

All i then got was the atmosphere. The planet itself vanished, I then began thinking that maybe it is a sort of overflow as the distance is about that of an usigned 32 bit int.
Last edited by Frame on Sun Jan 15, 2017 12:28 am, edited 1 time in total.
Bounty Scanner
Number 935

Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 420
Joined: Sat Aug 09, 2014 4:16 pm

Re: DrawDistance for effects And planets

Post by Commander_X »

Frame wrote:
Sat Jan 14, 2017 11:21 pm
But, wouldn't

Code: Select all

discard
Tell it to render nothing ? as in being totally transparent thus behaving like expected.

https://www.opengl.org/sdk/docs/tutoria ... iscard.php
Yup, that was the intention.
As opposed to the git committed version of the shader, which is "rendering" totally transparent pixels once the distance to the atmosphere is greater than 12 times its radius, the "discard" change would abort processing altogether (also enhancing a bit the performance by not executing the last line _and_ presenting its output on the screen). The fact that this doesn't fix your problem but the absence of the shader does, it's the real mystery.

User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1474
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Re: DrawDistance for effects And planets

Post by Frame »

Commander_X wrote:
Sun Jan 15, 2017 12:10 am
Frame wrote:
Sat Jan 14, 2017 11:21 pm
But, wouldn't

Code: Select all

discard
Tell it to render nothing ? as in being totally transparent thus behaving like expected.

https://www.opengl.org/sdk/docs/tutoria ... iscard.php
Yup, that was the intention.
As opposed to the git committed version of the shader, which is "rendering" totally transparent pixels once the distance to the atmosphere is greater than 12 times its radius, the "discard" change would abort processing altogether (also enhancing a bit the performance by not executing the last line _and_ presenting its output on the screen). The fact that this doesn't fix your problem but the absence of the shader does, it's the real mystery.
disregard my edit, your input came in between.

could this be a sort of an overflow problem, since i noticed that the planet vanish about the range of a 32 bit ULONG_MAX or 4294967297.

I'm not to well versed in that kind of mathematics, so it is a long shot.
Bounty Scanner
Number 935

Post Reply