Reducing RAM usage

Started by N-drju, November 29, 2016, 04:55:41 AM

Previous topic - Next topic

N-drju

Is there any way to reduce the amount of RAM that is used by the objects?

Let's be more precise: I usually use DAZ Studio to construct and export human models for use in Terragen. It is not unusual for me to see RAM usage jumping up by 500MB upon loading the object into the scene. I can still manage my renders with ease, but I get nervous whenever RAM usage climbs up too rapidly.

So yes - is there any way to reduce this effect?

P.S.: My human objects usually have about 55 parts that are distributed among around 16 shaders (skin + clothing).
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

Dune

One thing I always do is rearrange the surfaces/parts, so they group into one for each surface, in Poseray. If you have the mouth closed; delete teeth, innermouth, tongue and one more.
If you use (a lot) more objects using the same surfaces, you can load the surfaces once (as a default shader set), then link that to each part in each object. More work (a lot more), but saves loading the same surfaces/textures with every object.
For more distant use I have a set of reduced texture maps.

N-drju

#2
Quote from: Dune on November 29, 2016, 05:14:34 AM
One thing I always do is rearrange the surfaces/parts, so they group into one for each surface, in Poseray.

Yes, I already do that in Terragen (connecting lips, face, ears etc. to the "Face" shader for instance) and I still end up with 500MB RAM increases.

Hm, and can I have an object consisting of just one part? :) Something like "baking" the shader?

DAZ Studio in theory has an option to bake the shaders! However any time I try this option out it just returns me a huge black square and nothing more. :-\

Oh, and one more thing... Would saving the texture files in some other, lighter formats help?
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

Dune

#3
I just use Poseray, copy materials to groups, delete checked/invisible groups (like teeth...), merge groups that use the same material (give it the name of that common material), after having left maybe 5-10 groups (so, each using one material), go to materials tab again, copy groups to materials (you'll loose materials it says, and they'll all turn white), copy the name of the material (and possibly path) into the box, apply... and it should be back. Or relink to that material. Then export.
What I also do is save the nodes needed for a certain object/model as tgc. In that case relinking isn't even needed, just open in TG and relink the imported tgc nodes to the necessary parts' nodes. If I make myself clear....
Oh and no, if you save as jpg or LZW tiff, it'll still be expanded in TG. Only thing is to reduce size from 4k to 1-2k or so, if possible for distant views.

I don't think it can be one part, as the UV's of those parts usually overlap. But in some cases that may work.

N-drju

Dune, one more thing - once you are done pre-processing the object in PoseRay, do you still use standard part-to-texture method of putting textures at the object, or do you load the MTL file which I can see might be helpful? Not really sure what the MTL actually is though...
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

Dune

If you save an object the mtl file points to the texture files, so if you have saved from Poseray with textures loaded, all you have to do is import in TG. TG will read the mtl file. If you haven't an mtl file, I guess you can (have to)  load textures within TG by hand. Does that answer your question?

N-drju

Yep, it does.

So let's sum it up - by using Poseray I can for instance remove character's legs (;D) leaving only the trousers on (fine enough). This way, the smaller in parts and textures an object will be - the less RAM space it will use when loaded?

This makes sense as XFrog plants, which usually have 3 to 4 parts, never cause a spikes that high in RAM use.

Sounds like it makes sense?
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

Dune

Yes. I sometimes cut legs off too  8)  But on the whole, these characters aren't really that big are they? 15MB or so? Cut a leg off and it's maybe 13. Perhaps most RAM is taken up by loading (big) textures. How much RAM have you got?

N-drju

Hm, looks promising. I'll post an update after I try it. :) Unfortunately, that's an additional program that I need to learn to operate... Hopefully it will be worth it.

I have 8GB RAM on my current computer. So I imagine that means that, calculating it roughly, I can add around ten fully detailed human figures to a complex scene without seeing any adverse effects.
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

Dune

Yeah, 8 is not much. TG needs around 4 I think, with all the new fancy stuff. Can't you put some extra in? Won't cost a leg  ;D

N-drju

Hahah. ;D I guess you're right. But still, I'm quite satisfied with what I have now. With 8GB I managed to create many things I could not do before with 4GB. But of course - it can always be better. Maybe I'll get myself an extra "cube" underneath a Christmas Tree?

I just made a simple test with Poseray and deleted some groups as you suggested. Some I could not delete - they proved to be just too big. I managed to reduce RAM usage on this particular object by 30%. Not too bad I guess!

To be honest, I don't mind removing legs, teeth and cutting tongues. ;D After all... home is where the hurt is. ;D
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

Dune


Oshyan

The main reason human figures probably take up more memory than your average Xfrog plant is the use of many unique image map textures. XfrogPlants can be very detailed in geometry, which can sometimes take up a lot of memory, but they use very few textures in most cases, and not crazy high resolution ones (2k at most). An entire tree might use 1 or at most 3 different leaf textures, and a single bark texture usually as well. So for a whole tree you might have 4 textures, which really does not take up a lot of memory. Poser figures that are fully clothed will have high resolution skin, eye, hair, and clothing textures. Often, as you said, upwards of 50 different parts each with their own textures. So that's what tends to take up a lot of memory for each.

- Oshyan

N-drju

Yes, that's true Oshyan. The model I will use in my next picture is from the newest Genesis 3 generation (in case you are familiar) and they went downright crazy - textures for limbs, face and even eyes are 4000x4000 pixels each! ;D

Fortunately enough, what Dune suggests seems to cut down the memory usage. Also, some difference can be felt with Photoshop "intervention" when resaving textures into JPEG formats of quality 9 (down from 12). Though this step gives you only tiny reduction in RAM (20-70MB per texture). I might try to resize these textures yet down to 2K.
"This year - a factory of semiconductors. Next year - a factory of whole conductors!"

Dune

The jpg quality doesn't reduce RAM, afaik, as it will be unpacked in TG again to full size (I think that is so anyway). Reducing real size to 2k or even 1k is a better option, especially for parts that are not in close-up view (like eyes). But do save as name_small.jpg or you'll loose the original, but I don't have to tell you that  ::)