playMaker

Author Topic: Material Array uses too much GPU memory!  (Read 1092 times)

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Material Array uses too much GPU memory!
« on: October 02, 2021, 04:19:58 AM »
Hey guys. I have 4 materials array in my game each one contains 30 materials but the problem is when I build it uses 2 GB of GPU memory! that huge because game likes mafia only use 3 GB of  my GPU memory!? :o
« Last Edit: October 02, 2021, 04:29:33 AM by Silicon Power »

Groo Gadgets

  • Beta Group
  • Full Member
  • *
  • Posts: 175
Re: Material Array uses too much GPU memory!
« Reply #1 on: October 02, 2021, 06:39:54 AM »
Heya,

The issue with all PlayMaker arrays is that it loads the content into memory. The best way I have found to deal with this is to simply use the "Resources Load" action and store your materials in an array as strings (i.e. the name of the material).

Put all of your materials in a "Resources" directory, if they are in a subdirectory you will need to add directory name to the material name separated with a "/".

Silicon Power

  • Full Member
  • ***
  • Posts: 186
Re: Material Array uses too much GPU memory!
« Reply #2 on: October 02, 2021, 07:01:20 AM »
Heya,

The issue with all PlayMaker arrays is that it loads the content into memory. The best way I have found to deal with this is to simply use the "Resources Load" action and store your materials in an array as strings (i.e. the name of the material).

Put all of your materials in a "Resources" directory, if they are in a subdirectory you will need to add directory name to the material name separated with a "/".

The 4GB limitation of resource folder avoid me to do this :'( Is this a playmaker bug or unity array system works like this?


Silicon Power

  • Full Member
  • ***
  • Posts: 186
Re: Material Array uses too much GPU memory!
« Reply #4 on: October 02, 2021, 11:51:56 AM »
Hi.
The limit is a unity issue :
https://forum.unity.com/threads/bug-4gb-limit-to-textures-in-standalone-build.441116/#:~:text=Unity%20Technologies&text=This%20is%20a%20limit%20of,limit%20of%20which%20is%204GB.

No I mean array system! Material array loads contents into memory so I have around 100 materials inside 3 arrays and it uses 2 GB of GPU memory! Games like GTA only use around 4 GB GPU memory I can't spend 2 GB of GPU only for 100 materials.
« Last Edit: October 02, 2021, 11:56:05 AM by Silicon Power »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Material Array uses too much GPU memory!
« Reply #5 on: October 02, 2021, 01:24:33 PM »
i mean the limitation for resource is 4g and its a unity issue.

also if you have them in an array they will be loaded as they are referenced in a scene.

which is again unity :)

1 possible way could be by using a Scriptable Object. (i have not tried this)
on the scriptable have 2 lists 1 for reference and 1 for material itself.

But you will need to make an action for that, where you can get the material by reference name or index.

Have a look at this post on scriptable objects :

Playmaker + Scriptable Objects = Win

and this tutorial :


wetcircuit

  • Full Member
  • ***
  • Posts: 158
    • wetcircuit.com
Re: Material Array uses too much GPU memory!
« Reply #6 on: October 02, 2021, 01:48:23 PM »
the textures may be uncompressed in memory…?

if your textures are stored as 2k rgba, you could easily hit 20mb each.