Page 1 of 1

Terrain distance blending

PostPosted: Fri Nov 02, 2018 2:43 am
by cAyou
Hi there !
I was wandering on the web, looking for awesome shaders to do, and I've stumbled upon this page, telling how to do terrain blending like in starwars battlefront, using Unreal Engine.
https://forums.unrealengine.com/community/work-in-progress/104455-terrain-blending-tool-based-on-star-wars-battlefront
I can't find anything that would do the trick using ASE, so I was wondering if you guys have any idea.
My first step would be to do something similar to a soft particle shader, detect the distance to nearby geometry, but even that cannot be found....yet.

Thanks !

Re: Terrain distance blending

PostPosted: Fri Nov 02, 2018 12:11 pm
by Ricardo Teixeira
cAyou wrote:Hi there !
I was wandering on the web, looking for awesome shaders to do, and I've stumbled upon this page, telling how to do terrain blending like in starwars battlefront, using Unreal Engine.
https://forums.unrealengine.com/community/work-in-progress/104455-terrain-blending-tool-based-on-star-wars-battlefront
I can't find anything that would do the trick using ASE, so I was wondering if you guys have any idea.
My first step would be to do something similar to a soft particle shader, detect the distance to nearby geometry, but even that cannot be found....yet.

Thanks !


Greetings!

I'm afraid that's not possible due to the way Unity renders its objects "by default". You would need a custom solution beyond the scope of what a shader editor, such as ours, can provide.

This is something that could change with the new HD Rendering Pipeline.

Thanks!

Re: Terrain distance blending

PostPosted: Fri Nov 02, 2018 1:48 pm
by cAyou
Thanks for your reply !
Are you sure I can't even reproduce what the soft particles is doing? I was using ShaderForge before switching to ASE, and I had a Depth Blend node, which was used to retrieve the distance to a near surface. It's not enough, but it was a starting point.
There is someone that did the effect on Unity: https://www.youtube.com/watch?v=d_at-NawTbY
But I can understand that couldn't be possible using ASE, I just wanted to try.
In fact I'm currently working on how to blend a mesh on an animated skinmesh surface, like "3d decals". You can check how I did it here: https://answers.unity.com/questions/1567640/skinmesh-with-attached-objects.html

I wanted to "merge" the two objects by creating an effect similar to the solution used for terrain blending. I guess I will investigate more into an hand coded solution :)

Re: Terrain distance blending

PostPosted: Mon Nov 05, 2018 2:39 pm
by Amplify_Borba
Hello! You can, on ASE, pick the screen depth, and through that you can do some math on the objects distance to what is behind it, but this might be a bit different from what you want. You can also use depth fade, but this is not something that's on the shared references, it's belongs to a different technique.

The mesh blending example you've shared is based on the Distance Fields functionality in Unreal 4, which samples the level global distance field ( which is automatically calculated by the engine ), and is something we don't have access in ASE. In Unity you would likely need to precompute the distance fields outside the shader and then feed them into it.

In any case, this is a fairly complex effect that will require some elements external to our editor in order for it to be achieved. Unfortunately, we don't have any immediate advice or samples that we can provide, so for now I would recommend that you look into a package that would specifically solve this problem, such as Terrain Mesh Blending, or even Micro Splat.

On a final note, an alternate way to simulate blending would be to use world projected textures on both the terrain and your mesh, however, this is not an ideal solution and it differs from the other technique.

Hope this helps!

Re: Terrain distance blending

PostPosted: Tue Nov 06, 2018 1:46 am
by cAyou
Thanks for your complete answer ! I think I will turn into assets if I'm not able to do it myself, it seems that is over my skills haha :D
Really appreciate the support, it's incredible !

Re: Terrain distance blending

PostPosted: Tue Nov 06, 2018 9:25 am
by Amplify_Borba
No problem, we're happy to help!

Please don't hesitate to get back in touch if you have any further questions or issues.