Controling LOD distances for instances?

   4849   6   2
User Avatar
Member
1004 posts
Joined: April 2017
Offline
Hi!

My HDA is ouputing a point cloud with the s@unreal_instance attribute to fetch megascan assets. It's working nicely but the way the LOD distances were set up on those assets, they become low res too quickly. Is there a way from my HDA to control the distance of all of them? I'm using about 20 different megascan assets so I would like to avoid changing the distances of each asset, one at a time.

...Or maybe there's already a way to make changes like that to multiple assets inside of Unreal?

-Olivier
User Avatar
Member
10 posts
Joined: March 2019
Offline
Howdy!

This sounds like it's probably easiest to set up on the Unreal side.

If you've found a preset LODGroup in the static mesh editor that works for your situation, you can set that for multiple meshes at once via the Property matrix:
- Select the assets in the content browser, right click -> Asset Actions -> Bulk Edit via Property Matrix
- In the LODGroup field, type in the LODgroup you want (has to match exactly of course)
- Hit Enter, the LODs will generate, close and save the assets


Alternatively, if you want extra control in manually setting the number of LODs, screen percentages, reduction amount etc per LOD:
- Set up and fine tune the custom LODs on one asset until it is pure perfection.
- In the content browser, right-click on that asset -> Level of Detail -> Copy LOD
- Select the assets you want to have the same custom LOD setup, right-click -> Level of Detail -> Paste LOD
- All your custom settings will be applied to those assets


Hope this helps!

Attachments:
Screenshot_34.png (36.8 KB)
Screenshot_36.png (91.5 KB)

User Avatar
Member
1004 posts
Joined: April 2017
Offline
Thanks for the reply.

I'm only looking to change the distances that the meshes changes LOD level. The megascans already comes with a bunch of LODs in the assets. But your post seams to be about generating new LOD meshes. Or maybe I'm misunderstanding you.

Currently, I have to get super close for the highest resolution LOD to show up. I'd like it to stay highres for a longer distance.
Edited by olivierth - June 21, 2022 10:55:59
User Avatar
Member
10 posts
Joined: March 2019
Offline
olivierth
I'm only looking to change the distances that the meshes changes LOD level.
Ah yep - fair enough!

That second method will still allow you to do that, if you don't change the LODGroup dropdown because that will trigger UE to generate it's own LODs.
- Open up one of the assets, and scroll down to LOD Settings and untick "Auto Compute LOD Distances".
- Scroll up to the LOD Picker and tick "Custom", which will allow you to see all the LODs settings at once.
- You want to decrease the Screen Size value for each LOD, so it's smaller in screen space before that LOD swaps in
- (easiest to just type Screen in the search bar to get them all up or you will be scrolling all over the place).
- Once happy, save and do the right click ->copy LOD, paste LOD etc described in the first post.

Keep in mind of course, because the LOD switching is based on screen size this probably can only work well for assets of similar size, use, and number of LODs. You'll save time by copying and pasting the LOD attributes, but you'll probably need to do it for all your small stuff, then medium stuff, bigger stuff, and there's probably considerations about say a rock vs a tree or piece of foliage etc - but it all depends on your outcome as well.


Hope this helps! Cheers

Attachments:
Screenshot_37.png (182.6 KB)

User Avatar
Member
1004 posts
Joined: April 2017
Offline
Thanks for all the detailed explaination, fureler!

I just noticed yersterday that there's an lodX_screensize attribute I can use from Houdini. I might be able to control it from my HDA.

-Olivier
User Avatar
Member
10 posts
Joined: March 2019
Offline
Hi again Olivier!

Out of curiosity.. did you ever get the lodX_screensize attribute to work with LODGroups?

I'm in a similar situation to yours above now..
I have had the prim attribute lod_screensize working when I create my own LODs, but so far haven't been able to get lodX_screensize to change the screensize options on instances or meshes that I let Unreal generate LODs for..

Cheers!
User Avatar
Member
48 posts
Joined: May 2019
Offline
furlerer
Hi again Olivier!

Out of curiosity.. did you ever get the lodX_screensize attribute to work with LODGroups?

I'm in a similar situation to yours above now..
I have had the prim attribute lod_screensize working when I create my own LODs, but so far haven't been able to get lodX_screensize to change the screensize options on instances or meshes that I let Unreal generate LODs for..

Cheers!


Hey, furlerer 🙂

From docs [www.sidefx.com]:



To create an actual attribute you can use a Attribute Create SOP. Set it to Detail (instead of prim), type is float, and value param (first matrix index) is where you put screensize values.

As there is no info in the docs about the order of values [www.sidefx.com] (from highest to lowest or in reverse) I thought that 1 was for the highest LOD, but it turned out to be the reverse which makes sense now:

lod0_screensize: 0.2 (high-quality LOD will be used when the mesh occupies 20% or more of the screen)
lod1_screensize: 0.4 (switch to LOD 1 when the mesh occupies 40% or more of the screen)
lod2_screensize: 0.6
lod3_screensize: 0.8
lod4_screensize: 1.0 (switch to the lowest-quality LOD when the mesh occupies the whole screen)

So, in my case, I had 5 LODs and named them "lod_0" to "lod_4" (via Group SOP), I have to create corresponding "lod0_screensize" to "lod4_screensize" attributes. Each attribute defines the screen size threshold at which the corresponding LOD should be used in the Unreal Engine.

Now to your question, here's the setup that worked for me:



After baking HDA to Unreal Actor through Houdini Engine:

Edited by AnimGraphLab - July 30, 2023 01:00:38

Attachments:
lodX_screensize.png (645.8 KB)
lodX_screensize.gif (13.1 MB)
lodX_screensize1.png (68.3 KB)

3D Generalist.
Socials: https://linktr.ee/AnimGraphLab [linktr.ee]
  • Quick Links