I’m trying to use the new Blueprint Drawing to Render Target features in 4.13 to create deformable snow but I can only get it working with static meshes because it relies on Material Instance Dynamics. Is there any way to use an MID with a landscape?
You can set Render target texture for normal materials too. You can also set MID via code or blueprint to landscape.
Hi Jenny, thanks so much for the help - I didn’t realize you could use render target textures in non-dynamic instance materials. That’s one major hurdle down, if I can sort out how to align the render texture UVs to the landscapes, I’ll have it made.
Any luck with this? I’m also trying to create some deformable snow. I have a render target that I’m drawing to and passing into the landscape material’s World Displacement parameter. It works with that material on static meshes, however it doesn’t seem to update with the landscape.
I’m afraid not. My goal was to create deformable snow, as well. Ultimately, I was able to get it working perfectly, but only on a mesh, not a landscape actor (and I wasn’t willing to give up all the benefits of using landscape actors over meshes). It’s been a few months since I worked on it but, off the top of my head, the obstacle was that the render target points to a UV coordinate on the mesh, so it knows where to apply the deformation. A landscape actor doesn’t have defined UV coordinates (at least, that I could find).
You guys should be able to map from the landscape world coordinates into the 0-1 UV space of your render target and use that as the position to paint in the render target.
To do that, you just need to know the minimum and maximum XY extents of the landscape. one simply way to get them is to place actors at the two corners and grab the location from them. Then the formula is just:
Local_0-1_Pos = (WorldPos.xy - LandscapeMin.xy) / (LandscapeMax.xy - LandscapeMin.xy);
There is also a material function “Landscape UVW” (or something similar to that) that can do this translation in a material but you probably would want to do this encoding on the BP side and use it to splat down your deformation into the 0-1 space.
Whoa. That is awesome! I just finished testing the concept and it 100% works!
For anyone else, the node RyanB was referring to is “landscape_manual_uvw”.
I’m going to play around with this a bit today, move everything I can into blueprints and see how much I can optimize the process for a large open world, tessellated landscape. As of right now, since the Render Texture and the Landscape have a 1:1 mapping, you can’t make your landscapes too large or the RT’s pixels start to become obvious, even at 2048x2048. Even with LODs, the larger tessellated landscapes get expensive, so this will probably need some creative level design to make it feasible.
Perhaps there’s a way to reuse the same Render Texture across multiple landscapes, to conserve texture memory?
RyanB, thank you, thank you, thank you! You’ve given life to a feature I thought was completely out of the question!
Do you need the effect to cover the whole landscape, or just some decent area around the player? You can make the grid follow the player, but it involves a little bit more tricky scripting. Ie, you need to always be moving the texture by the -movement of the player in texture space so that the texture doesn’t appear to move to the player, and you need to softly fade out the influence of the texture at the boundaries so you don’t see detail wrapping or repeating in on itself.
Ideally, I’d like the effect to cover the whole landscape and be affected by any pawn (player or ai) who walks through it. I’ll be testing out just how expensive that is and will report back later in the week.
If that turns out to be too much and I have to go with the ‘area around the player’ method, I will definitely need some further direction from you. I understand the concept of what you’re describing, but thinking through how the render target texture would update frame to frame while being moved around is making my head hurt.
Ok… I’m at loss here I’m not sure where I can read up on what those parameter variable means…
Example. LandscapeMax: 1.04e+04
What does that mean? I can write in the numbers but what does the e+04 mean?
Those are the XYZ coordinates of the two corners of the landscape. You could simply type them into your material as vectors but I set up a material parameter collection to do it dynamically through a couple BP actors. The e+04 is just shorthand for saying there are more digits than can be displayed on the node. 1.04e+04 translates to ~10,400.
i dont know what are the correct values to place in the two MIN MAX.
This is the scenario:
Landscape size 4033, Colormap texture size 4033x4033px.
Landscape is placed at XYZ: 0,0,0
One big rock with the material described in the photo (same texture).
Rock position XYZ: 100000 , 50000, -44000
Rock Scale: 1000
I got to move the image & scale it changing some values to 403300…
but dont get to center it.
In other hand I dont know if this could work with Foliage_Volume and Grass Systems inside UE4, as they are placed alternatively. Should need aditional code.