PDA

View Full Version : Segment Memory



drclare
09-21-2003, 01:14 PM
I just saw in another thread someone mention that increaseing segment memory helps render speed on dual processor machines. Is this a good idea? The only reason i ask is because when i first started using LW in os9 and X it was crashing a lot when i used hypervoxels. I called Newtek tech support and we went through some stuff. I asked him about segment memory and he said that generally the best setting is the default of i think 8Mb. What do you guys think. Will increasing it make LW less stable during rendering. If not, what should i increase it too? I am running a DP 800Mhz G4 in OSX, LW 7.5b. Thanks.

DaveW
09-21-2003, 01:33 PM
The segment memory should be however big it needs to be so that you render your image in one segment. If your segment memory is at 8mb, then a video-sized render would be split into 2 segments. The only time you want to render with more than one segment is if you don't have enough RAM for one segment; in that case rendering with segments will be faster than using virtual memory.

drclare
09-21-2003, 01:43 PM
Well, here is something weird. An image i rendered before with 8Mb segment memory took 4min 44 secs. Now i changed it to 16Mb segment memory and the same image to 4min 49 secs. The first rendered with two segment and the second with one segment. Any thoughts?

mlinde
09-21-2003, 02:19 PM
Originally posted by drclare
Well, here is something weird. An image i rendered before with 8Mb segment memory took 4min 44 secs. Now i changed it to 16Mb segment memory and the same image to 4min 49 secs. The first rendered with two segment and the second with one segment. Any thoughts?

Yes.
What else is running when you are rendering? A 5 second difference could be caused by something as innocuous as your system hitting the internet time server to update your clock, or an automatic email-check in Entourage. I find that if I am running any application that calls processor cycles (even in the background) my renderings will lose a bit of time. You have to remove all variables that would hit the processor to make an accurate comparison, and frankly, the difference of 5 seconds over 5 minutes isn't that much.

drclare
09-21-2003, 02:29 PM
Yeah, well i had safari open while i was rendering, but i do that a lot. 5 seconds isn't a big deal, but i was just hoping that rendering as one segement would decrease rendering time by a recognizable amount. Overall do you think that larger segment memory will significantly reduce rendering time?

drclare
09-21-2003, 02:34 PM
Huh, now i tried a different image with 16 Mb and it rendered in 46 seconds, then changed it back to 8Mb and it rendered in 30. Maybe there are a lot of factors that affect this, of which i don't know about.

DaveW
09-21-2003, 05:20 PM
That's strange. I'm on a PC, but it should work the same on a Mac, and every time I've tested it, 2 segments takes a little longer than 1 segment. If the scene is very memory dependent I can see how 2 segments would be faster. Otherwise, it is a mystery to me!

drclare
09-21-2003, 09:37 PM
I also tried increaseing the segment memory to 32Mb, just to see what happened, and my render time increased by 2 seconds. Weird. Has anyone noticed this on their mac? Maybe its another feature that works as it should on the PC but not on the mac.

mlinde
09-21-2003, 09:57 PM
Originally posted by drclare
I also tried increaseing the segment memory to 32Mb, just to see what happened, and my render time increased by 2 seconds. Weird. Has anyone noticed this on their mac? Maybe its another feature that works as it should on the PC but not on the mac.
I posted this in another thread a moment ago, but it may be that when you take more memory than necessary to bump down to one segment, you are taking memory away from LW? Set it at just enough to get to one segment, and test it. See what that does.

drclare
09-21-2003, 10:14 PM
Well, i tried 14Mb, which was the least needed to render with one segment, on the first image i tried, and it render 9 seconds slower. Then i tried using 4 segments, just to see, and it rendered at 20 seconds over. So, i don't know what is going on. 8Mb seems to work best on my machine.

Meshbuilder
09-21-2003, 11:33 PM
Weird, I think I have tested this before on Mac. Im going to test it again on a Dual 1,25 G4 today.. I will post my results later..

