Hey there! I am currently investigating how the new runtime virtual texture type “World Height” works. The regular virtual textures work like a charm, but the “World Height” one seems to have issues. Outputting world height from a static mesh via the “Runtime Virtual Texture Output” node works great, but not for landscapes. It also does not work if the landscape is using the material domain “Virtual Texture” and not the “Runtime Virtual Texture Output” node. It seems like landscapes cannot write to the height data of the FP16 world height virtual texture at all. Even outputting a constant value to the virtual texture from a landscape results in some strange and utterly broken numeric values inside the virtual texture. It seems like the texture contains some random memory value at every pixel.
Is this a known issue?
EDIT: It seems like outputting a constant value from the landscape material to the world height actually does work, but you have to offset it by 98303, which is probably due to the FP16 packing in PackWorldHeight()? On top of that, it seems like Absolute World Position (MaterialParameters.AbsoluteWorldPosition.z) does not contain a valid value for landscapes in the virtual texture rendering pass, thus it seems to be impossible to output proper height values for landscapes. However, absolute world position X and Y seem to work. As far as I know, the landscape vertices are offset in the vertex shader after sampling the normal height texture for the landscape. Could it be that this is not executed in the virtual texture rendering pass for landscapes? That could explain why it is so off.
EDIT 2: It seems to be two different problems, actually:
- Writing a constant world height of 0 (or 100, or whatever) from a landscape does not result in 0 (or 100, or whatever) in the virtual texture
- AbsoluteWorldPosition.z is not functional for landscapes in the virtual texture pass
EDIT 3: It turned out that writing a constant value to the height virtual texture inside a landscape does work, but I was not able to verify it, as the virtual texture did not update.
However, I was able to confirm that AbsoluteWorldPosition.z really is not functional for the virtual texture pass. It always returns the Z value of the landscape actors location. From my understanding, the landscape mesh is really just flat and then the vertices are transformed at runtime after sampling the normal-height texture for it. This does not seem to happen when rendering to the virtual texture. The landscape is just plain out flat.