That’s a neat idea. I can even imagine a custom shader that lets you specify the fall-off and color of this fuzzy circle (EDIT: perhaps like this?) — and then you just slap that onto a billboard. Thanks for getting me unstuck!
Nuts — that doesn’t work as well as I’d hoped. It’s fine for things that are a decent distance away from the camera, and/or close to the center of the screen. But when the planet is very close to the camera, or further away but off near the edge of the viewing frustum, then the billboard doesn’t always line up properly with the visible edge of the hemisphere. It ends up drawing in front of the planet on one side or the other, and looks bad. (And yes, I’ve tried both pointing the billboard directly at the camera, and pointing it opposite the direction the camera is facing; both fail in different circumstances.)
I could probably work around this by introducing another camera, so that I can ensure the haze is always drawn behind the planet. But I’ve already got a foreground and a background camera; I’m loathe to introduce a third.
Any other approaches to this problem?
I’m thinking the ideal might be something I can apply to a spherical (or hemispherical) mesh, which I would position and size just slightly larger than the planet. This would need some sort of custom shader that draws alpha based on how far from the visible edge it is… though I have no idea how it would do that.
Or, maybe there’s something more clever than simply rotating a Quad to face the camera; some math I could do to figure out exactly where the edges of the sphere are, and adjust the quad mesh accordingly.
I was going to suggest some kind of gaussian blur camera efffect - with another camera, though I have no clue how to incorporate this. @imaginaryhuman_1 seems to have a handle on special camera effects and separating rendered paths.
@JoeStrout
Ah well. You should probably go the sphere method then, and make a shader that gradients based on normal vs view direction. It’d get complicated when you’re going inside of the atmosphere though. And you may need to use front-culling instead of back-culling, or fancy ztest options.
You could use the new command buffers with this sphere method, and then manually draw it over the planet as a sort of image effect, referencing what’s in the buffers.