Download

Runtime Virtual Texturing on Mobile

Hi guys.
Used Version : 4.26.2
I’m trying to render my landscape by using RVT on android device.
But, I don’t think it works correctly. Play in Editor and Window Packaging Binary are fine.
Here is an attachment:


it’s quite simple material for landscape that I’m using.

Result on vulkan mobile preview :

So, I looked into the source codes regarding of landscapes.

UMaterialExpressionLandscapeLayerWeight::Compile()
FHLSLMaterialTranslator::StaticTerrainLayerWeight()


There is no WeightmapIndex on Mobile.

So I made changes some source codes like this :


I checked the “Parameters.LayerWeights” works correctly.

LandscapeVertexFactory.ush


I guess NormalmapTexture is empty when shader compiling.

I’d like to know it’s bug in UE4 or what I’m missing. Somebody help me.
Thanks,

Wrong screenshot?

I’d like to see the screenshot result too.

But…
Are you sure the feature works at all on the android device you are targeting?

These are supposedly real time render targets. Meaning the app needs to take an image and write it somewhere (in memory not on disk).
The overhead of it is not insignificant on a mobile device.

I had this working in a build for .25 about 4 months ago tested on note 10+.

Pushing down the compatibility to allow older distros (s6 official patch level) did also require adding in some fallback code for the feature, which was just not working for it.
In that case, it would run fine over PIE testing but load a black landscape on the device.

Sorry for them, I missed to upload the result.
image

Here is my attachments :


→ Editor Preview with RVT


→ Vulkan Preview with RVT


→ Vulkan Preview without RVT

Those are using same material.

I found the reason why is happen like this.
Now I can use RVT on mobile device. But I had to modify some codes in UE4.
I will share sooner or later.

1 Like

The mobile weight texture is copied from weight texture when cooking.
We have to get layer names from material.
Here are the steps :

  1. image

in GetAllReferencedExpressions, We can get expressions linked by final material node kinds of material attributes or not.
But, in case of the RVT, we couldn’t get it. because RVT output node is custom node.
That’s why mobile landscape couldn’t generate the mobile weight map texture when using the RVT.

So, I’ve added the some codes like this…
in GetAllReferencedExpressions →

Finally, we are able to use the RVT in AOS.

Given what happens with forum transitions,
Could you just share [code] tags for the future topic visitors?
Also, you may want to submit as a branch update on git.
The current .26 has this issue for the newest Android version. Just tested a publish.

And thanks for sharing.


I don’t see any difference between your last screenshot and the code in my landscape, and I’m still having the issue of the landscape not writing to the RVT. Did you send the right screenshot? I’m running this on android btw

Review the file history in git. 6 months later it may have finally gotten a patch…

it still doesn’t work in 4.26.2

Well, .26 isn’t the latest.
And usually the git distros include different fixes than whatever is published in the launcher.
You do have to build from source to use them.

Regardless of any of it. You should just access git and review the changeset for whatever version you want.
Verify if any code changes were made.
If they were not, then you would have to pull whatever the latest and make the suggested change.

The problem is likely still that there’s a difference between the 2 functions that generate the layers for mobile/non mobile.

From my testing the problem is resolved in 4.27 on all platforms.