Source Filmmaker

Source Filmmaker

546 ratings
Volumetric colour banding fix
3
   
Award
Favorite
Favorited
Unfavorite
Universe: Original IP
Material
Tags: SFM
File Size
Posted
Updated
68.394 KB
Apr 10, 2018 @ 5:25am
Apr 10, 2018 @ 5:59am
2 Change Notes ( view )

Subscribe to download
Volumetric colour banding fix

Description
This is a fairly basic (but nonetheless reasonably effective) fix for colour banding in SFM, most often noticable in the haze of volumetric lights.
Without going into too much detail, this banding is caused by Source using simplistic rounding when converting from its internal HDR format into the 8 bits per colour formats used by most picture formats and many screens.

Although one way to fix this is by exporting using HDR-compatible PFM image sequences, not everyone wants to (or can) mess around with HDR formats all the time, so a post on Reddit got me thinking about the possibility of more user friendly solutions.

And this is what I've come up with. This uses SFM's overlay materials to add in a specially designed noise layer before SFM converts to 8 bits per colour - this stops SFM rounding off the pixel colours into solid bands, and gives a dithering effect that results in a gradient perceptually closer to the colours SFM originally calculated.

Of course, this does add a pinch of grain to the image, but the effect generally looks much more natural than colour banding, and it's a necessary compromise within the limits of 8 bit-per-channel colour.

Using this fix
This fix is applied as an overlay material effect (and therefore will not work in poster mode - see below).
If you need a guide on the basics of applying and adjusting overlay materials, it is covered in the official Valve tutorials, starting here.

There are several variants of this material, optimised for different export resolutions. Use the material that matches the resolution you're using - I've given you a choice of 360p, 480p*, 540p, 720p, 1080p, 1440p and 2160p (4K).
If there's any common or semi-common video resolutions that I've forgotten, feel free to ask and I can add that in**.
* Note that because of the unusual aspect ratio SFM uses as its default 480p setting, the effect may be less than ideal if you use the default 720x480 resolution. These materials are all optimised for SFM's normal 16:9 aspect ratio.
** Unless it's a potato or toaster resolution. If you're exporting at 144p or 240p, you deserve all you get.


After applying the material, you will need to adjust the alpha/transparency of the overlay to taste. (Again, doing this is covered in the official Valve guides).
A scene with moderate colour banding will probably work well with an overlay transparency of about 10-20% (or a value of 25 to 50, depending whether your colour picker is in integer or percentage mode), but scenes with heavier banding may require higher settings. Note that the higher the value, the more noise may be visible, particularly in very dark shadows.

(Note: To copy in some feedback, a user has noted that if your video software has decent colour correction, darkening the shadow regions will reduce the "static" this overlay can cause in the blackest areas. It may be possible that SFM's internal colour correction can be used for the job, but I've not tried this yet).

Although this fix is primarily made for colour bands in volumetrics and smoke particles, it should also stop SFM calculating bands around the edges of shadows as well.
(It can't do much about low quality textures that have banding in the actual file though - sorry!).

Image/Video compression
Because noise does not compress efficiently, using this overlay will increase the file-size needed for the same final image/video quality. For this reason, I recommend that you only use this layer over shots that have visible colour banding, such as dark scenes with volumetric lights.

This is however a (deliberately) non-animated overlay, which means the noise is constant from frame to frame, which should make it compress somewhat more efficiently in a decent video format.

Poster exports
This will NOT work for poster exports, because overlay materials don't work in this mode.
(Summarising a lot, because posters are rendered as several tiles, SFM can't apply post-processing effects to the individual tiles without causing seams between the tiles, and it can't apply them to the final image because the final image no longer contains the original HDR data).

Please don't waste your time (or mine) by posting comments telling me it doesn't work if you're trying to use posters; I know, but I can't do anything about it.

If you want to export a high resolution still, you will instead need to use an image or image sequence export with SFM running with either the 1080p or 4K launch option:
https://developer.valvesoftware.com/wiki/SFM/Rendering_at_1080p
https://developer.valvesoftware.com/wiki/SFM/Rendering_at_4K
(This is advisable anyway - poster exports don't render effects like bloom, often have problems with particles or flexes resetting, and sometimes even have seams between tiles).

How you can help me (and others)
I wouldn't normally ask (I think items should succeed on their own merits), but if you've found this useful, please remember to rate and favourite it - this isn't the kind of thing users will naturally know to search for, so it will be able to help more people in future if it can get to a decent position on the all time "popular" lists.

Includes:
MarcoSkoll\Volumetric Fix\360p.vmt
MarcoSkoll\Volumetric Fix\480p.vmt
MarcoSkoll\Volumetric Fix\540p.vmt
MarcoSkoll\Volumetric Fix\720p.vmt
MarcoSkoll\Volumetric Fix\1080p.vmt
MarcoSkoll\Volumetric Fix\1440p.vmt
MarcoSkoll\Volumetric Fix\2160p.vmt


Additional keyword: Color, for people who spell it without a U.

Posting spam chain messages in the comments will result in a summary deletion and ban from commenting on any of my items, and I won't be accepting appeals. Given that I'm planning some complex items (e.g. bokeh gobos) you might actually want to ask questions about using, do yourself the favour and don't get banned.
Popular Discussions View All (1)
2
Sep 10, 2023 @ 4:44am
How to use.
JiingJing
92 Comments
👾 🅼 🅰❎👾 Mar 15 @ 6:31pm 
GENIUS! :brown_bomb::praisesun:
Brad Aug 10, 2023 @ 8:09am 
This fix worked WONDERS. Thank you so much! a transparency value of 59 was the sweet spot for me, with a particularly dark scene at 2160p(4k) with harsh volumetrics. I can't thank you enough for this! <3
Mr. Egg Jul 3, 2023 @ 9:17am 
I have never in my life heard of comment banning :sotxbones:
JiingJing Jun 15, 2023 @ 2:34am 
Thanks!
RaiSokudo Mar 24, 2023 @ 3:22pm 
it might be perfectly normal if you can't see the difference

i could be wrong but you may have to be a "tetrachromat" to see the difference

which is rare, especially for men




...which means i'm special, ah kee kee kee
Marco Skoll  [author] Dec 6, 2022 @ 4:16pm 
@TNT_NINJASHARK If you genuinely cannot see a difference in the image, your screen may require calibration or have a low luminance.

As is, I actually boosted the contrast in the example image to make it clearer, and yet many people still see the problem at its normal contrast level.
tactical_grilledcheese Dec 6, 2022 @ 3:52pm 
Bro is it just me because i can't tell the differance on the picture
steeledgator May 27, 2022 @ 9:16pm 
Beautiful effect for the volumetric lights, but it adds a lot of grain (I read the entirety of the description before, but I haven't now when I"m using it, so I may be using it wrong), alpha adjustments help though.
{4D$KNЙ}_[DR].4.CH[i]LL(a) Oct 26, 2021 @ 2:47pm 
Why, when I turn on the volumetric light, is it missing in the rendered image? I can’t do the effect of the "stream of light" type now
de_func Nov 30, 2020 @ 6:59am 
so it's basically the same method used in Titanfall 2?