Terrain can now influence DF, but its not a whole solution because then you have the issue about ‘who writes to DF and who reads’, but its one option.
While we internally would love a more automated way to sample the heightmap texture, there are no current plans. Its much more likely (in the near term at least) that we could make a little blueprint that captures it and sets some MPC parameters for you to make it easier to set up.
A while ago I added a function “Landscape_Manual_UVW” to help map textures to fit the landscape. A user posted an image of it here:
Being able to sample terrain’s heightmap and weightmaps from other materials would be invaluable addition. For now I’ve been using a downsized power of 2 copy of terrain heightmap. While technically doing so is a waste of memory, it is still good sacrifice and gives acceptable results for large and medium meshes.
For small terrain scatters, that were placed with grass system, I’ve actually used slightly different approach. I’ve sampled terrain’s normal map and used it to drive direction of gradient mask on the meshes. Eventually, the mask looked like a band around the mesh’s pivot(pivots were centered for small scatter meshes), that was aligned with terrain’s normal.
Man, I can’t really express how much this means to me :D. To have someone from the studio that created Battlefront, which was the impetus for my project, notice this tool is AWESOME!!
Conveniently swapping materials is the thing I’m currently working on. I have some ideas for automatic terrain material sampling, although I have no clue how you would tackle a mesh that is is located on a transition-area between two landscape materials.
It would be indeed way more desirable to achieve this effect by accesing the terrain-information somehow. Before I got the idea to use Distance Fields, I spent a couple of weeks pulling my hair out while trying to get some useful information out of the landscape actor :D.
Hey Ryan, any updates on adding the ability to sample the terrain’s heightmap/normal and weightmaps in the material editor? I’m using a technique you described in another thread by transforming the normals of the mesh blend layer and a paintable terrain layer, but it obviously looks very flat on curved terrain, not to mention expensive and inconvienent. Having this kind of access would be a lifesaver for a project I’m working on!
It’s been quite some time since anyone posted on this thread but I am looking for this exsact solution to get rid of the nasty hard edges on my static meshes that are intersecting the terrain dynamically. Since it’s been so long has anyone come up with a solution? I’m not a programmer so I would have to follow a tutorial to set up the proper MF, definitely a topic worthy of being necro’d.
You can normalize the distancefieldgradient node. Feed it a worldposition and it will give you the normal from the distancefield. Use distancetonearestsurface to decide where to blend in the normal. It’s takes a bit of tweaking to get right, and most likely does not work in all cases, but it’s worth a try. I commented on another post here. Averaging Normals Along Intersection of Two Meshes - Rendering - Unreal Engine Forums
It shows a basic version of the material + video here - http://take.ms/v0nUZL
Just adding that Generate Mesh Distance Fields must be enabled at your Project Settings and you need to certify on each mesh the distance field is set for generation aswel.
Hmm… i was trying the Material … Thanks but i have an Problem… it seems i have an Dark Shadow when im Using this Feature , When im Reduce the Dithering , The Shadow Disappears but… than i dont have that blending anymore… any ideas?
Wow ! That’s so nice ! I’ve just recreated the code in my editor and it works good. Though I’d like to try without the world alignement also. I disconnected and reconnected some nodes around the “WorldPosition-XY” node but I just broke the material… In short, I’d like just the thing that make the sharp edge disappear. You said it needs to disabled “tangent space normals” but if I only do this, without the others settings, it doesn’t work. Any help please ?