net-lisias-ksp / DistantObject

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

Request for skybox dimming integration with Scatterer eclipses #50

Open Krazy0 opened 3 months ago

Krazy0 commented 3 months ago

Using the Scatterer eclipse feature, while CB1 is casting a shadow on CB2 the skybox dimming is still active when a ship is in low orbit around CB2 (between CB1 and CB2) even if CB2 is completely dark. Ideally the skybox dimming would be proportional (?) to the surface light, considering the eclipse shadow coverage.

Lisias commented 3 months ago

@Krazy0

I don't know what's CB1 neither CB2 :)

Can you post here a screenshot with the scenario?

Tequhella commented 3 months ago

@Lisias I think it's for Celestial Body.

@Krazy0 Let's take the example of Kerbin and Mun. If I understand correctly, in the case where Mun is in Kerbin's shadow, and we're orbiting Mun, the skybox dimming shouldn't be active or at least proportional to the light from Mun's surface in our field of view ?

Lisias commented 3 months ago

@Lisias I think it's for Celestial Body.

Oh. Now I see. 😛

@Krazy0 Let's take the example of Kerbin and Mun. If I understand correctly, in the case where Mun is in Kerbin's shadow, and we're orbiting Mun, the skybox dimming shouldn't be active or at least proportional to the light from Mun's surface in our field of view ?

I think you are overcomplicating things. Doesn't really matters where you are orbiting, what matters is if the Light Source (the Star - or one of them in Kopernicus) is near enough and not occluded.

Using the same mechanism KSP uses for casting shadows on celestial bodies is overkill (and CPU wasteful) because the CBs 😃 are "on rails" entities, they are absolutely predictable and this simplify things a lot, because you can just precompute everything, store on an array and just use the precomputed values from that point.

Crafts can change position and orientation at any time, so the whole stack of math needs to be applied in order to cast a shadow over a craft - on every single frame.

As a matter of fact, the computations need to be made over the camera's position and orientation, not craft - so there's nothing currently on the KSP stack to help you on this one.

Lisias commented 3 months ago

Using the Scatterer eclipse feature, while CB1 is casting a shadow on CB2 the skybox dimming is still active when a ship is in low orbit around CB2 (between CB1 and CB2) even if CB2 is completely dark. Ideally the skybox dimming would be proportional (?) to the surface light, considering the eclipse shadow coverage.

Now that I understood, nope. The dimming is not proportional - eye sensitivity is not linear, is logarithmic. All it needs is a tinny source of light to trigger the eyes into "high contrast mode". Read about Persistence of Vision.

It's like the older CRT TVs. You only see a "full" image exactly due the persistence of vision. There's really ONLY A TINY DOT running the screen, but since it does it fast enough, it fool our eyes into "thinking" the whole screen is bright and not only that tiny dot.

Give a peek on this video: https://youtu.be/3BJU2drrtCM?t=129

It's exactly the same - it's enough that a tiny bit of the Mün to be exposed to light to trigger the same effect on our eyes, dimming the whole sky, no matter how much of the CB is exposed or not.

Krazy0 commented 3 months ago

Hi @Lisias I see what you mean about logarithmic dimming and persistence but in the case I witnessed (using Kerbin and Mun for example) Mun was completely occluded by Kerbin and the ship was orbiting Mun. Mun was totally dark and still the skybox dims when looking toward the hemisphere toward Mun. It's a rare case but it would add some realism if it didn't dim then. Of course the user could just manually turn off skybox dimming in that case... that's a reasonable workaround. But users don't need to be reasonable, do we?! About precalculating eclipses for on-rails CBs... I'm using Principia so nothing is on rails exactly, although they could still be precalculated.

Lisias commented 3 months ago

I think this is, so, just another way to reproduce the behaviour described on https://github.com/net-lisias-ksp/DistantObject/issues/31