Controlling opacity with brightness (Of an orbiting planet in the sky).

Hi everyone,

I’m trying to implement an effect where an orbiting planet up in the sky appears properly lit. So the side facing the sun is lit, but the side facing away is transparent. I’ve figure out how to make it be “dark”, but that’s not what a celestial body really does on the dark side. On the dark side, the atmosphere of the planet you are on is brighter and so you can’t actually see it. Like the way the moon looks when you see it during the day.

This is what I currently have:

Imgur

But in reality, the dark part of that sphere should be ‘transparent’, while the side facing the sun is visible. When I use translucency, the whole thing becomes unlit and doesn’t pay attention to the sun. I’ve tried additive, but that just makes the whole thing unlit. What would work best is if I could use the brightness values as a transparency level. I’m using the standard sky sphere for the rest of the sky.

Thanks!

In UE4 you can’t represent that scale fully, I would just use a premade image

First off, that looks awesome.

Second I don’t know exactly how you would do it in Unreal but I’ve done this kind of thing in photoshop a lot. It’s essentially making a flat dark color on a layer, turn that layer to a lighten layer and gradually increase the value of the dark layer if that makes sense.

I’m not very fluent with Unreal yet but I believe you want to use a Blend_Lighten node on a texture that is between your camera and the planet orbiting.

Perhaps something like a sphere mesh with reversed normals that contains a translucent texture with the color of the sky that lightens anything behind it.
The issue im seeing with this method though is because the node takes in two textures and outputs the result but we want something from the camera instead of a texture on a material. Maybe if you could somehow get the rasterized image from your camera as a 2d texture? That might be overcomplicating things, there’s probably a simpler solution. Gonna have to do some thinking.

Ah! Figured out a simple solution. I placed in an exponential height fog object into the scene.
Put my fog density to 0.3, height falloff to 0.001
opacity to 0.9
and start distance to 5000
and then shot the transform up to 30k on the Z axis so the fog doesn’t affect the ground below but it does mask out the planets shadowed sides.
That in essence should get you the effect you want, you’ll have to do some tweaking of course but I think it’s a pretty simple solution.


There’s fog on the ground in that screenshot but that was taken before I figured out there was a start distance parameter.

Alternate Idea: Change your skybox material’s bend mode from Opaque to Additive, and then place your Moon object outside of it. This more accurately reflects what you’re seeing in real life.

Complex alternate idea: Set up a light actor and gather the suns position vector into a material parameter collection, then use that to drive a dynamic opacity map, leaving you with something like this (This was just a quick mock up)

Material Parameter Collection:

Light Vector Actor:
– Construction Script

– Event Graph

Opaque Material:

Material Instance Properties:

these are both awesome alternatives

Very cool. Thank you all so much for the input. I’ll let you know what ends up working best, and I’ll post a screenshot!

As promised - some shots:

Imgur

Imgur

Thanks everyone for the help!

:open_mouth: that looks awesome!

Awesome, just the right stuff I was also looking to get any idea and answer, thanks for that! :slight_smile: