fenomas / noa

Experimental voxel game engine.
MIT License
608 stars 86 forks source link

custom renderMaterial performance (for animated textures) #186

Open MCArth opened 1 year ago

MCArth commented 1 year ago

Hi, I was thinking about adding some blocks with animated textures into my game, but I'm a bit worried about the performance if large swathes of blocks are this type - e.g. water

I notice you comment "this can impact performance" next to the renderMaterial property (I imagine it's one face per exposed block face as it can't be greedy meshed).

Have you experienced any big performance issues using renderMaterial/to what extent?

Thanks :)

fenomas commented 1 year ago

Hey, great question... I'm not actively using render materials right now, but I believe they are currently meshed and displayed just like all other terrain - so I'm not aware of any performance impact. I'm not sure if there used to be, or why exactly I wrote that in the docs. 🤔

With that said, since terrain is merged there could be issues with stretching, like a material displaying the wrong way across merged voxel faces. Plain old textures should work okay, but I haven't tested anything else (procedural textures, for example). Would be interested to hear how it goes for you!

MCArth commented 1 year ago

Ahh I see, that's cool. I guess it would be an extra draw call per chunk with the blocktype but that's not awful

Will give it a go (might be a bit since I went without for the block I was considering using it for) but will definitely let you know