Rim Lighting?

So, I am new to this engine and figured I would try my hands at creating some effects for planets. The tutorials I have gone through so far have been helpful but i have found nothing that explains how I might add in some rim lighting. Maybe rim lighting is not what is needed at all and I am more or less over thinking this.

What are you trying to do riuthamus?
Well, long story short I want to make the atmosphere that surrounds planets. I was hoping to make this a material so that I could modify values on the fly to make some unique looking planets.

Do you have an example of what you want?
yep, look at the linked images below to see what I am trying to accomplish.


00b6a08a8017f51a2f2080edafb810ca0b4fe8d4.jpeg

Any help or thoughts on how this could be achieved would be greatly appreciated.

This has been discussed before on the forums. This post may be helpful.

https://forums.unrealengine.com/showthread.php?10215-Planetary-atmosphere-shader

With the help of a guy on YouTube I managed to get a nice result, though my approach is mega-overkill for most situations I need a lot of control for fast iteration times, as I’m working for insanely high-level graphics. I can’t share my shader network because it’s for a commercial project but I can tell you roughly what I’m doing.

ac3b0a1402e040f2297879e34b67f3b9774a8e27.jpeg
02e1c6b4421acb98853f5c63fd09f82c78cf2059.jpeg

Basically the Atmosphere that extends off of the Earth is an additive material done with two spheres that have inverted face normals (so they point inside), and maps a gradient texture across it. The gradient aligns itself to the direction of the light source (easily done in my case because I always know where my sun is, but you can update a simple parameter via blueprint if you need to move it). Rather than use a texture in my example, I use a custom HLSL node that let’s me pick and modify a gradient of Vector4 parameters on the fly, the first 3 values define colour, while the last value defines it’s position on the gradient map. I do this to get a falloff to a warmer colour around the day/night boundary on the sphere. The HLSL node that generates the gradient based on UV’s can be found here. I use a function for it so I can have a varying amount of bands in said gradient. Using a Colour Look-Up-style gradient texture is cheaper, but you lose flexibility of colours.

I do this for two of these spheres to get a nicer effect, and also fade off the gradient at the outermost edges using a fresnel in the opacity slot, whose power is also affected by the planets radius (ObjectRadius Material Function).

The Earth-Surface is where it get’s more complicated. I first have a ‘band’ around the day/night area which also aligns itself to face the sun, and is used to map a orangey gradient around the edge. This is also masked by a fresnel node which has some low BaseReflection to allow it to glow more at the edges. Alongside this, I also have a second gradient which again is aligned to the sun direction, and lerps between a band of about 8 different colours to give the impression of light-scattering. Again this is multiplied by a Fresnel so it glows more at the edges, but I have a low falloff so it appears on the entire surface. I eventually mask that Fresnel by the day/night gradient so it doesn’t glow on the night side.

I’ve done other things in mine too, I have a green pollution-like layer on the night side which is done a similar way. Hope this helps a bit!

(The material network for the Earth Surface has gotten quite out of control, and doesn’t preview correctly in the material editor either.)
01700a083c723e21aa013f603ffbf7d61d0ab453.jpeg

At some point, I’d quite like to implement JBaldwin’s Eclispe Shader, but I’m not quite sure how to go about it because of the way it’s created.

Thank you for the quick responses. I will have to go through this information and try to get it all in place.

So looking at JBaldwins thread, I get most of the stuff he put in there. The only things I cant find is the

“1+x” node and the “Absolute World Position” node. I have all the rest in place… right now the material looks like a star!

The “1+x” node is in the math section of the palette on the right side of the blueprint graph.

Sure, i figured that, but which math method is that? i tried addition and there is no way to set the second addend to a variable.

EDIT never mind I found it, it was 1-x

A really simple way to find it is to click “O” in the graph.