So I’m trying to make my own snow displacement material because every implementation I’ve come across in tutorials suck for one reason or another.
I want to use Runtime Virtual Textures (RVT) because they can cover an entire terrain with the displacement rather than just a small area like Render Targets.
My plan is to use mesh distance fields intersecting with the terrain to mask out where the displacement should happen.
This idea seems to work quite well, placing meshes on the terrain creates a pleasing displacement.
My problem is I’m trying to make the displacement persistent so I can leave trails behind as I move through the snow.
My material function that creates the displacement mask will not save to a virtual texture, and I don’t know why.
A quick summary of my setup so far, I’ll include links to the graphs because they are better than screenshots:
- I have a material function that generates the displacement mask based on distance fields
(Generate snow displacement based on distancefields posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4) - That material function is then put in a drawer material, applied to a plane. (Snow displacement drawer posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4)
- Then I have the landscape material that handles all the displacement stuff. This is where the magic should happen
(Snow displacement material posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4)
I’ll include 1 screenshot. It shows the material output of the drawer plane. it clearly shows my displacement masks on the ground. Then in the background, you can see a mostly black plane with a yellow square. This is the RVT output of the drawer being projected onto a plane. The square represents where the drawer plane is on the terrain. but it shouldn’t be showing a square, it should be showing the red and green masks like what you see on the ground.
So my conclusion is there is something getting messed up in the RVT output. but the output does work. I can plug in a radial gradient for example, and that will show up. Also, the yellow colour is likely generated by the red and green channels being mixed together from the material function. So it looks like it isn’t saving the actual result of the function for some reason?
Has anyone tried this kind of approach to making a snow displacement material? Or maybe used distance fields on a virtual texture before? I’m guessing this is either one of those annoying things that UE4 can’t do for some arbitrary reason or I’m simply missing some steps in the setup here.
One important note that I just remembered: I am using forward rendering. dunno if that affects this.