I need to rotate a squished mask

I am trying to make a phases of the moon and I almost have it working. My approach is 2 semi circle masks and a squished circle mask in the middle to get a good ellipse shape as needed. I have been focusing on getting the ellipse working first. It almost works and it looks good. It doesn’t look like a black hole at new moon and when changing the variable to determine the width of the ellipse I get a nice sideways black eye opening and closing. But I can’t get the black eyeball effect to rotate as needed. I am stuck. Any Ideas? The bit circled in red is the stuff relevant to the moon phases

output

Hi Feyion,

Looks like you’ve got a good solution for the crescent phase of the moon. I think you’ll run into issues for the “gibbous” phase, where a dark circle won’t map well to the moon’s shadow:

If you’d be open to other solutions, here’s the one I came up with.


While you’ll have to double check this for your project - I’m not a lawyer and can’t give legal advice - most of the images NASA generates are in the public domain (save for stuff like their logos, or when using their images for promotional material).

NASA’s Science Visualization Studio put together a beautiful video of the moon phases. I took this video and converted it into a spritesheet using the command line tool ffmpeg:

For posterity, the command I used was:

ffmpeg -i input.mp4 -vf "crop=1080:1080:420:0,fps=1,scale=512:-2,tile=5x5" out.png

That crops the 1920x1080 video to be square, sets the rate frames are exported, resizes each image to be 512:512, and puts it in a 5x5 grid.


From there we can bring it into Unreal and setup a material for it.

  • I set the Material Domain to be User Interface here - though other options would work well too, depending on your needs.
  • I set Blend Mode to Masked.

Now we all we need to do is make a mask and select which moon phase to play. Turns out the moon wobbles a bit in how close it is to earth, so they have it getting slightly larger and smaller in the video. We’ll wobble the mask in time with it to avoid any visual artifacts.

I’ve set this up as a animated flipbook, but if you connect the two outputs from the “MoonPhase” parameter, you can control the moon phases through script instead.

Hope this is helpful!

Will give it a go. I was originally avoiding a “just get a photo of each phase for a mask” option that I saw some people doing on redit in response to a similar question. This is due to being on the southern hemisphere and getting annoyed at all the US centric pictures and reasoned that if I could not figure out how to rotate the direction of the eclipse mask then I would have the same problems with picture based masks. Alternatively I may have been overthinking it. Your approach seems interesting enough and flexible enough for interesting eclipse effects. Assuming I can get the thing to orientate correctly.

Update. Getting this to work with the SkySphere material is proving to be a pain. either the “moon” is massive and copied all over the screen or they sky is purple or green. Will keep trying

Could just use a spherical normal (easily generated mathematically) or a normal map, align it with the moon on your skybox and then use the dot product in the shader.

I spotted this YouTube tutorial about putting a Moon into the SkySphere Material - maybe that’ll help?

Update. It is done. The moon brightness, moon glow and size modifiers need some adjusting. But it works. Thank You @JoeProgram for pointing me in the right direction. Picture of solution is attached for someone else who has this problem.

edit: needed texture images with transparency, used imagemagick to get the montage of source images that had that

Tiff images with transparency source: NASA SVS | Moon Phase and Libration, 2021

Followed this tutorial then modified texture object bit (expand SkyAtmosphereImage node): https://www.youtube.com/watch?v=Zg2NaZcyAjk&list=PL5Rt3cak7KNGhjhIWZtx9wCjBn7HXex-l&index=4

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.