Is it worth it to (un)load materials? (performance wise)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nuno Donato
:warning: Old Version Published before Godot 3 was released.

Hi folks!

So for my game I’ll need many different objects which will have unique materials and shaders. All of them will use somewhere between 2-5 textures to get the final material result (some textures will be shared between objects, others will be unique).

I dont know if I should be afraid of this due to the performance impact of having too many materials and loading too many textures.

I did a check with a basic LOD test, and I see the performance improvements are basically due to lower number of vertices, but the video mem used is still the same because the materials are still loaded, even if not shown.

So I was wondering if it would make sense to detect when an object is out of sight (or too far), and unload that material(and textures), and load it again when needed.

Does it make sense? Or the trade-off is not worth it?

PS - my tests were with godot 2.1 but I’m interested in doing this on 3.

I’m curious about this too. :slight_smile:

volzhs | 2017-03-27 20:21

Games with large view distances switches almost all things including their meshes, materials and textures according to the distance to the camera, right? Because Godot 3d is not that matured in 2.x versions we may need to do this earlier. May be 3.0 will change this.

Correct me if I’m wrong.

vinod | 2017-03-28 14:40