Sunday, August 27, 2017

Foliage Gotcha

Foliage Gotcha


Foliage is a copy of a mesh that renders very fast. All foliage based on a mesh render the same way except they have a different location, rotation and scale. This allows you to put a lot more items on the screen.

When you add foliage, you get an index. That index matches an entry in an array on the parent mesh the foliage is based on. Problem is, if you delete any foliage, the arrays shrinks invalidating the indexes you were previously given. I did find a way around this issue but in the end, the performance downside of managing foliage indexing outweighs the performance gain from using foliage.

More work is needed in this area, but for now, I am disabling foliage on all my meshes.

Exactly what was unreal thinking when they designed this? The only handle you have to the foliage is an index they give you. That index can be invalidated by deleting any other foliage. wtf?

I have spent a LOT of time incorporating foliage into my framework. I think I may have to stop using it unless I stop deleting foliage unless it is absolutely necessary.

No comments:

Post a Comment