Author Topic: How to implement a memory-efficient "Grunge" picker  (Read 632 times)

Some time ago, I made a "Grunge" picker SBS. The input is an integer, and the output is a grayscale image. You can see an image of this attached.

Basically, it just uses a big switch to return a different grunge image depending on the integer given to it. This seemed to work pretty well, but what I've found is that this SBS can easily crash Substance Designer in a couple of ways. The most noticeable is that when generating thumbnails for any SBSs that use this generator, it seems that loading this SBS forces all of those grunge textures to load, one for every thumbnail. My system immediately runs out of memory.

I was looking for an alternative approach to using dynamic grunge maps in this way, if one exists. Is there a way I can "lazy load" the grunge textures, so that they don't all load every time something tries to generate a single grunge image?

It's worth mentioning that the image below shows the generator using a combination of "Grunge Map" nodes, and "Grunge Map Bitmap" nodes. I thought maybe it was the bitmap nodes causing the problems, and removed them. But, the same memory issues apply even when the graph contains only the generator nodes, and no bitmap nodes.