Object Radius doesn't work with foliage painting

I’m not sure if this is a bug or a limitation?
The object radius node of a material doesn’t work on terrain foliage painted objects. No matter the scale you set in the painting settings the object radius in the material will always be the same.

Would you mind providing me with a screenshot of the set up you are mentioning. Including your Material Editor Graph and what your reasons for object radius are?

Are you attempting to only render certain foliage at a specific radius around the player? This can be done using the PerInstanceFade node in the material editor in conjunction with setting up cull distances within the foliage mode itself.

Let me know if you have any other questions.

Cheers,

I just wanted the material to change a parameter based on how big the asset is in the world. To be more specific, there is some distortion going on that I want to be less for smaller objects. I will then have to make different sized meshes with different materials I guess.

You could create another Material instance and set the parameters how you would like, and then apply that material to your LOD’s. This way it applies that material instance and its parameters based on the size of the mesh on your screen. You will definitely want to have a few LOD’s when it comes to foliage to help with performance when viewing from a distance.

Yea, but that is not what I want. I paint the objects with different scaling settings. Like I have a stone and I paint that mesh at 1.0 scale and 0.2 scale. Now I will have to make 2 meshes with it with 2 materials. So the 0.2 scale has the material that has the distortion parameter less.

You might be misunderstanding how object radius is calculated, which is based on the Static Meshes scale set within the Static Mesh Editor, and not the scale set within the Foliage Paint. These are not linked on purpose as they operate differently at their core functionality.

Object Radius

The typical workflow is to create multiple meshes to be computed as your levels of detail based on screen size. You don’t need to create multiple materials, but only one master material, instance that material , and have that applied to the LOD mesh based on the screen size/scale which you can set up within the Static Mesh editor.

Uncheck the Auto Compute LOD Distance, so you can manually set at what screen size your material instance is applied.

LOD Settings

I really suggest looking into Mesh Distance Fields in conjunction with foliage as it improves performance greatly. We used this feature in our recent Open World GDC demo to create a visually stunning and asset heavy scene.

Mesh Distance Fields

Cheers,

I am having the same issue as OP. I am using object radius to create scaling textures. They work great on static objects but when used in the foliage tool the texture scale breaks. See these images…

Thanks!

Hello oxygencube,

I was able to verify the issue you are reporting here and have entered a feature request to allow painted foliage instances to use the ‘Object Radius’ input data node (UE-29023).

This is a limitation of the instance rendering system and the ObjectRadius isn’t available per instance. The engineer said that he can get it to work, similar to the way the ObjectPosition node does correctly give the position for individual instances when used in the vertex shader.

Once the fix has been implemented either myself or another user with respond with an update.

Thank you,

Any update on this?

Below is a link to the report on the Issues Tracker. It is currently marked as backlogged and I have not further information on the issue.

UE-29023

Thank you,

.

Since the issue/feature request is no longer public - would just like to say, this would still be a nice thing to have.

Not only for texture scaling as oxygencube mentions above, but also because it’s another way to get a random constant value for an instance - I have a situation where I need more than one random value on my instances, but I can’t use ObjectPos because the instances get moved. So I only have the single PerInstanceRandom value to work with. I can hack random-but-still-related values by using some math, but another constant value to work with, like ObjectRadius, would be great.

Its a shame this hasnt been fixed yet. I use ObjectRadius to control Vertex Animation speeds for differing plant scales.