Megafunk / MassSample

My understanding of Unreal Engine 5's experimental ECS plugin with a small sample project.
MIT License
681 stars 112 forks source link

LOD example #42

Open Ji-Rath opened 1 year ago

Ji-Rath commented 1 year ago

Simple example showcasing LOD capabilities with both Visualization and Processor logic. Edit: This PR should only have changes in the Plugins/LODExample but I made a few oopsies and initially made the mistake of making changes in main. (the reason for a lot of commits listed below, those changes have since been moved to another branch)

https://user-images.githubusercontent.com/1747157/179147742-385fba8f-f468-4849-b984-56a61d669eec.mp4

Some additional notes

Ji-Rath commented 1 year ago

I think im being a big doofus and need to relearn git lol My guess is that im paying the price for committing my formations PR in my main branch, then switching it over.

Megafunk commented 1 year ago

If you have to put them both in one PR, that's fine... May as well!

Ji-Rath commented 1 year ago

Ah gotcha, in hindsight i should have done separate branches for my work from the start. I just didn't expect to create multiple PRs so soon. I'll definitely get it right for next time lol

Ji-Rath commented 1 year ago

Just wanted to post a quick discovery on the bug I mentioned earlier: OffLOD appears to fluctuate between Off and High for some strange reason, I can only guess that it is a bug or possibly a fault in my logic.

This appears to be caused by a conflict between LOD Distance calculations and LOD Max Count calculations (In SimulationLOD trait) as can be visualized below. (50% speed)

https://user-images.githubusercontent.com/1747157/179336698-9ee300bf-b97c-4660-a7ac-d547f3d5e280.mp4

I can't exactly say whether or not this is intended logic. In my opinion, if an entity receives OffLOD from LOD Max Count, it should not be overridden by LOD Distance This also highlights another 'bug' where frustum culling is not considered unless LOD Max Count calculations determine it to be OffLOD.

It should be noted that VariableTicking appears to be unaffected and is solely based on LOD Max Count.

TL;DR LOD Max Count determines LOD. Anything currently in OffLOD gets passed to LOD Distance and frustum culling