When Guild Wars 2®: Visions of Eternity™ launches next week on October 28, we’re shipping new shadow technology that will allow us to make some graphical enhancements to the game!
Shadows do a lot to make a game world feel believable beyond just obscuring light. Our mind takes cues from shadows to help understand depth, shape, distance and motion. Without them, a 3D world can look flat or disconnected.
Note: This post dives deep into the technical details—the best kind of details. So, if you’re just here for a look at the before-and-after visuals, scroll to the end, but if you’re curious about lighting and shadow systems, read on!
Shadowy Goals
Since the launch of Guild Wars 2, graphics hardware has advanced, which affords us an opportunity to improve the rendering in the game. One of the areas we targeted was our shadow system. All our improvements have two major goals in mind:
- Cover more of the screen. We’d like to see more distant parts of the world rendered with high-quality dynamic shadows.
- Increased detail. We want to see crisper edges and more details—especially small ones—in our shadows.
At the same time, we want to make sure that players with less powerful systems can still have a smooth experience, so we are limiting ourselves to changing only the medium, high, and ultra settings, leaving the rest unchanged.
Background in Shadows
Our dynamic shadows are created using a technique called cascaded shadow maps. This means we draw a view from the main light multiple times and store the distance from the light to each pixel into an image called a shadow map.
When drawing the main view, we compare the distance of each pixel to the light with the distance from the light in the shadow map. If the pixel is farther away, it is in shadow; otherwise, it has light shining on it. The view from the light is warped when projected onto the main view, so our ability to compare pixel distances is not perfect. The “cascaded” part of “cascaded shadow maps” means that we make multiple shadow maps to cover different places on the screen, reducing the warping of each individual map.
Increased Resolution
The obvious way to increase detail is to simply increase the number of pixels in the shadow maps. Implementing this took some careful refactoring because some other parts of the engine made assumptions about what resolution the shadow maps should be.
We are increasing the shadow map resolution from 512×512 to 1024×1024 on medium settings, and from 1024×1024 to 2048×2048 on high and ultra settings. Once we saw how much better it looked, we recognized the opportunity to improve it even further.
Better Cascade Calculations
Cascade placement and size are very important for getting nice shadows and is one of the biggest changes we’ve made. Our original implementation placed one or two fixed-size circles in the world depending on your graphics settings. This has nice properties like intuitive parameters to tweak how much of the world would be covered by dynamic shadows, and it does a good job of covering the center of the screen, where a player is looking most of the time.
With the addition of flying mounts and more extreme—and awesome—terrain shapes, the algorithm was starting to show some cracks. The new algorithm now covers more of the screen by dynamically changing how much of the world is covered by a shadow map. The move from fixed size in world space to variable size required careful placement and sizing to ensure the shadows stayed stable when the camera moved, but after nailing those details down, a significantly larger portion of the screen can have dynamic shadows.
The images below are a development view showing how much of the screen the old and new algorithms covered with dynamic shadows. Red is the most detailed shadow map that covers less of the world and is closest to the camera. Yellow is less detailed, covers more of the world, and is farther away from the camera. Cyan is the least detailed and covers even more of the world, but it is farthest away from the camera. The dark areas with no color overlay are not covered by a shadow map and so have no dynamic shadows.
Notice how the new algorithm covers more with dynamic shadows, covers the area on the right side that the old algorithm missed, and covers more with the highest-detail shadow map. All these improvements mean we get more detailed shadows that extend farther from the character in the world.
Above: Old shadow map coverage.
Below: New shadow map coverage.
There will soon be two shadow maps on medium or high settings, and three on the ultra setting. This compares to one and two respectively with the old algorithm.
More Sophisticated Sampling
The shadow maps do not correlate evenly to each pixel on the screen. This means there is sample aliasing we must address, so without extra processing the edges of the shadow maps will appear jagged and unpleasant. To mitigate this, we sample shadow map pixels in the neighboring areas and interpolate between them. This smooths out the jagged edges and ensures the outlines of smaller details, such as fine lines, are much more pleasing to look at.
We have improved the sampling technique by using a technique known as Poisson disc sampling to get more out of each sample compared to before, when we sampled using a grid. Additionally these samples are now weighted using a Gaussian distribution to place more emphasis on points closer to the point in the shadow map that is being smoothed. This looks better than if all of the samples were weighted evenly.
Screen Space Shadows
Some details are just too small to be visible in a shadow map—meaning they don’t get shadows even with increased shadow map resolution. We now use a technique called screen space shadows to provide shadows for these details. The depth buffer of the current frame is used to execute a form of ray marching in screen space, which is kind of like ray tracing, but more constrained. This allows us to capture fine details on things like grass, small architectural details, and hero equipment to help them feel less flat.
Since we only have the depth buffer, there are limitations to the technique, and as a result, there are occasional inconsistencies. We worked closely with the art team to fine-tune the parameters to balance quality against visual artifacts. We also provided an option in the graphics settings that allows the feature to be toggled on or off. Screen space shadows are available on high and ultra settings.
Take a look at some more examples of this tech in action in the comparison screenshots below. You can enlarge the images with the button in the corner and if you move the slider all the way to the left you’ll see the new shadows! We hope these improvements enhance your experience while you explore the world of Tyria!














