A PHP Error was encountered

Severity: Notice

Message: Only variable references should be returned by reference

Filename: core/Common.php

Line Number: 257

[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 1056: Cannot modify header information - headers already sent by (output started at /home/type3/type3studios.com/civilization/system/core/Exceptions.php:185)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 1056: Cannot modify header information - headers already sent by (output started at /home/type3/type3studios.com/civilization/system/core/Exceptions.php:185)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 1056: Cannot modify header information - headers already sent by (output started at /home/type3/type3studios.com/civilization/system/core/Exceptions.php:185)
[phpBB Debug] PHP Warning: in file /home/type3/type3studios.com/civilization/system/libraries/Session.php on line 675: Cannot modify header information - headers already sent by (output started at /home/type3/type3studios.com/civilization/system/core/Exceptions.php:185)
[phpBB Debug] PHP Warning: in file /home/type3/type3studios.com/civilization/application/core/Base_Controller.php on line 53: session_start(): Cannot send session cookie - headers already sent by (output started at /home/type3/type3studios.com/civilization/system/core/Exceptions.php:185)
[phpBB Debug] PHP Warning: in file /home/type3/type3studios.com/civilization/application/core/Base_Controller.php on line 53: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/type3/type3studios.com/civilization/system/core/Exceptions.php:185)
Type 3 Studios, LLC - Games. Yay.
Articles  •  Projects  •  Downloads

Better Static Prop Shadows

Posted by vecima (more from this author)
Friday, February 26, 2010 - 7:41 pm (EST)
view larger subscribe

Compiling a map with regularly configured VRAD can cause some problems.  This guide should help you avoid some of them.

 

One problem is unpleasant shadow blobs when it calculates shadows for complex prop_static entities.  A workaround is to change your complex props to prop_dynamic, but this makes your props more expensive from a performance standpoint.  A better solution is to setup hammer to compile your map with some advanced options.

Crap Shadows

Another problem is that some props have shadows that are solid blocks when part of the prop should be see-through.  A Perfect example is a fence model, where the chain link area is made up of one or few polygons with a partially transparent texture.  You can see through the model, but the "light" can't.

Crap Shadows

Well, that just plain sucks, doesn't it?  Let's fix it!  First we're going to fix the blob shadows problem.

Blob Shadows

Bring up the "Run Map" window by pressing F9 or going to File->Run Map... then Click the "Expert..." button.

Normal Compile window

This will bring up the "Run Map [Advanced]" window.

Expert compile window

Next to the "Configurations" drop-down list click the "Edit" button.

This will bring up the "Run Map Configurations" window.

Compile configs window

Click "New" and type a name for the new configuration.  For this example, I've used

LDR / HDR (static prop polys)

close the configurations window, and use the drop down list to pick your new configuration.

Next, under "Compile/run commands:" click the "New" button.

We need to tell the compiler what we want it to do with our map.  In this case, we want the comiler to run these programs on our map:

  1. VBSP
  2. VVIS
  3. VRAD (LDR with special parameters)
  4. VRAD (HDR with special parameters)
  5. Copy the map
  1. We will setup the BSP process.  Click the "New" button.  This will create an empty process.  We need to fill in a command, and some parameters. Next to the text box that's labeled "Command:" click the "Cmds" button, and pick "BSP program". That will put "$bsp_exe" in the text box. Next copy this and paste it in the "Parameters" box:

    -game $gamedir $path\$file

  2. We will setup the VIS process.
    It's done similar to the BSP was.  Click the "New" button again for another process.
    Click the "Cmds" button again, and pick "VIS program".
    That will put "$vis_exe" in the box.
    Then copy this and paste it in the "Parameters" box:

    -game $gamedir $path\$file

  3. We will setup the RAD process (for LDR).
    Click "New".
    Click "Cmds" and pick "LIGHT program" ($light_exe will show up in the box).
    Copy this and paste it in the "Parameters" box:

    -ldr -StaticPropLighting -StaticPropPolys -TextureShadows -game $gamedir $path\$file

  4. We will setup the RAD process (for HDR).
    Click "New".
    Click "Cmds" and pick "LIGHT program" ($light_exe will show up in the box).
    Copy this and paste it in the "Parameters" box:

    -hdr -StaticPropLighting -StaticPropPolys -TextureShadows -game $gamedir $path\$file

  5. We will setup the copy map process.
    Click "New".
    Click "Cmds" and pick "Copy File".
    Copy this and paste it in the "Parameters" box:

    $path\$file.bsp $bspdir\$file.bsp

