VRAD Crashes... Lightmap Scale?

Discussion in 'Mapping Questions & Discussion' started by Balls, Feb 18, 2015.

  1. Balls

    Balls L1: Registered

    Messages:
    11
    Positive Ratings:
    1
    Hey,

    I'm having an issue when trying to compile the jump map I am working on. VRAD gets to a point, then starts heavily increasing memory usage up to about 1.6GB, then crashes ("stopped working", not "stopped responding").

    However, if I select all the brushes in the map and change them to lightmap scale 24 (down from 16), then the map will compile. It is a big map, 29k x 29k x 15k approx, and around 3.2k portals. Every part of it compiles okay in cordon, and the compile log cuts off when VRAD crashes, always on "BuildVisLeafs".

    I'm not desperate that all surfaces must have 16 lightmap scale, I am simply concerned that there is something I have done that I could change to avoid this error all together. Could it be:

    • The dimensions of the map?
    • The number of portals?
    • The size of some of the brushes (maybe up to 15k x 10k)
    • All of the above?

    I have done some optimization by ensuring all relevant brushes are func_detail. (Portals down from around 7k to 3.2k). The dimensions of the map can't be reduced, but some of the big brushes could be split up (would this even help?)

    ... Sorry, I realize this turned into a bit of a ramble, I guess I'm more keen to learn what's happening rather than fix it!
     
    • Thanks Thanks x 1
  2. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    All the compile binaries are 32 bit so on very large maps it's not all that hard to go past 2gb of memory allocation. Once you do that.. splat goes the compile.

    If you're building with HDR, one old trick is to do two separate lighting compiles.. one with -ldr and one with -hdr. That can save some memory.

    If that doesn't help your only option is to turn down the lightmap scale until the compile succeeds.
     
    • Thanks Thanks x 2
  3. Balls

    Balls L1: Registered

    Messages:
    11
    Positive Ratings:
    1
    Thanks for your reply!

    That's good to know... in a way, good at least that there is not some massive mistake I've made. I've read about separating -ldr and -hdr... Perhaps I should give that a go now to see if I can compile HDR at lightmap scale 24.

    Thankfully, a lot of the sections where I am likely to want more detailed shadows are smaller brushes, and the larger ones are fairly evenly lit, so I can probably go through and vary the scale brush to brush as required.
     
  4. Vel0city

    aa Vel0city func_fish

    Messages:
    1,931
    Positive Ratings:
    1,540
    Lightmap optimization is as important as general optimization with area portals and hint brushes 'n stuff. Not just for VRAD reasons, but also for map file size.
     
    • Thanks Thanks x 1
  5. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    My MO has been to "select all" and set the scale to 64 on everything. Then turn up the detail in spots where I need it.
     
  6. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,535
    On a jump map, I'm going to assume you have many very large surfaces that are smoothly lit and you could probably get away with 128 lightmaps on them. That would drastically reduce the number of luxels vrad needs to handle. Don't try to do 24 on everything, adjust them as needed.
     
  7. Balls

    Balls L1: Registered

    Messages:
    11
    Positive Ratings:
    1
    Thanks for the tips, I will indeed take some time to try and optimize it well... However my initial concern was getting it to compile at all - you know, so I could be motivated to finish it!

    I have a further question. It was mentioned about splitting the compile into LDR and HDR modes. How can I do this? I have read the WIKI and the impression I got from there is that this might be being done automatically for TF2. When I try to set it up as described on the wiki (advanced compile settings, one with -ldr one with -hdr, VRAD does not run and instead shows a list of possible commands which does not include either of those (only -both).
     
  8. Balls

    Balls L1: Registered

    Messages:
    11
    Positive Ratings:
    1
    With regard to the further issue I was having, I have successfully compiled HDR without my lights file... which means I must have been using a bad string of parameters. Whoops! Research time.
     
  9. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,219
    Just uncheck the HDR thing on the regular compile dialog, and then when that's finished, run it again and tell it to run nothing but VRAD, in HDR only.
     
  10. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    You can also add steps to the Hammer compile dialog. I don't know if there's a tutorial floating around but it's not hard to figure out if you just mess around with the buttons.

    https://developer.valvesoftware.com/wiki/Hammer_Run_Map_Expert

    All you have to do is add a second $light_exe compile step. Give one the -ldr option, give the other the -hdr option. Then if you want to do both light compiles check both boxes. If you want a faster compile, uncheck the hdr one. Or whatever.

    I also have an extra $vis_exe line to do a -fast vis step. I just find it easier to click checkboxes than mess with the dropdown menu.

    Just keep in mind if you start customizing the compile options to save a copy of CmdSeq.wc somewhere, it gets saved in the same directory as Hammer.exe (common/Team Fortress 2/bin). TF2 updates or cache verifications like to overwrite that file which blows away all your customizations. So keep a copy safe somewhere just to avoid redoing things later.
     
  11. Balls

    Balls L1: Registered

    Messages:
    11
    Positive Ratings:
    1
    Thanks for all the help so far. I have managed to compile HDR now with my own lights file. I had already followed a tutorial to set up two RAD steps using the expert compiler (and I agree about checkboxes, I have already done exactly as you describe for the "-fast" settings).

    The further problem I was having is that I was able to compile in HDR so long as I didn't specify a custom lights file to be used. I got it working by specifying -lights before any other flag. So before, my flags were:

    -hdr -lights mylights.rad -game

    Which failed (VRAD never run, just brought up info showing how to use it), but changing it to:

    -lights mylights.rad -hdr -game

    Worked fine. I suspect in the first one it was trying to consider "mylights.rad" a flag rather than the parameters for -lights.