Can I calculate foliage radius or LOD phase in the Material Editor?

I’ve been using the following graph to calculate my static mesh’s screen size so I can create my own, improved transitions between LODs:

This works perfectly for static meshes and is much much cheaper and less noticeable than dithered transitions, however, for some reason this method doesn’t work with instanced foliage static meshes and I’ve determined it is due to the Object Radius node which does not seem to work with foliage.

I’m wondering if I need to calculate the radius differently for foliage, and if so, how?

If not, is there a way to recreate how the engine is calculating the LOD transition distance within the Material Editor? I really find the dithered stippling quite expensive and noticeable on foliage.

Thanks!

Answerhub Post: Can I calculate foliage radius or LOD phase in the Material Editor? - Rendering - Unreal Engine Forums

Could you test that does object radius work on vertex shader? With instanced meshes there are some limitations to what data is available in pixel shader. So simple test would be to plug Object Radius to custom texture coordinate.

Hi Kalle-H, sorry for the late reply, I tried to run the radius node through the vertex shader but unfortunately the result is still broken - I think the problem here is that the radius information is not available for each foliage instance and returns a garbled number. Using the object radius normally simply returns the radius of the entire InstancedStaticMesh Actor which is not useful :frowning:

Not sure if there’s any other solution for this other than begging Epic to implement support for object radius for foliage or asking them to implement a node that outputs LOD transition information in the material editor. I envision the LOD transition node as outputting some kind of constant that we can use to lerp material parameters between LODs, maybe 0-3 if the model has 3 LODs?

Might have to either wait or find a code solution to this.

Can you just use distance infomation to calculate lod?Its basically clamped linear distance blend,and cheaper,though it wont be suitable for every scenerio.

This might explains the situation.

Yep, looks like there’s a ticket for it, but it’s backlogged right now Unreal Engine Issues and Bug Tracker (UE-29023)