HDR Workflows for Video Game Rendering
-
Upload
c0de517eblogspotcom -
Category
Documents
-
view
134 -
download
1
description
Transcript of HDR Workflows for Video Game Rendering
1
2
3
Some)mes, we even do some pre2y advanced colorspace reasoning, i.e. gamma/linear textures in CryEngine h2p://www.crytek.com/download/AdvRTRend_crytek.ppt “Some” confusion s)ll persists… I.e. Which spaces are linear and which have a gamma curve? sRGB-‐>CIEXYZ, do you need to degamma? h2p://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html … h2p://en.wikipedia.org/wiki/RGB_color_space Why sRGB is gamma 2.2? Does it really make sense today? What “gamma” does our eye “need”? Perceptual color spaces… See CIELAB h2p://en.wikipedia.org/wiki/Lab_color_space What color space does HDR live in? What does HDR really mean, for colors? sRGB is defined normalizing on the white point intensity… h2p://blogs.msdn.com/b/billcrow/archive/2007/10/25/hdr-‐and-‐color-‐spaces.aspx Anyhow…
4
5
6
7
8
9
10
11
• Ok, not true in all cases, for example, if we used a tonemapper with local adap)on (which, games don’t really do), that would be a post-‐filter that can’t be achieved with shaders in an LDR. Alpha blending also can’t exactly match. Dynamic exposure won’t have access to the exact same informa)on and so on. Don’t take that too literally, my point is that you have to think what you’re doing and why. For decades now, offline renderers were not working in linear space, nor HDR, and that didn’t stop ar)sts from crea)ng perfectly photorealis)c images.
12
To me, the first three are either irrelevant or easy to do in LDR, not that interes)ng… Let me be clear here. With enough effort we can take some equa)ons, and parameters, and tweak them and tweak them un)l they look perfect, from all angles and situa)ons. As the complexity of the equa)ons and parameters and situa)ons grow, this tweaking work becomes unwieldy. For example, we can take our shaders, maybe they are outpumng a color and the highlights are clipped. We can apply to that color and these highlights some desatura)on. We don’t know why, but it’s necessary to make the image not look like a nuclear explosion of colors. We can keep tweaking in this way, un)l it looks right from all angles, but at the end of the day, aner we “blindly” tweaked and hacked things without “meaning”, we should obtain exactly an approxima)on of the rules of physics and percep)on we “know”… Physically based rendering lets us reason in a framework of certainty. This equa)on is a material, this is a light, this is energy, this is a color, this is how the eye sees things. It’s s)ll very easy to forget what’s important, to choose the right models, to miss some light or make mistakes. But we can compare the output with our reference, the reality, see our error, and understand where and why. Hopefully.
13
Image from Fallout. The “errors” are my own interpreta)on, maybe this image was fine both for the ar)sts, and was tone mapped right… Is being physically based always be2er? Not really. With the right tools, the right ar)sts, and maybe in a game that is more constrained, a “painterly”, ar)s)c approach might very well be the way to go…
14
*At least, for a game that strives for realism In a non physically-‐based, or be2er, physically-‐reasonable renderer, changing a variable onen requires global changes, as the scene was setup with en))es that are onen correlated and do not carry a par)cular meaning… Shaders output a color, somehow…
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
The idea of local TM operators is that loss of contrast at low spa)al frequencies is hard to perceive, thus we can “compress” there and get be2er detail (representa)on, range for contrast in the high frequencies). Local filters could be done «tastefully», i.e. Bilateral filters, edge aware… in games, righsully, we onen prefer to convey brightness over preserving detail anyways.
33
34
If the tone mapping is fixed a-‐priory, we could tune in tone-‐mapped space directly… ...things can get ugly if we need to render the same scene under different tone mappings, if we tuned for one. If we tune directly with an “art directed” tonemapping/colorgrading, the risk is that our scene won’t be “physically reasonable” anymore. We might not be able to tone it again, to change our decisions. Easy example is of scenes tuned for NO tonemapping, the dynamic range is onen squished down by the ar)sts (to avoid clipping) in a way that won’t ever look “right” if aner authoring we just decide to bolt-‐on some tonemapping operators…
35
36
37
38
39
40
41
42
Simplify[D[1/(1 + Exp[-‐x*4]), x] /. x -‐> 0] Manipulate[ Plot[ Piecewise[{ {(1/(1 + Exp[-‐x*4])) * c + (0.5 + x)*(1 -‐ c), x < 0}, {(1/(1 + Exp[-‐x*4])) * d + (0.5 + x)*(1 -‐ d), x >= 0} }] /. {x -‐> (y -‐ b)/a} , {y, -‐3, 3}, PlotRange -‐> {0, 1}], {{a, 1, "range"}, 0.1, 10}, {{b, 0, "center"}, -‐3, 3}, {{c, 1, "low curve"}, -‐5, 1}, {{d, 1, "hi curve"}, -‐5, 1}]
43
44
45
Why not using alterna)ve color spaces? HSL and similar perceptual models are built, by defini)on, to be able to do said decoupling.
Old, «ar)st» oriented color spaces. Slow to convert Today: CIELAB, CIELUV
Changing L in LAB does not alter color... Problem: S)ll don’t work well with HDR ranges…
46
47
48
49
In reality, we adapt to many condi)ons, i.e. white point, but you have to be aware of what we lose from HDR-‐>LDR and what is s)ll “working” in our percep)on of an LDR image, and thus we don’t need to simulate… It’s a very complicated ma2er that also depends on your monitor profile, the angle the monitor spawns in your view and so on… Also, not all persons are the same, for example, vision changes quite significantly with the age, i.e. pdf.aminer.org/000/346/554/fast_tone_mapping_for_high_dynamic_range_images.pdf
50
Decoupling ligh)ng from texture is what bilateral TMO tries to achieve. The concept of “intrinsic images”… see the reference
51
52
53
54
55
56
h2p://www.audioholics.com/tweaks/calibrate-‐your-‐system/hdmi-‐black-‐levels-‐xvycc-‐rgb h2p://en.wikipedia.org/wiki/XvYCC h2p://research.microson.com/en-‐us/UM/redmond/groups/IVM/hdview/ColorExamples.htm
57
58