Optimizing Render Time

From Valve Developer Community
< SFM
Jump to navigation Jump to search
Wikipedia - Letter.png
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
Dead End - Icon.png
This article has no Wikipedia icon links to other VDC articles. Please help improve this article by adding links Wikipedia icon that are relevant to the context within the existing text.
January 2024

Reducing Render Time

Rendering in the SFM can take a while, especially with all the quality settings at maximum, but there are ways to reduce render time while keeping quality high.

Only Render Changed Shots

If you're rendering as image sequence instead of as a movie, then you can render just the shots that have changed since your last render. This can often be the greatest render speed increase you can attain, especially late in a project, when only a few shots are changing at a time. In the Export Movie dialog, change the Duration to Selected Shots to only render the shots you have selected in the timeline.

Tune Progressive Refinement Settings Per Shot

While it's often easiest to set a single set of override progressive refinement settings, you can find yourself rendering everything at a high quality when some shots don't need the extra render samples in motion blur or depth of field. Tuning the samples per shot can save a lot of time, but allow you to keep the high quality settings where needed. To edit those sample counts per shot, open the shot in the Element Viewer, and edit the motionBlurQuality and depthOfFieldQuality attributes on the shot's camera. For both of those attributes, 0 means 8 samples, and every increase by 1 doubles the number of samples. (So 1 means 16 samples, 2 -> 32, 3 -> 64, 4 -> 128, 5 -> 256, 6 -> 512, 7 -> 1024) Note that motionBlurQuality only goes up to 5 (256 samples) but depthOfFieldQuality goes up to 7. (1024 samples)

While a render is progressing, information is written about the render times and settings into a .txt file in the same directory as the output render. Looking at the Frame Time in this file can help you find where most of the time in your render is spent, so you can make choices about where to adjust quality settings. The current quality settings are in the DoF Count annd MBlur Count columns as sample counts.

Turn Off Shadows On Lights That Don't Need Them

Every light that has shadows requires the SFM to render the scene an extra time, so if you have lights that have shadows that aren't needed, you can reduce your render time a bit by disabling shadows on those lights.

Preview Renders

For renders that aren't final, you can significantly reduce render time by turning off progressive refinement and rendering at lower resolution. Note that if you're rendering at a lower resolution, you only get the speed benefit if your movie resolution is the same as the SFM's resolution. So if you render a movie at 720p, but you have -sfm_resolution 1080 on your commandline, your movie won't render as fast as if that commandline option was removed.