cinera_handmade.network/cmuratori/hero/code/code094.hmml

59 lines
3.8 KiB
Plaintext

[video output=day094 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Converting sRGB to Light-linear Space" vod_platform=youtube id=GKVMOmEGVoQ annotator=dspecht annotator=Miblo]
[1:07][Recap last week's work on the renderer]
[1:38][Won Chun's request: Correct gamma correction]
[4:08][Chart: Gamma curve of Casey's monitor]
[6:32][Blackboard: Gamma]
[8:38][Blackboard: Why does Won care?]
[12:21][Blackboard: We'd need to undo or, rather, account for the effects of the monitor's gamma curve]
[15:36][Blackboard: How do we do it in a software rasteriser?]
[16:07][Internet: sRGB definition[ref
site="Wikipedia"
page="sRGB"
url="http://en.wikipedia.org/wiki/SRGB"]]
[17:36][Internet: Gamma correction[ref
site="Wikipedia"
page="Gamma correction"
url="http://en.wikipedia.org/wiki/Gamma_correction"]]
[18:23][Internet: Filmic Games: 'Linear-Space Lighting (i.e. Gamma)' by John Hable[ref
site="Filmic Games"
page="Linear-Space Lighting (i.e. Gamma)"
url="http://filmicgames.com/archives/299"]]
[20:15][Blackboard: What the gamma curve is generally expected to be]
[22:16][Blackboard: Computing that gamma curve]
[23:32][Blackboard: Envisioning the Framebuffer pipeline]
[26:04][Blackboard: Caring about bandwidth]
[28:34][Internet: 'Uncharted 2: HDR Lighting' slides by John Hable[ref
site="SlideShare"
page="Uncharted 2: HDR Lighting"
url="http://www.slideshare.net/ozlael/hable-john-uncharted2-hdr-lighting"]]
[29:06][Blackboard: We want to mimic what the monitor is doing]
[30:05][Implement this sRGB approximation]
[36:13][Create the SRGB255ToLinear1 and Linear1ToSRGB255 functions]
[39:09][Compile, take a look in-game and go through that with a more fine toothcomb]
[44:09][Set a breakpoint and step through the code]
[47:50][Moment of realisation: Linear1ToSRGB255 was multiplying by 255 before square-rooting]
[48:17][Enjoy our tree in all its gamma corrected glory]
[51:01][Start using the Color value to tint our texture maps]
[51:43][Blackboard: Tinting]
[52:11][Implement tinting]
[53:07][Live tinting]
[55:37][Premultiply the alpha properly]
[57:08][Blackboard: Premultiplied alpha]
[59:09][Q&A][:speech]
[59:37][@ashkanhoss29][What would be the visual artifact of using 2 instead of 2.2 for the gamma?]
[1:01:28][@garlandobloom][Q: Also need to do additive color tinting for full expressiveness]
[1:02:11][@krohnos][I have a CS background but am 2 months behind on coding this. It is much easier to follow when I'm not trying to type myself. How detrimental would it be to my understanding to watch and just stop coding if I get too far behind? Sometimes when you're moving things around, I have to watch that bit 2-3 times]
[1:03:18][@ttbjm][Would it be worth only using gamma correction on texels that have alpha not equal to 0 or 1?]
[1:03:57][@robotchocolatedino][Could we do our maths in sRGB space?]
[1:04:22][Blackboard: Lerp in sRGB space]
[1:08:29][Blackboard: This Q&A just turned into an exploration]
[1:10:40][@cubercaleb][When are you going to start implementing OpenGL for the rendering?]
[1:11:00][@andsz_][Wouldn't be the 10_10_10_2 format (which is also available in hardware) be sufficient to avoid banding?]
[1:12:05][@sigma207][Then what is the point of using 2.2 at all? Why not just use 2 for the gamma?]
[1:12:58][@zuurr_][By repeatedly converting between linear and our approximated gamma space when doing each blend, are we compounding our errors?]
[1:14:47][@differentname][Do all monitors use the same 2.2 curve?]
[1:16:23][@cubercaleb][Is raising the color value to 2 instead of 2.2 really going to save that much processing power?]
[1:18:11][@kikokat][I got stuck implementing a Bitshift + PRNG in your engine, thanks for showing a code comment about 'Wang Hashing' earlier which was just what I needed]
[1:18:46][Wrap it up for today][:speech]
[/video]