Moon phase material on SkySphere


I want to make the moon as a texture on the SkySphere.

how to make the phases of the moon?


Using flipbook is the first thing that comes to mind.

it is clear that it is possible to use the 29 titles (all phase moon). But would like to use only one texture - full moon.

The cheapest and easiest way would be to use a flipbook (unless you have a massive moon that takes up a large chuck of the sky). Otherwise you will have to fake lighting the moon as a sphere or do some tricky masking, which is more work for something that will probably look worse.

hmm, manually create 29 textures (phase moon) easier than to write material? Ok, thanks

Use the normal map of a sphere and just use dot with a light vector. Simply ndotl. Have the light vector rotate around the moon position to get the different phases. multiply it with the diffuse of the moon. Cheap in terms of memory and fast and very flexible as you can move the light source wherever you want and it will affect the moon.

EDIT: By lightsource I mean a 3d position in the shader, it’s not an actual Unreal light.

thank you very much try. - nice ^)

only how to use it later in SkyBoxImage function? I use so - Is it ok?

Looks good but you probably don’t need to read from the mask and alpha for both the diffuse texture and lighting calc. You should just be able to multiply the bottom part of the shader by the dot product from the texture of the top function to avoid doubling up the opacity.

yes you’re right. I removed Multiply for NormalMap. - my moon.

last question. How do I change the value FakeLight (in blueprints)?

Two different ways. One is to make a Material Instance Dynamic in your blueprint and then set that value using the node “Set Vector Parameter”.

The other is to make a Material Parameter Collection and add a vector parameter to it. Then you can use the alternate “Set Vector Parameter” node that in blueprint that lets you write to a collection. Then you can drag your material collection parameter asset into your materials and read from it.

ok, thank you very much for helping the community.