
Reverse engineering the rendering of The Witcher 3 (2018) - adamnemecek
https://astralcode.blogspot.com/2018/11/reverse-engineering-rendering-of.html
======
rebuilder
As a movie compositor, I'm surprised to see so much compositing being done in
sRGB space ("gamma space"). I'm used to doing all operations in linear space
and only converting to sRGB for display purposes. Here, they seem to employ
tricks to work around the issues of non-linear compositing, like making an
exclusion mask of the brighter pixels so vignetting doesn't look bad.

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.

~~~
fxtentacle
Memory bandwidth.

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.

~~~
himinlomax
There was the problem of that SGI patent that prevented using floats for
framebuffers ... floats make a lot more sense rather than using this gamma
nonsense.

~~~
ansgri
AFAIK in HDR photography they often use linear uint16. I understand that it
could be not enough for strong highlight modeling, but for general purpose
compositing that should be ok. With an additional layer with like +8 bits of
highlight resolution.

------
redisman
Is the lighting model of vegetation and trees mentioned in any of the
chapters? The sunset lighting up the edges of decals was really what sold me,
that and just the stylized graphics - not trying to jump into the uncanny
valley. To me it's the best looking environments in a game I have seen.

------
m3kw9
This is some crazy sht, I’m surprised the expertise people have and to be able
to do this

~~~
shmerl
That's impressive indeed. I'm even more impressed at developers of DXVK, who
implemented the whole translation of D3D11 into Vulkan, including for shaders
(enabling playing TW3 on Linux).

~~~
dan00
The dolphin (Nintendo GameCube emulator) developers have written[1] (nice
read!) an interpreter of the GameCube shader code inside of the host graphics
card shader.

[1] [https://dolphin-emu.org/blog/2017/07/30/ubershaders/](https://dolphin-
emu.org/blog/2017/07/30/ubershaders/)

~~~
shmerl
That's a very cool idea indeed!

------
corysama
If you like this, you'll also like the "Graphics Study" articles of
[https://www.adriancourreges.com/blog/](https://www.adriancourreges.com/blog/)

~~~
fxtentacle
Thank you for sharing this :)

------
pengaru
Neat writeup, I haven't played the game but was surprised to see so much
aliasing around objects in his screenshots considering everything was on "max
settings". Does TW3 predate ubiquitous use of MSAA or FXAA techniques?

~~~
badsectoracula
IIRC it doesn't use MSAA (to do MSAA on a deferred renderer you need to take
it into account in your pixel shaders, which in practice means that basically
nobody does it) but it does have post-processing antialiasing (including,
IIRC, FXAA and TAA).

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.

~~~
account42
> to do MSAA on a deferred renderer you need to take it into account in your
> pixel shaders, which in practice means that basically nobody does it

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.

------
warpech
NoClip has a nice documentary series on YT about making of The Witcher 3:
[https://www.youtube.com/watch?v=hWDaiox6QqE&list=PL-
THgg8Qnv...](https://www.youtube.com/watch?v=hWDaiox6QqE&list=PL-
THgg8QnvU6WuPJmh19U8cAFjzXHCgvk)

------
nhggfu
amazing work OP.

------
HugoDaniel
blogspot!

