# How to implement physically based unit in pbr renderer

According to this note, Frostbite use photometry unit in their calculation. I am trying to mimic this feature, but I am not sure what transformation need to be done. I will try to explain what I have in mind.

First we do gamma correction(pow(2.2)) to the albedo texture. Then we apply the BRDF that takes luminance as input and will produce output luminance. After that we do tonemapping(say we use filmic tone mapping) and then inverse gamma correct pow(1/2.2) and store it to the framebuffer.

Is this process correct? Should I transform the luminance to radiance first before doing the tonemap or maybe I should convert it even before that when doing BRDF calculation? Do I need to convert the albedo with photometry curve after doing gamma correction?

First we do gamma correction

1. Make sure you actually need to do gamma correction on the albedo texture (or rather "uncorrection", i.e. making it linear). Not all textures are stored in sRGB color space. Also, you're doing it the wrong way around: Going from sRGB to linear color space you need to do the pow(1/2.2) part here and the pow(2.2) part in the end.

Should I transform the luminance to radiance first before doing the tonemap or maybe I should convert it even before that when doing BRDF calculation?

1. Yes you should convert before doing the BRDF calculation. Tonemapping is not a feature that's part of the actual physical simulation of light, therefore it doesn't "need" any physical units. The BRDF however is, and here you should make sure that your units "add up". E.g. you wouldn't calculate the surface area of a rectangle by using meters as the unit for one side and inches as the unit for another side.

Do I need to convert the albedo with photometry curve after doing gamma correction?

1. I'm not entirely sure here, but I think you don't need to do that. The albedo color basically tells you, how much of a certain light will be reflected. Since you change your light to photometric units (if you do it as suggested in the Frostbite notes), than I would say this already taken care of. You could also look at it like this: Since the color is a ratio and thus unit-less, there is no need to convert it from unit to another.
• Thanks for the correction for the gamma. About the answer number two. If I store light as color and luminous intensity. Then after I convert to radiometry unit, It is possible that the color will change right? Because each color contribute different amount of luminous intensity. Or should I just convert the intensity part by assuming efficiency is 100%?. I ask about tonemapping because I am not sure what unit should I deliver to the tonemapping operation. Radiance or luminance? Tonemapping will convert linear HDR to linear LDR. But not sure what unit is this linear HDR. – kevinyu Apr 5 at 10:00
• The way I understand it, the color should not change, just your way of expressing the light. The same way that 2.54cm is the same as 1 inch. Thus, you have the same input for tonemapping, regardless of how you calculate your light. – Tare Apr 5 at 12:14