net-lisias-ksp / DistantObject

Distant Object Enhancement (DOE) is a visual enhancement mod that makes objects realistically visible over large distances.
Other
10 stars 3 forks source link

Prevent distant planets from being visible trough the Atmosphere #2

Open Lisias opened 3 years ago

Lisias commented 3 years ago

Fellow Kerbonaut Krazy1 remembered about an old request from another Fellow Kerbonaut infinite_monkey:

Planets appear as a dark spot visible through the atmosphere. They should be hidden behind it, just like the stars. Would it be possible to fix that?

Additionally, Fellow Kerbonaut Krazy1 complements:

Planets show directly though the sun. Like this:

Well… I will try. :)

I don't have the slightest idea how to fix it, but I remember something on Unity about layers (it's the reason it's so difficult nowadays to select a craft on KSC as target - the layer of the icon if the craft, mistakenly, is lower than the layer of the icon of KSC).

Lisias commented 3 years ago

The layer stunt works on sprites. It will not help my ass here.

I will need to give a nice peek on Scatterer et all to understand how the Atmospheres are drawn, but from a preliminary overview, things does not look good - the Atmosphere appears to be drawn immediately after the skybox and before any 3D object…

Since reordering this would be essentially reimplementing Scatterer myself (a daunt task to say the least), I will try to stunt my way out of the mess. Perhaps I could try to use transparency?

Lisias commented 2 years ago

Additionally, perhaps we could do the same to Comets as request on Forum?

image

Lisias commented 2 years ago

Fellow Kerbonaut Alioth81 also talked about this on Forum. Nice shot, by the way!

tP1Ku6p

Lisias commented 2 years ago

That's the problem… Somewhere in the past, the body flares was moved to the layer 10 due PlanetShine. But then they started to misbehave.

Later they were all moved to layer 15.

My best guess is that moving the Body Flares to layer 15 was a bad idea. Even 10 was less than ideal. The Body Flares should be placed behind the Atmosphere layers (9).

See https://wiki.kerbalspaceprogram.com/wiki/API:Layers for gory details.

Lisias commented 2 years ago

it worked as intended.

Fixed on commit https://github.com/net-lisias-ksp/DistantObject/commit/88341b75bea344ff30ba2aa9896c1ffda1f7fa21

Lisias commented 2 years ago

Reopening the damned thing, as the fix made the flares (unsurprisingly, to tell you the true) be rendered behind their bodies, screwing up with the damned feature.

The way to go is more or less this one, but I'm afraid I will need to cast a new ray to check if there's an atmosphere behind the body flares….

Lisias commented 2 years ago

Removing the milestone of this thing, as I don't know when I will have time to research this thing again.

Lisias commented 2 years ago

Reopening this thing again. How in hell this was closed???

Lisias commented 2 years ago

Fellow Kerbonaut ColdJ suggested the following material as reference (documenting it here or I will lose track of the info):