I am working on optimizing my landscape material as it is insanely complicated. I have been thinking about using runtime virtual textures but I don’t think that will work with my material, as includes a distance based blend for some of the material layers.
My current set up has a lot of different techniques going on to break up tiling in the textures (such as rotation and noise blending etc), this takes up a lot of time but I think it would work as a RVT. What I really want to preserve though that I don’t think would work as a RVT is my distance based blend.
On a few of my main material layers I have all the usual techniques, but then I also have them all duplicated and scaled up. Then I blend the small scale and large scale versions together based on distance from the player, so the small scale versions are closest to the player and large scale versions are used further away. This system works great at breaking up tiling but is an absolute performance hog, especially when you have more than one of these complicated distance based material layers on screen at the same time.
To put it simply, is it possible to set up two different RVTs, one for the small scale textures and one for the large scale textures and then blend the two RVTs together based on distance?
any other performance saving ideas would also be welcome but I think the two RVTs would be the best solution if at all possible.
I’m about to come up against this problem as well, so not a guaranteed solution, but just a thought.
Could you layer over the distant landscape effects on top of the RVT? I appreciate it doesn’t truly solve the issue as the post-RVT shader stuff will still add cost, but theoretically as they are further away, perhaps you can reduce complexity in a few ways, baking a single far distance texture and blending that in/out over the RVT based on distance?
As per your question, I don’t see a way to get two RVTs working unfortunately. You can only output RVT information once per material. Short of duplicating your landscape and placing it beneath your current one with a material only containing the far distance details, I’m not sure how else you’d manage it (and I’m not recommending this as a viable solution!)
That’s certainly a good idea to try out thanks. it’ll certainly get me at least 80% performance increase hopefully if it works. I’ve never bothered implementing RVTs as of yet so will have to have a bit of an experiment with it. Would love to hear your results if you get around to it before me.
So I got it somewhat working following your advice. I disabled all my distance based blending and set up my landscape material as a RVT. Then I hooked up the lerp nodes for base colour, roughness and normal from one of my distance based blend materials with the “RVT sample” node outputs. Eg, “RVT sample” base color output to input pin “A” and the scaled base color (that doesn’t plug into the “RVT texture output” node) to input pin “B” and my distance blend magic into the Alpha. This works perfectly however it means that I have one material doing all the texturing in the distance. Which works for almost all my different materials as they’re all fairly similar different soil types etc. It falls apart however with radically different textures such as my mountains and beach sand etc, but its a good Starting point. I will keep experimenting and hopefully I can get two separate RVTs mixing or somehow break the outputs back down into their layer blends after the RVT sample node so i can get the different material layers using their appropriate scaled textures.
IT WORKS!! Just figured it out. The only thing that isn’t perfect is that I don’t have control over the UV scale of each individual material layer, Mountains, Sand and Soil etc. But I have succeeded in getting RVT to blend between two different scales. One for normal scale and one for in the distance. Its actually super simple, and thanks to AhoyGame for the idea. I just used two different “RVT sample nodes” and lerped the outputs together with my distance blend voodoo. One RVT sample I left the input UV empty so it is just the plain RVT and the second I have added landscape Coords to to adjust the scale.
Edited: I had trouble getting the individual materials to scale correctly due the RVT being just one big texture. My work around atm is I have made a second Landscape layer blend, that i then break and lerp with the RVT sample outputs. In this second Landscape layer blend node I plug in all my scaled up versions to their correct layers and the layers that I don’t use distance blend on I just make material attributes from the RVT sample node and plug that in instead.
Hope that makes sense and this thread helps anyone else looking to do the same.
I did the blending as you did, I tried many tiling(your TESTRVTSCALE) values for far, but they all looked wrong and showed black (my texture inside the material layer used AbsoluteWorldPosition as the UVs parameter), is your material working?