How can I "blend" a mesh (static or animated) into the sky ?

Here is the gist of the setup I am after. Imagine a sky sphere that is basically sky and the ocean, and actual ocean mesh on the level. How can I make ocean mesh gradually blend into the sky sphere so that the scene looks seamless ? (sky sphere could be a a desert and sky, with patch of desert landscape mesh; same idea - make scene look seamless)

Thanks!

I would use fog to blend the horizon

You could render sky sphere with transparency and fade alpha based on scene depth.

That’s not really a good idea, because I need to create fake wide open space, without fog.

Even having fog will show the edge of the mesh against sky sphere. Probably even more defined than without fog.

In one of the older game engines, I could paint edge of the mesh with vertex color and have 2 layer material on it - one would be for the ocean (or desert) and one would be sky box material (the edge part of the mesh). That would make mesh dissolve/blend into sky box seamlessly. Is something like that possible with UE4 ?

I prefer not to have any transparency since it’s for mobile VR platform.

It’s better to have single cheap fullscreen transparent mesh(and most are occluded anyway by opaque meshes) than have every other material to have complex fade logic.

Oculus basically forbids usage of transparent surfaces for mobile VR.

With all those mobile vr limiations you can just raise your hands up and stop caring about visuals.

You have couple options.

  1. Make distant object transparent and fade them to background. Too expensive. Multiple materials. Visual difference when swapping from opaque to transparent.
  2. Dither fade distant object. Look bad. Need alpha testing. Multiple materials needed.
  3. Replicate skybox material perfectly in every distant material. You also need to tune down albedo and specular for distant objects to make it look smooth.
  4. Use transparent sky sphere.

Try Height Fog. You will see the sky, but not the horizon. And it has a nice performance optimization.

https://docs.unrealengine.com/latest/INT/Engine/Actors/FogEffects/HeightFog/index.html

HeightFog doesn’t work on mobile, especially not suitable in mobile VR.

I’ll make a test case in my old engine and show what I am after exactly. If UE4 can’t do that, it’s pretty sad.

So, to avoid further confusion I made a test case using old engine:

What it looks like in-game:

This is how it was made:

Does it make more sense? Basically there is no transparency/translucency, no alpha testing, no fog of any kind. The terrain surface casts shadow / receives shadow. There is no performance loss at all (between non-blending terrain and bending terrain you see on video).

I want to achieve the same with UE4 (but not sure how).

Any thoughts ?

Folks, so is it achievable or not ?

Well without doing tests it seems you would be able to use the same technique in UE4 unless you are trying to blend into the default dynamic Sky blueprint which sounds like a pain. And by same technique I would mean vertex paint a transition or mask it in with a Linear Interpolate. If you are using your own skybox I assume any of these would do.

Yeah, I am blending static sky box (cubemap). Are there any tutorials about basics of texture blending via vertex color in UE 4 ?

Vertex Color is rather easy and straightforward. Unreal Documentation has a few tips.

If you like to follow by example Youtube has various tutorials here is one of them.

I was experimenting with this past weekend and I kinda got results I needed (similar to my video made with old engine).

However, the issue now that my sky sphere is unlit material, while same sky sphere image blended with terrain material is Default Lit. With that, you can still see the edge of the mesh, even though it looks like terrain blends gradually into sky.

Having default lit material, is it possible to make one of the several textures being blended via vertex colors to appear unlit? (this way it will match perfectly with unlit sky material material)

Thanks

You should be able to simply lerp to your emissive cubemap while lerping to 0 for basecolor and specular on that material and it should just work. Just use worldposition for the UVs of the cubemap. Paragon used something similar to have tall rock spires disappear up into the sky.

Did that too, but hue of the blended sky sphere doesn’t match hue of the actual sky sphere. Blender sky sphere is more vivid for no apparent reason (except maybe due to lightmaps).

I’ll post my setup here after I get off work.

If the sky itself is also the same cubemap then I am not sure what the issue would be, other than perhaps different values of fog being written for each surface. Try disabling all fog for now.

Ah, that was the thing!!! Thanks! I totally forgot I had “fog” tint on the sky sphere. Works like a charm now!