Expanding on the capability of nature billboardBatches

Discuss modding questions and implementation details.
Post Reply
User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Expanding on the capability of nature billboardBatches

Post by Daniel87 »

Hi dear modders and devs!

It's me again with another question yet again haha.

So, I constantly come upon the error that I am overusing billboardBatches. So far the max possible billboards does not lag at my machine and I hope it won't on yours neither.
I was wondering if it would be possible to expand on the max. amount of billboards per batch or even add one or two more batches (like an array rather than a single one per MapPixel). Maybe one batch for each tile type (grass, dirt, stone)
Was there a specific reason for these limits and should I rather try and stay within them?

This is rather a discussion than a straight forward request, as I don't want to overstep my boundaries as a simple modder. Asking especially the Devs, what do you think about this idea? Bad idea? And if so, why?
In Julianos we Trust.

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Expanding on the capability of nature billboardBatches

Post by Hazelnut »

Don't know much about the billboard batcher but it has the following constant defined.

Code: Select all

        // Maximum allowable billboards before mesh buffer overrun
        const int maxBillboardCount = 16250;
No idea what the mesh buffer is exactly, since it's a Unity class I've never used myself - but I did find that the vertexes are 16 bit and assuming each billboard requires 4 that would mean limit is 16384. I assume Interkarma lowered it a bit just for a margin of error, but that's a guess.

It can be set to use 32 bit indexes, but that doesn't work on all GPUs according to Unity docs and I don't know what performance/memory impact would be.

16250 billboards is quite a lot, hopefully you can manage within this limit.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: Expanding on the capability of nature billboardBatches

Post by Daniel87 »

But what about an array of BillboardBatches instead of only one per Terrain? But yeah, basically I can manage with less, but since we live in 2021, why not use more, it's just Billboards :D They are incredibly performant and considering many particle systems use billboards and meshes as well, they easily crack a couple thousand per second without any performance issues. I'm open to give it a try and test the performance. If it runs well, I will PR the changes :)
In Julianos we Trust.

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Expanding on the capability of nature billboardBatches

Post by Hazelnut »

Unfortunately that's not as simple as just adding a list/array of batches to the interface. The terrain data used internally in streaming world only has a single batch so a lot of internal code would need changing. I think the only viable option is having a way to use 32 bit indexes inside the Mesh object, possibly this may work if you set that in your terrain nature implementation before adding any billboards using an extension of the default batch class. No idea if that would be possible without DFU code changes, probably not, but you could prototype it to see if it would work.

Personally, my advice would be to focus on what you're doing within the limit for now.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: Expanding on the capability of nature billboardBatches

Post by Daniel87 »

Oh, okay I have no real clue what I would be doing there, so I think under these circumstances I will just stick to the limit use some artistic techniques to make less appear like more :)
Let's keep things simple and clean then. Saves unnecessary stress. It is a nice to have, but not necessary.
In Julianos we Trust.

Post Reply