Advanced compile (random HDR bug)

Discussion in 'Mapping Questions & Discussion' started by Open Blade, Aug 7, 2009.

  1. Open Blade

    Open Blade L7: Fancy Member

    Messages:
    439
    Positive Ratings:
    34
    I've noticed that when I use the advanced compile options in Hammer, that here and there VVIS only runs twice (HDR) only sometimes. I've done this now about 10 times and there is no rhyme or reason to it. Just sometimes VVIS will run twice and sometimes it doesn't. That kinda sucks, especially if you are running the final compile (slow) and it doesn't run twice, then you have to do it again so you have HDR. Why does Hammer do this?
     
  2. TracerDX

    TracerDX L3: Member

    Messages:
    127
    Positive Ratings:
    25
    You mean, VRAD, right? VVIS is supposed to only run once and has nothing to do with HDR. So I'm going to assume s/VVIS/VRAD/i. Honest mistake. :)

    Don't use the -both flag. There is a known issue with it. http://developer.valvesoftware.com/wiki/VRAD_HDR_Crash_Fix

    I actually added that entry, then Valve updated "Basic" mode to match a month later :p However, the update won't "fix" existing advanced mode settings, since they are usually customized by the mapper. You'll have to do what that article says to make it work right.
     
  3. Open Blade

    Open Blade L7: Fancy Member

    Messages:
    439
    Positive Ratings:
    34
    Thanks. Although Hammer was not crashing on me, it just wouldn't run VRAD twice. But I will follow the instructions. Although it doesn't mention if you have to use the same switches in both ldr and hdr. For example, if I want to include both staticproppolys -staticproplighting in my compile, would I need to have those entered into both ldr and hdr?

    so my entries would look like this:

    -ldr -staticproppolys -staticproplighting -final -game $gamedir $path\$file
    -hdr -staticproppolys -staticproplighting -final -game $gamedir $path\$file

    sound right?


    Splitting the LDR and HDR passes in vrad.exe execution seems to prevent this crash from occurring. This is as simple as defining 2 vrad commands that each use the "-ldr" and "-hdr" switches instead of just one using the "-both" switch in Hammer's compile configuration. The following will detail what you can do in Hammer to achieve this.

    Credit to Xanthi of the Steam User's forum for bringing this fix to light.
    Setting up Hammer

    1. Open up the Run Map dialog (File -> Run... or F9) in Hammer.
    2. If not already in "Expert Mode", click the "Expert" button in the bottom left of the dialog.
    3. Select "HDR Full Compile" from the Configuration pull-down.

    Note: In this example, we are editing the existing "HDR Full Compile" configuration to apply the fix. The following steps can be used for the "HDR Full Compile -final (Slow)" configuration by maintaining the -final switch in the Parameters box.

    4. Select the 3rd item down, it should say "$light_exe -both -game $gamedir..."
    5. In the text box labeled "Parameters", along the right of the dialog, change the switch "-both" to "-ldr". It should now read "-ldr -game $gamedir $path\$file"
    6. Click the "New" button to create a new command in the configuration and select the new blank command at the bottom of the list.
    7. Press the "Move up" button twice to move the new command to right under the command you just edited.
    8. Enter into the text box labeled "Command": $light_exe or use the "Cmd" button to the right and select the "LIGHT Program" option for the drop-down menu.
    9. Into the Parameters text box enter: "-hdr -game $gamedir $path\$file"

    You now have a fixed HDR compile configuration in Hammer. You must use this configuration in "Expert" mode. "Normal" mode will still use the -both flag for HDR compiles
     
    Last edited: Aug 8, 2009
  4. TracerDX

    TracerDX L3: Member

    Messages:
    127
    Positive Ratings:
    25
    Yes, and its vrad that crashes without error, not hammer. Remember, when you compile you are running your text based *.vmf, crafted in Hammer, through programs (vbsp, vvis & vrad) to result in a binary *.bsp. When you compile, you are actually executing other programs, hammer just receives the text output and does its feeble job of displaying it in a window that fails to refresh when it loses focus.

    The -both flag is supposed to make vrad run twice on the same execution, once for LDR and then HDR, but for some reason, it sometimes just doesn't do the HDR pass.

    By manually forcing vrad to be executed twice, and explicitly telling it -ldr and -hdr you are circumventing this bug.

    And yes, you will need -staticproppolys, etc in both vrad commands. So those should work fine.
     
  5. Open Blade

    Open Blade L7: Fancy Member

    Messages:
    439
    Positive Ratings:
    34
    yes, it worked perfectly. Thanks much.