Latest  | Search | Go
Edit this page   |   Attach file 

  Home | Tutorials | Technical Reference | Runtime | API Documentation | StaticShadowMapping  

Static Shadow Mapping

Tutorial Author:Clifton Poli

Summary

As an alternative to baked PRT, it is possible to use static shadow maps generated through 3rd party tools/programs. For this tutorial I will be using 3ds max 7 to demonstrate. Throughout the rest of the tutorial I will refer to static shadow maps as SSM for short.

Pros/Cons

Compared to baked PRT

  • Pros

    • Ability to render any size texture.
    • Ability to repair parts of the texture in that you can render it out in sections and put it together in PS rather than having to regenerate an entire SSM for minor changes.
    • Not limited to low frequency shadows.
    • Pretty much the only way to do decent indoor static shadows.
    • Works well with normal maps.
    • Works well with LOD and instancing systems.
    • Very fast ingame rendering

  • Cons

    • Lack of WYSIWYG
    • Cumbersome workflow

Format

The preferred format for SSMs and SDSs is L8 DDS format(8 bit/greyscale).

  • SSMtutpic1.png:
    SSMtutpic1.png

Workflow

1. Export geometry/prefabs from RB, import into 3ds max.

2. Use the Unwrap UVW modifier to Unwrap the 2nd channel uvs as necessary. No overlapping, no tiling, no mirroring, 0 to 1 ratio only.

3. Set up your lights and render settings. Max's skylight actor tends to give pretty good results and is similar to PRT so is a good choice if you are using a mixture of techniques. Other light types and rendering methods offer more control though.

4. Before rendering I recommened loading the unwrap uvw modifier again and saving out the first and second channel uv cordinates to file. Then load the 2nd channel uvs into the first channel becuase the render to texture dialog only renders the first channel. (max 7 bug, you dont need to do this in max8)

  • SSMtutpic3.png:
    SSMtutpic3.png

5. Go to the render to texture dialog (with the object you want to bake selected) click the 'add' button and select shadow map. Check use existing uvs, and render to file only. Note that since we only need greyscale shadows there is no need for any materials (other than opacity maps).

6. Now load the first channel uv file back unto the model, then export the unwrapped prefab/s, merge back into the scene in RB, apply whichever LightMap.fx shaders you prefer and put your SSM.dds texture in the lightmap slot.

Static Drop Shadows

If you want to have static drop shadows that have the same qualites as static shadow maps, then you can use the L8DropShadow.fx shader. The workflow is pretty much the same except that your generating the 'cast' shadows on a seperate unique plane prefab or something similar. The only difference with your texture however is that you will need to invert it to get a correct display of the shadows in RB. This is an example of the shader in use, basically in the picture you have the ground prefabs of grass, and then just above that you have a plane mesh that has the L8DropShadow.fx material applied:

  • SSMtutpic4.png:
    SSMtutpic4.png

  • SSMtutpic2.jpg:
    SSMtutpic2.jpg

Indoor SSM Workflow

1. Set up all of the lights/lighting in your map in RB. Once you are 100% finished with that it is time to start making the shadows to match that lighting.

2. Export all unique geometry/prefabs that you want to have unique static shadow maps on from your RB scene in 3ds max.

3. Use the Unwrap UVW modifier to Unwrap the 2nd channel uvs as necessary. No overlapping, no tiling, no mirroring, 0 to 1 ratio only. I recommend grouping together areas/sections and/or multiple prefabs in your scene and unwraping their 2nd channel uvs and packing them together so as to reduce the total number of shadow maps, which should improve fps and reduce rendering times.

4. Set up your lights and render settings. Since we are only concerned with shadows, that should be your focus, is to achieve the most accurate looking shadows that matches your lighting setup in RB. There is many different types of lights and rendering options available to you, so it is wise to experiment to find which setups you like best, and fits your art style best. One good all around option is advanced ray traced shadows, which is rendered through the default scanline renderer and with any of the light types. The nice thing about this option is that it can do transparency, can easily do soft looking shadows, and has fast rendering times.

5. Once you have gotten the look you want with your lighting setup in max, it is now time to render to texture. So select your first object group and open up the render to texture dialog.

6. Click the 'add' button and select shadow map. Check use existing uvs (2nd channel), and render to file only. Note that since we only need greyscale shadows there is no need for any materials (other than opacity maps).

7. Once you have finalized the shadow maps, you can then detach your groups into their original object setup. Export the unwrapped prefab/s, merge back into the scene in RB, apply whichever LightMap.fx shaders you prefer and put your SSM.dds texture in the lightmap slot.

Example pictures:

  • max viewport:
    indoorssmexample1.png

  • max render:
    max render

  • shadowmap textures:
    shadowmap textures

  • RE screenshot 1:
    RE screenshot 1

  • RE screenshot 2:
    RE screenshot 2

Attachment sort Action Size Date Who Comment
SSMtutpic1.png manage 361.6 K 14 Jul 2005 - 03:54 Main.guest  
SSMtutpic2.jpg manage 196.3 K 14 Jul 2005 - 04:23 Main.guest  
SSMtutpic3.png manage 4.3 K 21 Jul 2005 - 00:09 Main.guest  
SSMtutpic4.png manage 668.8 K 03 Dec 2005 - 19:06 Main.guest  
indoorssmexample1.png manage 91.2 K 13 Jan 2006 - 06:01 Main.guest max viewport
indoorssmexample2.png manage 83.7 K 13 Jan 2006 - 06:03 Main.guest max render
indoorssmexample3.png manage 55.6 K 13 Jan 2006 - 06:07 Main.guest shadowmap textures
indoorssmexample4.png manage 163.3 K 13 Jan 2006 - 19:51 Main.guest RE screenshot 1
indoorssmexample5.png manage 174.2 K 13 Jan 2006 - 19:51 Main.guest RE screenshot 2

StaticShadowMapping   Edit | Attach | Ref-By | Printable | Diffs | r1.7 | > | r1.6 | > | r1.5 | More