Reverse engineering the rendering of The Witcher 3 (2018)
astralcode.blogspot.com
astralcode.blogspot.com
What kinds of tradeoffs go into deciding to composite in sRGB instead of linear in a game engine? I assume there are good reasons to do so.
Typically linear is using 32 bit float while srgb is using 8 bit integers. So going linear needs 4x more data transfer.
There exists 16 bit float, too, but since it became popular with AI, NVIDIA has limited it's performance on gaming cards.
I hope AMD / RADEON and Intel put some competition in that market.
https://www.tweaktown.com/news/70848/amd-big-navi-specs-5120...
This is less about availability and more about market segmentation. Making sure the cheaper product line doesn't eat into a market that is served by a much more expensive product line. This happens everywhere in any industry. And you can see it best in software where a simple license file will make the difference between a fully featured suite and a severely cut down version.
Availability is controlled via another mechanism: setting the price according to market demand. If you're selling so many cards that you miss a percentage of potential sales then the price will increase. And prices did increase.
Does the game described in the article transfer back and forth from RAM in the middle of compositing for some reason? If not, why is it compositing in sRGB space then?
In sRGB, usual operations give weird results instead. Imagine when doing addition (e.g. light a + light b) you get something like
c = a + b # linear result
c = sqrt(a² + b²) # sRGB result (very simplified)
Instead of average (downscale 2 pixels), you get c = a/2 + b/2 # linear result
c = sqrt((a/2)² + (b/2)²) # sRGB result (very simplified)
Maybe I messed up the formulas and used inverse transformations, but the point is, if you operate on sRGB values with the usual +,-,*.. operations, instead of adding/subtracting/averaging/.. the light/colors, you end up applying some functions, that are kind of similar, but not very close.We are kind of used to it when dealing with computer graphics, but this is the reason why antialiased fonts look too thin (or thick, depending on whether it's light or dark), scaled images look darker (or is it lighter? and slightly off-color), and generally the graphics operations in sRGB give disappointing results.
Then someone else replied explaining that such compositing is done due to bandwidth, but I do not understand: after textures are uploaded to VRAM, PCIe bandwidth should be irrelevant. If they are talking about VRAM bandwidth, I would understand if this was for a lot of big textures... but for doing vignette? Is better to be going back and forth to sRGB in each compositing step just to keep the intermediate results smaller due to VRAM bandwidth?
Mixed in with this is MSAA where the resolve is typically done in non-linear space (this is a choice to artificially boost "smoothness", this is an artifact that happens IRL) [0] https://mynameismjp.wordpress.com/2012/10/24/msaa-overview/
However since these are post-processing solutions they can mess up with the frame reverse engineering going in the article and most likely the author simply disabled them.
I think the bigger problem with doing MSAA with deferred rendering is that your G buffer gets even bigger since you now need to store information for each sample.
AllowMSAAAnother setting in the same file, UberSampling=1, could offer a bigger improvement but with an even larger performance hit. The most practical solution, given sufficiently powerful hardware, is probably to enable Dynamic Super Resolution (DSR) via the nVidia Control Panel.
Witcher 3 graphics is quite amazing and can get even better with community-created mods. It might take some tweaking to get there but the result can be like this: https://www.youtube.com/watch?v=28lGfkdkJHI