Saving GPU memory.

Hi there.

I have a large scene and I’m running out of memory, I’m not using any textures so all memory usage is simple materials and verts. The blender view port reports 4,282,017 verts, and 1276.95M memory. I don’t have a great CPU and this is killing the view port but that’s a different matter.

If I add a subserf to all the items I’d like to it quickly gets too much for the G card and the render falls over, I’m using multiple GTX780’s.

I do have a lot of the same mesh’s throughout the scene, and I was wondering if every instance of the same mesh is going to add to memory use. Obviously adding anything is going to use more memory but does copy and paste use the same memory as duplicating?

Are there any tips for reducing the amount of memory being sent to the card? I look at some of the works in the forums that are far more complicated than I’ve got here so I must be doing something wrong.

Thanks.

Hi, first I wold try is check on builder.blender.org for daily build, there was a lot changed on GPU memory usage.
If you duplicate with Alt + D you get a instance not a copy.
You can use a particle system in object mode, or check net for dupliverts.
This picture use 3 particle systems with 3 mesh objects to create 10000´s of grass instances.

Cheers, mib

Attachments


I like the dupliverts idea, I can just use a line and place verts where I need items, but, I don’t think I can resize individually repeated objects?

If I go the ALT+D route, would a newly created object become distinct if I change it’s size, rotation etc? I may be misunderstanding the principles completely, if I create 2 cubes of different sizes I obviously use more GPU memory, if I create a cube then duplicate it and resize the second do I save any memory? Or is a duplicate distinct in the first place?

The Alt+D method saves on memory quite a lot as there is no two copies of the same object. Just a pointer to the same memory.

As for size and position, that is independent of the mesh instance it self. You can consider that all instances are just Empties. They have position, rotation and scale, and pointer to where the mesh is. But to my knowledge also one material for all instances.

Yes, they certainly reference the same materials, and that follows what I thought would be the case.

Do you know if there is any way to turn a copy into a duplicate? I have hundreds if not thousands of items which should really be a handful of duplicates! I could completely re-do the scene, but I’d sooner not!!

Select all the objects you want to be an instance. Then select the last object that is going to be the main mesh. Then CTRL + L Maybe ALT+L (for linking) and there is an option for “Object” (or was it Mesh)… not in front of blender right now so don’t recall. :slight_smile:

but that allows you to link any object to refer to another mesh, material, and other aspects

So the items selected before the ‘main’ item only really contain the position, rotation, scale attributes? That would be perfect, I will give it a try when I’m back in front of my machine.

And this will save use of GPU memory? I really must research more about the use of GPU memory, I can see how textures and effects can take up memory, what I don’t understand is why meshes even without materials/textures can take up so much, I’m guessing the vectors of a mesh are sent to the card, and the textures are sent separately, but even my duplicates seem to take up quite a lot of memory.

A mesh contains a vertex, which requires, X, Y, Z values. Most likely a Long or Float, so 2 or 4 bytes per one location? Lets say 4 bytes per one value, so we have 12 bytes for just one vertex. And it will probably need an index. so lets say 16 bytes per vertex.

And Face needs 3 or more vertex.

A cube will have 8 vertex, so 128 bytes, plus the faces, 6 of them will probably require less as it is just referencing specific vertex. So lets say 4 bytes each reference for each vertex. A single face will have 4 in the case of a square, so we have 16 bytes. So 6 faces we are now upto 96 bytes. So a single Cube will have 224 bytes. This does not include if the face is smoothed, or any other details.

So if you take this into an object that has 1 million cubes (a particle system for example with cubes), which would be 244,000,000 bytes, about 213 MB. Now a particle system uses instances so we drop the 213 MB to 224 bytes plus about 1million indexes, lets say 4 bytes for each reference, we are now down to 4,000,224 Bytes, or about 3.8 MB…

Now this is not including the possition, normals, shading, and many other parameters. But the above explains (very roughly) and with my guessing how big datasets in Blender are.

Same will go for grass. or any instancing. And we are only talking about cubes in my example with 6 faces and 8 verties, though with 1million particle/instances.