Inspiration
While sitting at The Farm in VR staring at the star filled skybox, I knew something was missing. The sky needed a moon. However, while a simple full moon is always beautiful it wouldn't feel right without it progressing through the various phases. So I went to work making a system for a 3D moon that would change phases in time with the actual moon in the sky. Now with the start of this competition, it was time to update this to a 3D mesh asset and release it to the masses to bring more realism to the many night time skyboxes in Meta Horizon Worlds.
What it does
Every hour this moon recalculates the precise position of the moon in orbit which produces the cycle of lunar phases we can see. This asset uses an unlit black hemisphere as a mask to simulate the moon's shadow. Then with some layered groups I can rotate the mask based on the inverse of the moon's position around the Earth, and enable a setting called billboard (freeform) on the top parent so every player in the world sees the same phase regardless of where they are.
How we built it
In 1969 the Apollo 11 spacecraft captured a high resolution image of the nearside face of the moon from orbit and made this image publicly available. I was fortunate to have gungangoose to help me wrap this image across a hemisphere along with a matching black unlit hemisphere needed for the effect, and import them into Meta Horizon Worlds with the desktop editor. By applying the same logic I did for the sub-D primitive shapes and updating for the new orientation of the mesh models, I was able to create this realistic representation of our moon. While I could have been lazy and swapped textures depending on the cycle, this 3D version was a far more fun method and the result speaks for itself.
Challenges we ran into
My initial version calculated the rotation in Eurler angles, but at certain points in the lunar cycle the moon would behave erratically from a symptom known as gimbal lock. For this version I wanted to avoid this problem by working only in Quaternions as much as possible which alleviates this risk. It required a bit more learning and practice transforming these rotations, but the end product was far more accurate than my previous version especially after incorporating a Guassian function into the rotation calculation.
Accomplishments that we're proud of
There is something beautiful about a simple 3D asset with a mathematically concise mechanic (37 lines). This is an incredibly versatile asset which could be used in any night sky. Creators could even replace or tint the texture and apply an offset (measured in days) to help build a dynamic alien skyscape.
What's next for Real-time Moon (3D)
As long as nothing changes about the current moon, there shouldn't be a need to update this asset.





Log in or sign up for Devpost to join the conversation.