 So, as I said before, the tool map we will look at was developed by Renhardt at all in Hitzigrath 2002 presented. So it has, it had already some time to prove itself, so to say. It's widely used, so most light simulation products and also HDR photography tools have it and it has both a global and a local variant. So they were both presented. Here you see the difference between a global and a local approach. In some way, I mean usually convolution is by a fixed kernel. So your kernel function is the same. Here this could be a non-linear kernel. So it's not that it's linear convolution in the sense that you have one fixed kernel that does it, but you have a non-linear mapping. In this sense, it's not really convolution, but the implementations can are in this period. So if you want to have it fast. So parallelization strategies that work for convolution is a work for depth. Usually you, I will go into the local approach later, but you usually have to adapt the feature size. So either then you do multiple passes with different discretizations of your kernel size or you take a huge kernel and vary the kernel function. Okay, here the difference between a global and a local approach. I'm not 100% true how wide it is is possible on this project. But for example, you see that the local approach has much more contrast in the Google path or for example in the in the most ethics on the chart. A technological one already works very well is faster, but doesn't give you all the possibilities that your eye would give you. So the steps. This is just a short outline. I will explain what this meant with this formula is. Of course, if you want to have in depth details on this, the reference is at the end of the lecture. So here a percent global version. So you now have one mapping function of the whole image or of the luminance values of the whole image to a color space. So the first thing you do is you compute some kind of average of the image. So since you do not know if this is this inherently a very dark image or is it globally a very bright image, you somehow have to set the baseline. So to say. And this is done with the log average. So you don't just average the sun. So you don't sum up and divide because this would give an un proportionable weight to the large values because they are somehow exponentially distributed you can imagine. So this takes care of that. So you. You average in log space and then convert back into exponential. And then you have some kind of average of your scene. So this is the approximate average brightness of the image that I'm looking at. And then you map this to a middle gray value. So A is now what you define as you want to have middle gray. This you can vary. This also depends on what the range is. You have available. And this now sets the bar. So everything above this middle gray will be brighter. Everything below will be dark. And then what you do is you take the middle gray value and scale the input accordingly to it. So now you don't have a input in some kind of arbitrary range but you have it relative to the middle gray value. And then what you do is that you compress the high luminances. So as if you remember from before this division, division by a maximum, which gave you just a single bright spot in the image. This is because the high luminances dominate, usually dominate the scene but are only of very small extent in the scene itself. Imagine looking at the sun. I mean the sun is very small when compared to the whole sky dome but it would dominate it as immensely higher brightness values than the surrounding blue of the sky. So what you do here is not that you are map your scale luminance values to the final output by compressing the higher luminances. So in the lower right you see the function, the mapping function. So as you see that a huge range, say from value 4 to 10 in the x-axis is mapped to a rather small part in the y-axis. That means that a lot of large luminances are just compressed in a small range in the, say, RGB values. And what you also have is that the small luminances, so the small luminances in the input file or in the input image are mapped to a larger extent on the y-axis. So this you can see that the slope of the function starts out as nilivertically. Go at the 45 degree you have a 1-1 mapping which is approximately a 2 and then you have a compression. So what this mapping does is it compresses the high luminances and enhances the low luminances. This gives you the mapping and you can convert this into, so I go back. So the output luminances then have a predefined range from 0 to 1 and can then be mapped to what that color space you like. So the local version, this is now the one that takes the neighbors into account, starts off similarly. So you compute the log average to get an estimate how is the average brightness of my scene. Then you map the values to average gray. That means that the value of 1 is now my the middle gray to the defined. But now I do not compress the luminance by one uniform function over the whole image but then locally adept this function by looking at the neighbors. So now this the local average apacase V now depends not only on the coordinates in the image, so x and y. So the pixel that I'm there right now but it also depends on some kind of scale. The scale means how uniform I'm a brightness distribution there. So am I at a say a silhouette where half of it is very dark, half of it is very bright or am I in a homogeneous region because in homogeneous regions your eye would adapt on a larger extent on the right to this brightness and if it's accommodated to this brightness it can differentiate details better. You perhaps have already experienced it when you look at the moon. So if you look quickly at the moon it's just a bright spot but the longer you look at it the more details you can discern it. This is an adaptation of your eye to it and this happens also at local spots on the right and this is what's simulated here. So you compute for every pixel position x, y, a local scale and with this local scale you then you compute a local average V and this now gives you how much range compression is going to happen at this location. So how to get this scale? So the scale is the extent of an area around this pixel where the brightness does not change too much. So in this example where you have a colorful church window this is that is illuminated from outside. You have three different examples on how how you can put the influence region of your scale. So the line-up tool map is by computing two radies and then look at a certain scale that I mean a way that they have a certain behavior. So in the very top you see you assume that the pixels in the center of the two concentric circles. So this is the pixel that I want to tone that now and if I lie if I put two concentric small circles around it then I see that the center area the smaller circle is quite smooth in the distribution of brightnesses but the outer circle is very smooth too. So there is no significant difference between the small and the large circle that means that my scale is too small. That means that I could enlarge my circles even more and still retain smoothness. In the center example you see the correct application so the center disk has smooth values so they are approximately the same brightness but if you take now the outer circle that intersects the window you see that suddenly in this footprint very large brightness values are. So you see that the small circle is smooth but the surrounding area is not smooth and this is what you want to achieve when you determine the local scale. So the larger the local scale is the more you are looking at the large patch of equal brightnesses and your eye would adapt to that. That means that for this pixel you can improve the contrast because your eye would do the same. Another failure case what you should not do is that you make the disks too large as shown in the bottom example because your bright values are already in the inner disk. So this scale would be too large. I go back. So what you get but this when you notice K you know in how large the reach is where you can compute your local average and this then allows you to locally compress your range. So if it's very smooth you compress less if you are next to very bright boundaries. So if you are next to discontinuities in the brightness in your image so you are at the verge of traversing from a bright to a dim region or vice versa you do the opposite. The ratio between the larger radius or smaller is constant. Exactly. This is the approach that detect there and then you have to find this. I mean they also show you an implementation how this can be efficiently mapped because I mean trying all the possible circles or disks is not feasible so you need some kind of approximation that gives you a good estimate of that. Yeah I mean I don't know how they handle this but I would guess that it just ignore everything that's out of the image. So you have to cope with what you have there. And but this is natural. In the corners of your image you get less neighborhood so you get less information of how the surrounding looks like so you will get say less optimal tone mapping there. So here another difference assuming in the image before so as you can see the inch of figures on the wall are have a much higher contrast and this is now because the brightness values there are relatively constant. So if you compare this with say the window next to it then this has a very uniform brightness even if the colors are perhaps different this is still a low range as you saw before between sun and moon it was 800,000 between black and white it was 100 or 1000. So if you have direct or indirect illumination counts much more than just color variations of your surface. So here the tone map corrects the take-in its local version that the brightness values are quite uniform in this region so it enhances the contrast. So now this concludes the right-hand tone map but there are also other tone mapping approaches. So in this C-Craft 2002 was the year of the tone map bus because there were three tone mapping approaches presented. So one of those was the bilateral filter perhaps you already heard of bilateral filtering in computer vision perhaps. There this is you can imagine it as a dorsal smoothing that does not smoothe the edges. So if you have a large difference in your image then it does not smoothe this way. So this is you can also call it edge preserving smoothing. And you can imagine that this is somehow conceptually similar to this scale estimation of a line-out because the scale estimation looks where to the brightness values differ a lot. So these are say my brightness edges in the image and then it doesn't try to propagate contrast enhancement over this edge and the bilateral filters can do the same thing because they just stop the filtering process at edges. Then another approach by Fatal gradient processing this is you can imagine an image say you have only a luminous channel of a single color then you can imagine your image as a height function. So bright spots correspond to high peaks, dim regions to low values. And what they do in this work is that they look at the gradients. So how steep are the slopes in my image and then they compress in gradient range. This allows them to preserve low gradients because these are small slopes are the details in the dimly-luminated regions and the very high slopes are the ramps up to the bright spots. So if you just say reduce the high gradients you also get a similar behavior that you only reduce the range in non-uniform regions. So these are three approaches that do approximately the same they have the same underlying idea but they have different approaches to it. So one of our hand heart goes more into what's used in photography with direct exposure plates that you can use. bilateral filtering immediately uses a well established filtering paradigm in signal processing but it's most likely very sub-optimal from a perceptual point of view. Gradient processing allows a very fast application but perceptionally of these three works that I have told me it was the best. And this speed increases that you perhaps needed 13 years ago are not really relevant now so you don't need to take approximations that were highly relevant before into account anymore and just do the and just have something that's less efficient but gives you a lot of the box nice solution. And if you'll check Wikipedia the German version as a long list they list the approximately 20 different variants. The literature for that is Reinhard not only started that but also continued research and that and he's seen as one of the say experts that to go to when tool mapping is concerned he wrote a book about that so hytonemic range imaging and you can also see these three papers. If you want to know how to speak developed you just check for example the Reinhard paper on the digital library of ACM. You can do this from here from the university so you get an account you get immediate access to the whole digital library of ACM and there you can just click on site it by and then you get the long list of papers that referenced the original work by Reinhard and then you can sort them by a year's and look what different approaches we used. Good that concludes the tool mapping parts are there any questions? Okay if not, if we know which method is the use time we also do we also do we also do some extent because I mean you're inherently losing information because okay the say the thing where you for sure lose precision is if you have before say 24 beat values and then you're in cold then we need 8 beat RGB values then you have a contestation of your brightness values this is unrecoverable this is just lost. The other thing is if you use local approaches that take the neighborhood information to account and then do different things in different regions of the image then it could be that you have some kind of ambiguity if you want to reverse this process because then it could be that you either had say in the original data large brightness values and a small scale or a large range compression then or the range was already small like that and you're just used less compression so you do not have the full information how local approaches adapt to certain parts of the image you will have to infer this somehow I would guess like an optimization approach so you would like that locally you should have the same scale that you assume that you reconstruct and then you can recover your signal but you will not be able to recover with it with global approaches it should be possible yeah okay yeah if you combine global and the local ones as the right level does I think wait in any way or about the global one and the local one if you look here the local version has this expression so the the scale luminance is then divided by some kind of local average and the global version the first two steps are identical but then it uses the scale value only at the very center to say compute this local average so the global version is a special case of the local version that there is not a certain way to implement yeah you combine the whole picture of the local picture I will not know no no no the luminance output this is what you get so for each picture location you get scale luminance between 0 and 1 by the global approach and by the local approach so here it also immediately gives you the output luminance so that there is no combination for the questions okay then thank you for your attention on this concludes this rendering lecture