When that is all said and done, your compile window should look like this:

Expert compile window

notes:

  1. Make sure you have the commands in the right order (as shown).  You can use the "Move Up" and "Move Down" buttons if you need to adjust the order.
  2. It's worth noting that with this compile configuration, you can choose to compile only LDR or HDR lighting simply by unchecking the other option.
  3. At the time of writing this tutorial, the "-both" option doesn't work for some people, with VRAD crashing before finishing the second compile.  This is another reason why I've chosen to set it up with LDR and HDR lighting seperate.

Transparent shadows.

This fix is a little bit more complex than the fix for the blob shadows.  We need to add a lights file.  This tells the VRAD process some special things to do when compiling your map.  The easiest way to do this is tomake a WHATEVER.rad file in wordpad.  If mapping for a game, make sure you put the WHATEVER.rad file in the same place as the GameInfo.txt for that game.  If you're making a mod, you can put the WHATEVER.rad file in Steam/SteamApps/SourceMods/MODNAME/ (along with your mod's GameInfo.txt).

In our example we've used the model:

models/props_wasteland/exterior_fence001b.mdl

so we need to tell our WHATEVER.rad file that this prop needs to be compiled with texture shadows, meaning the alpha channel of the texture will be used to calculate the shadows from this model.

Open up the WHATEVER.rad file and put this in it:

forcetextureshadow props_wasteland/exterior_fence001b.mdl

notice that we didn't put the "models/" part of the path in the file.  It looks in "models/" by default, so we only need to put the rest of the path to the model.  You'll need to do this for every model that you use that you want to achieve this effect.

In hammer, be sure to compile with the "-TextureShadows" option on VRAD.  Lucky for you, If you've followed the tutorial, you already did this in the part above! :P

As far as I can tell, the transparent textures fix requires the blob shadows fix, so this whole tutorial should be followed.

you also need to compile with the "-lights" option.  It should look like this:

-ldr -lights WHATEVER.rad -StaticPropLighting -StaticPropPolys -TextureShadows -game $gamedir $path\$file -hdr -lights WHATEVER.rad -StaticPropLighting -StaticPropPolys -TextureShadows -game $gamedir $path\$file

Now all that's left is to compile the map and check out the results.

Good Shadows 1

Good Shadows 2

Pretty good, huh?  In these pictures my ambient light is set pretty high, and the Lightmap scale on the road is at 4, so if you want to be able to see every detail of the fence, turn the lightmap scale down to 2, and play around with your light settings.

I hope this has helped people who run into these shadow problems.  Your map will look much better with more realistic shadows.  It may bring up your compile time, and file size if used excessively, but in most cases I'd say it's worth the trade-off.

If you need any help leave a comment below or contact us on the forums!

categories: tutorial, source engine, lighting, shadows, configuration, static, prop, compile

view larger subscribe
avatar

Posted Friday, February 26, 2010 - 7:41 pm (EST) by vecima (more from this author)

I'm a web developer by trade, and a game developer by hobby. If I'm really lucky one day I may be able to switch the two! ;) I founded Type 3 Studios a bunch of years ago in the hopes of doing just that. I'm interested in gaming, game development, and the communities and industry surrounding computer and video games. I'm also really into music. Long live metal \m/

<< back to articles

Comments

You must login to post comments.

<< back to articles

login

Choose an account to sign in

Civilization

Type 3 Forums

Steam

version 2.0.0 © 2006 - 2019 Type 3 Studios, LLC.