Povstalec / StellarView

Stellar View Minecraft Mod
MIT License
17 stars 6 forks source link

[Suggestion] Solar And Or Lunar Eclipses #29

Open KaidKM3 opened 2 months ago

KaidKM3 commented 2 months ago

it would be cool if we had eclipses (it would give some more life to the sky in my eyes.

Only downside is it wont be able to darken the surface unless you make it a datapack that darkens the surface to act like its sunrise. (unless someone makes a shaderpack that directly is compatible with the resource pack that automatically make it darker client sided.)

Overall Id love to see this get added.

Povstalec commented 2 months ago

Actually I can make it darken the surface, that's not a problem (unless you mean darken in such a way that mobs spawn, that I cannot do).

The larger problem is that there is no simple way to do it. I can't just put it on some timer, because in the very next version, anyone will be able to change every single part of the sky using resourcepacks, so if someone were to just decide the moon should move a bit faster, or orbit in a different direction, that timer would cause things to look weird.

I have some ideas in mind, which involve checking if the projections of objects are overlapping by taking the size and projection position of any object, but it will first require me to prepare the grounds for such a system first.

KaidKM3 commented 1 month ago

I actually diddnt know you can darken the surface. and yes i meant in a way for mobs to spawn, Thats why i mentioned a Datapack that could do that.

I agree with making eclipses by overlapping by taking the size and projection position of any object. the 2 downsides is, The Moon is Smaller than the sun by a couple pixels*, So its going to be Annular anytime it reaches totality (added after post [ So the moon needs to be enlarged by a couple pixels to match the sun so eclipses can actually have a totality state]), AND The moon and sun need to be at angles in order to make Solar Eclipses Rare instead of of being common everytime when the moon reaches new moon state.

Noobly-Walker commented 1 month ago

The sun can be made smaller. Eclipses wouldn't be 'timed' exactly, it's just whenever the moon passes in front of the sun or through an earth-sized area of space behind the sun, eclipses happen just check for the moon entering either zone, and make stuff happen accordingly gonna have to wait until 0.3 gets further along tho

Povstalec commented 1 month ago

The sun can be made smaller. Eclipses wouldn't be 'timed' exactly, it's just whenever the moon passes in front of the sun or through an earth-sized area of space behind the sun, eclipses happen just check for the moon entering either zone, and make stuff happen accordingly gonna have to wait until 0.3 gets further along tho

The "just check for the moon entering either zone" is THE most complicated part of the whole thing.

Noobly-Walker commented 4 weeks ago

To simulate eclipses in a general manner, we need to know where the sun is in the sky, as well as any object that might cast a shadow over the observer, or that the observer would cast a shadow over. Spherical coords. We also want the apparent sizes of these objects. Solar eclipses are simple enough with this information alone. We know the apparent size and location of the sun, as well as the apparent size and location of anything that would pass over the sun (Ex. Luna, Mercury, Venus). We could then calculate based on how close to each other the sun and occluding objects are in the sky. Objects that are fully over the sun should be darkened significantly, to appear as a dark square over the sun. The more the sun is covered, the darker the skybox gets, with a fully covered sun leading to the sky darkening enough that it looks like night. Lunar eclipses require an additional variable, the distance between the observer and anything it might cast a shadow on. The observer casts two shadows, that being the penumbra (which is the same size as the observer) and umbra (which shrinks relative to the distance between the observer and the body). Both would be projected or calculated relative to how far away the object is from the observer, though the penumbra lightens the further away the object is. The penumbra darkens any object that can pass through it, while the umbra tints the object with the observer's Rayleigh scattering (red for earth, blue for mars, whatever color the evening sky takes)