cancel
Showing results for 
Search instead for 
Did you mean: 

Would hollowing out my models save memory?

P3nT4gR4m
Consultant
Not sure how these signed distance field thingmybobs work but it's something like a 3d grid filled with "voxels", right? Hollow models = less voxels, right? Or is that not how it works?
17 REPLIES 17

Thmoas
Rising Star
Try it but I would expect the lowest memory is with the lowest model detail. Hollowing out creates more model detail.

nalex66
MVP
MVP
Yeah, I think that would make it worse. Empty or full space shouldn't take up any memory, it's the surfaces between them that do it. hollow models = twice as many surfaces. That's why any attempt at realistic hair ends up being a total memory hog--huge amounts of surface area in a small space.

DK2, CV1, Go, Quest, Quest 2, Quest 3.


Try my game: Cyclops Island Demo

Anonymous
Not applicable
As @nalex66 said, doing that would likely kill performance due to the increased poly count

P3nT4gR4m
Consultant
Ahhhhh. Good point, so we're dealing with surface area? A lot of my stuff is accidentally hollow (and complexly hollow to boot) a result of the way I scribble in the forms. Instead of hollowing out, I should go back and fill in the gaps.

*Edit* Hold on tho, it can't be that simple. Medium is definitely storing the interior (non surface) mass. Lay down a blue stamp, then do a bigger one at the same origin in red. Cut it in half and you'll see both colours through the cross-section. It must be holding that data somewhere.

Maybe hollow mesh will save system ram at the expense of gpu-ram and filled mesh will save gpu at the expense of system ram?

robdood
Explorer
@P3nT4gR4m that definitely alludes to it being a better idea to have hollow models, then.  I had a feeling it worked that way! 

nalex66
MVP
MVP
I think it still deals in surfaces that surround closed spaces, though. The layer is a matrix of tiny cubes that store a value, '0' = empty, and any cube that a surface passes through stores a decimal value that indicates distance from the center of the cube to the surface. I suspect that values are not stored for internal volumes, so that part of your model doesn't consume memory. If that's the case, then the hollow model still has much more surface area and thus consumes more memory. Or, maybe interior volume stores a simple '1', which consumes less memory than a float value.

It may be worth trying it and comparing file size and RAM load between a scene with a hollow model and a scene with the same model with a solid interior.

It's interesting that the internal object is preserved in your example of two different coloured stamps. It may be that both surface definitions are kept because of the different colours, to maintain the integrity of a model made with multicolour clay. I guess that gets complicated as you start blending, smoothing, etc. with different colours of clay, so maybe there is more stored data for internal volumes than I thought.

Here's an experiment to try: How does the file size or RAM load differ between a scene that contains one large stamp, a scene that contains one large stamp that fully encloses a smaller stamp of a different colour, and a scene that contains one large stamp that fully encloses a smaller stamp of the same colour?

Of course, the Undo buffer may obfuscate efforts to determine memory load from a model... is the Undo history preserved in the save file?

DK2, CV1, Go, Quest, Quest 2, Quest 3.


Try my game: Cyclops Island Demo

P3nT4gR4m
Consultant

nalex66 said:


Here's an experiment to try: How does the file size or RAM load differ between a scene that contains one large stamp, a scene that contains one large stamp that fully encloses a smaller stamp of a different colour, and a scene that contains one large stamp that fully encloses a smaller stamp of the same colour?

Of course, the Undo buffer may obfuscate efforts to determine memory load from a model... is the Undo history preserved in the save file?


My thoughts exactly, I'm sure there's a ton of other complicated stuff in ram that would muddy the waters. Hopefully one of the devs will chime in and save us the guesswork.

nalex66
MVP
MVP
Yeah, I figure if one uses a really complicated stamp, maybe the differences will show through the white noise. Each scene started from a new boot of Medium, same stamp, no Undo, same process as much as possible to get a good controlled comparison.

I might experiment a little if I get time tonight, or else next week after Christmas visiting is finished. (Gotta go spend a few days with my wife's family, then over to see mine on Christmas day, then 8 days at home to play with my toys!)

DK2, CV1, Go, Quest, Quest 2, Quest 3.


Try my game: Cyclops Island Demo

kojack
MVP
MVP
There's two main things to think about here: memory used to store the SDF (Signed Distance Field) and memory to store the mesh.

The mesh is the easy one. It's an implicit surface, so the mesh itself isn't what we are editing, it's generated from the SDF as needed. Every triangle needed in the mesh will add to the memory use. Hollow objects will have a higher triangle count because the interior surface still needs to be generated, whether you see it or not. In the example above of cutting through a two colour object, triangles are only generated where air touches solid. The mesh doesn't care about the inner mass if there's no air touching it (requiring triangles as the boundary).
So hollow objects should use more memory for the mesh, and will affect the exported mesh size and the rendering performance).

Now for the SDF. This is trickier because we don't know if they do any tricks involving spatial partitioning (I'll come back to this). If it's a simple raw SDF, then solid and hollow make no difference. An empty layer and a solid layer use the same ram. This is because the SDF is a giant grid storing maybe 8 bytes at every grid cell. (I guess 8 bytes due to 4 bytes for a float distance value and 4 bytes for a 32bit RGB colour). If the grid is 1024x1024x1024, then that layer uses 8GB of ram no matter what you put in it, air and clay are equally expensive.

Spatial partitioning is a way to divide up a region based on content. Common algorithms include BSP (binary space partition, used for maps in Doom, Quake, Unreal, etc), Quadtree (mainly 2d maps), Octree (3d), KD Tree (popular with raytracers), etc. Medium would benefit from Octree or KD Tree. The idea is that large regions of the same value (like air that's far from a surface, or a large blob of clay with 1 colour) can be optimised down to use less ram (for example, if the top left corner of the layer has only air, then don't store individual air grid points, just flag it as empty).





Author: Oculus Monitor,  Auto Oculus Touch,  Forum Dark Mode, Phantom Touch Remover,  X-Plane Fixer
Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich
Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2