Lexpartizan / Godot_sky_shader

MIT License
194 stars 23 forks source link

Moon rotation #15

Open Pilvinen opened 3 years ago

Pilvinen commented 3 years ago

I can make the sun rise and set in a semi-circle (or sine wave) across the sky, for example:

sun_pos = Vector3(-0.5,-1.0,0.0).normalized().rotated(Vector3(-1.0,-0.25,0.0).normalized(),phi)

But when I try to do that with the moon it turns out the rotated vectors:

moon_pos = Vector3(0.0,1.0,0.0).normalized().rotated(Vector3(1.0,0.0,0.0).normalized(),phi)

do not affect the moon in the same manner as the sun.

Adjusting the rotated value seems to affect the "moon phase" (full moon, half moon, etc) dynamically as it moves across the sky. Only it's not the real moon phase, though, it only resembles it somewhat. It just makes the moon become thin and disappear gradually.

Is it a bug or am I misunderstanding something? How can I fix it?

As a side note - I did delete the camera that was in the Sky scene as I could not think of a reason for it being in there. I hope it was not needed.

Lexpartizan commented 3 years ago

This is not a bug or your fault. i just couldn't implement the correct output of the moon texture to the panorama, so it only works in certain cases. the sun is not a texture, but a circle, so everything is easier with it. The phase of the moon has nothing to do with it. Yes, this is not the real phase of the moon, but just a black circle next to it. Camera not used. Thanks for letting me know, I used it for debugging and forgot to delete it. it can consume resources, but it is not used. Thanks for letting me know, I'll update the scene.