Julian Johnson
09-22-2003, 06:16 AM
Here are a few tips on Segment Memory (some unattributed that I've collected over the years). The interview precis with Ernie Wright directly states at the end that multiple segments *may* speed up rendering in some cases.

Unattributed quote:

Increased segment memory only speed rendering up if there's motion blur,
DOF or Field Rendering involved in the scene. The fewer segments Lightwave
renders in, the less it has to recalculate the positions of objects per
frame, and that's where you'll find the biggest speed benefit.


Prem:

Segment memory is the max amount of memory that you feel that you can give
Lightwave to render a segment...it is the memory used for zbuffers,
color buffers, etc. etc. when Lightwave renders a scene. By default, it's
set to a reasonably small amount (so that a 640 x 480 frame will render
in 4 segments). If you have extra memory, you can give LW more to use
for a segment, and thus use fewer, larger segments...the ideal is to render
in 1 segment, if possible.

In some cases, having 1 instead of 4 segments gives you a little extra
nudge in how Lightwave ends up having to sort polygons for a render...it
can be a little more optimal when working in one segment. The biggest
performance gain occurs when LW is doing motion blur. If you have 4
segments, then for each of those segments, LW will have to move each
and every polygon to its proper place anywhere between 9 and 34 times
per segment. If you multiply that by 4 segments, you can end up with
a lot of extraneous moves and re-moves of objects. If instead you have
one segment, then you can save a lot of time. This is especially true
for scenes that have some form of displacement (bones, displacement maps,
plugins, etc.)


Comments by Ernie Wright (ex Newtek)

Q. as far as I understand it, the segment memory is only a section in memory where LW store the pixels of the final render.

Ernie: It's more of a work area where LW stores lots of per-pixel information
about the image while it's rendering. The final RGB isn't stored there.

Q. Each segment is dumped to a temporary file and then "stitched together" before it's saved as a whole image.

Ernie: Nope. When LW is finished with a segment, the final RGB values are
written in a different area of memory (during the "Integrating pixels"
step), and the data in segment memory is overwritten during rendering of
the next segment. Segments aren't written in files.

Hundreds of years ago, LW *did* store each segment in the *output* file
(not a temp file) as it was rendered. This is how it was possible to
render print res images on Amigas with only 8 megs of RAM.

LW will never allocate more segment memory than it needs to render in
one segment, and for 720 x 480, that's 8.3 MB.

Q. segment memory also has to do with plugins since they seem to use it
also?

Ernie: Nope.

Q. at least I think wavefilter does. I seem to recall a friend saying he would get errors when using it saying he had to increase segment memory?

Ernie: Wavefilter needs access to the Z buffer, and for that LW has required
that you render in one segment.

Q. Segment memory in LW is the Z-buffer for the frames?

Ernie: The Z-buffer uses only 4 of the 24 bytes per pixel in segment memory.
There are also luminous, diffuse, specular, transparency and reflection
buffers, a "geometry" buffer (roughly the angle to the camera of the
closest surface at a given pixel), shading and shadow buffers, and a few
others.

Q. So if I only allocate 2 megs of memory, LW only will took 2 megs of
RAM to render the frame?

Ernie: No. It will only use 2 megs of *segment memory*. It will still need
width * height * 4 bytes for the final image, plus whatever memory it
needs to store the scene, objects, image maps, shadow maps and so on.

Q.If I have to render a really big frame, say 2560x2048, medium
antialiasing, D2 (NTSC) , NTSC Widescreen, how much memory do I have
to give to LW to render it.......... 126 Megs????

Ernie: As much or as little as you like. In order to render in *one segment*
you do need to let it allocate 126 MB, and LW will use additional memory
for the other things.

The AA settings and the frame and pixel aspect have almost no effect on
the amount of memory LW uses, BTW.

Q. The manual explains that we can calculate the amount of memory by
multiplying wide x height x 24 and that's the amount needed by LW to
render that frame in one segment.....Is that exactly correct?

Yes.

Q. will this decraise my render time?

Maybe, maybe not. If a large value for segment memory causes Windows to
disk swap, it will substantially *increase* render times.

Q. However, I remember it recommending somewhere around 8MB. Why?

No good reason. That's just roughly the amount that will allow you to
render video size images in one segment.

Q. I have 128MB RAM... couldn't I safely go to, say 100MB

LW will never allocate more than it needs for one segment. You can set
segment memory to 100 MB, but if you're rendering video size frames, LW
will only use 8 or 9 MB.

On the other hand, if you're rendering a really big image, you may not
want that much memory going to the segment buffer. LW uses memory for
lots of other things too, and if you use up your RAM on the segment
buffer, there won't be enough for the other stuff.

Q. and speed up rendering a lot?

Not a lot. Sometimes not at all. If you end up hitting the disk, you
lose. Even if you don't swap, some scenes will actually render slightly
faster with multiple segments.

Q. Also, as far as AA, there is an option to AA the whole image instead
of corners and "jagged lines" it detects. Is there a significant plus
to turning this on?

You may render somewhat slower, but if your scene contains a lot of fine
detail, the AA will improve.

AA settings are a good place to look when optimizing render times, much
better than the segment memory setting, which will either have no effect
or a bad effect (when segment memory is too large). You can often set
the AA sampling threshold much higher than the default and still get
acceptable results, and this can speed you up significantly.

Beamtracer
09-22-2003, 06:18 AM
This may seem like a stupid question, but why do we need to manually set the Segment Memory anyway?

OS X dynamically allocates RAM to each application. It seems strange that RAM usage in Lightwave is not set automatically (or dynamically keeps updating itself) rather than having to set this thing in the Camera panel (of all places!)

drclare
09-22-2003, 07:12 AM
Yeha, it is strange. Thanks for the info Julian, although, it seems very complicated, and apparently there is no steadfast rule. In that conversation it was said that Lightwave only needs about 9 Mb to render a 720 by 480 image in one segment, but when i leave it at 8 it renders that size in 2 segments, and i needed to switch it to 14 before it would render in 1 segement. Also, the first image i tried with the different segment memory setting had motion blur, and still rendered slower when using one segment, although the object that was being blurred was in the lower portion of the frame so wouldn't have affected the first segment before. Man, what a confusing topic! Thanks for the comments though. I guess my recommendation now would be to just leave it alone.

Julian Johnson
09-22-2003, 07:35 AM
Hi drclare - well, one thing to bear in mind is that the memory requirements changed when 7.x was introduced and these snippets date back to 1998/9. The basic principles of how Segment Memory works are the same, but the physical amounts have changed slightly...I think this is detailed in the manuals somewhere.

Julian