Trying to figure this out is driving me crazy

I saw a post that describes what I’m trying to do.

I have a moon mesh that I put in the sky, however, it’s in front of the clouds. I saw a post on here than RyanB commented on saying

"I would do this by adding a separate mesh in the sky that is just a simple plane mapped with 0-1 UVs and the moon fitting to its extents.

Then you just need to set a “LightVector” for the moon. This can be any normalized vector to position it. Just normalize the vector and then multiply it by the length of the radius of your skydome (slightly less to avoid going behind the sky, or make it translucent and disable depth testing, either way). Then you need to set rotation using “make rotation from Z vector” and the z vector needs to be your light vector times -1. You may also want to specify either an X or Y vector to control the rotation of the moon itself. You can use “make rot from ZX” or “make rot from ZY” as they will both work depending on if you are specifying an up or side vector. Just make sure the Z is first so that it is prioritized.

Then you just scale the mesh accordingly.

You could also of course solve this using coordinates in the world in such a way that allows you to project the texture right into the sky dome but that method is a bit more advanced and relies on some transform math."

Now I’ve been trying to do this, but I’m so confused. I’m new to UE btw, but I can pick things up easily if explained a bit better and not as shallow.

I know I need blueprints, but light vectors, there’s so many and what do I plug into it to start? My minds is spinning!

Help appreciated.

Are those clouds volumetric or? What exactly are you trying to do? Could you post the place where RyanB has posted this for more context.

Help Help Help

https://forums.unrealengine.com/deve…e-in-skysphere
The clouds are part of the Sky_Sphere

I have a moon mesh but it is basically in front of the sky sphere, so the clouds move behind it instead of infront of it.

Just realized RyanB’s explanation isn’t what I’m looking for, help anyone?

Mhm, I understand. You have misunderstood the context inside the thread. Its about how to position the moon plane on the surface of the skysphere, not to place it behind the clouds literaly, its impossible with just simple vector math. The reason about that is the clouds you see on the skysphere are just a 2d texture that is projected on the sphere. Its going to be a lot more complicated for what you are trying to achieve.

I just realised that, so I’m just trying now to get a moon behind the coulds on the actual sky sphere, I’m really struggling though.

The easiest way is to find a 360 hdri sky texture with clouds, use it instead the clouds that are in the material of the skysphere (or just completely change the material with only the new 360 hdri sky texture if you dont care about the atmospheric colors) and add a black and white version of it inside the moon material and use it as a mask. This way you can use a reflection vector node for the uv coordinates inside both of the materials and the clouds are going to be aligned together.

Now this is going to be very complicated for me to write everything and do a step by step guide. Its too much that must be covered as my free time is limited so I will record a video and show a close up on what is going on with my moon material (I have already done the thing you want a while ago).

Link to video (youtube) -

Moon material:
So the logic is I use two textures one that has colors and one that is black and white with strong contrast so that I can divide the sky from the clouds. The black and white texture is doing most of the magic, the colored one I use it on two places - one that is the skysphere (I use the new hdri backdrop plugin that came with 4.23 - You have to enable it inside Settings - Plugins) and one that is on the moon material as a color overlay so that the colors will match.

Bellow is just a demonstration of the BW texture.

I hope this is informative enough and not just confusing - I rushed a bit things.

Thank you, but is there another way to do this without having to use this? Perhaps already editing the regular sky sphere and somehow get the moon on back, similar to how the sun is?

As I said in my post that you want too much to just explain for that, I even recorded a video for you to see the logic behind my idea. Its enough to give you directions. I think you should begin with small steps learning materials and such and then try to do what you want to do.

You can export the textures that are there on the skysphere material (see screenshot, do a backup of the material before that) and use a image editing software to save them as .hdr and import them, then replace the old textures with the new ones. After that remove the uv cordinates that are there and put a reflection vector instead. And lastly do the moon material that I have recorded for you with the same textures that you have replaced on the skysphere material. But I strongly suggest you first to learn how materials works, and simple shader mathematics (add, mutliply, subtraction, power, lerp etc).

Have you tried modifying the default sun in the level editor to create a moon? I would suggest not using those skyphere textures for clouds because it is going to end up behind any moon you create and place in the space. The moon may require being in a separate layer from the clouds to ensure it doesn’t get too occluded by the clouds when editing either one.

Yes I’ve tried that, but I can’t change the sun to a texture, I’m going to try go with NasteX’s method first.

Speaking of which, are we talking about the regular sky sphere or the HDRI sphere plugin addon?

On my quoute I am talking about the HDRI backdrop plugin, if you want to modify the regular skysphere refere to my post nr.9 for instructions.

Could you give me a link to some tutorials that might help me understand all this a little easier? Thanks.

Hmm, I would suggest you to google UE4 material shaders tutorials and watch everything. Specifically for your case I dont think there is something on internet about that. What are you struggling to do? I can help you if you have something specific you cannot find on internet.

Edit: This guy have very nice tutorials - https://www.youtube.com/channel/UCzy…TrEh1ZA/videos
Here are some videos from his:

Thanks a ton! I am just struggling to understand how all of this works, like with the multiplying here then dividing there nodes, I can try and copy everything you did, but I think it’s best if I actually understand what you did so I can replicate it and modify it if need be.

No problem man! Yes, its a bit learning curve but the things you want to do is pretty basic actually so you will get to it pretty fast. :wink: