# HDR exposure control within a shader

## Recommended Posts

Hi all ,

I am using the Ambient light shader I build with Marios help , but I have got to wondering is there a function I can use to control the exposure settings on a convoluted HDR map within the shader that I cam using to get my lighting information ? I just figure then I can keep my workflow linear and not worry about altering HDR maps in cops etc

regards Rob

Edited by rob
##### Share on other sites

Hi all ,

I am using the Ambient light shader I build with Marios help , but I have got to wondering is there a function I can use to control the exposure settings on a convoluted HDR map within the shader that I cam using to get my lighting information ? I just figure then I can keep my workflow linear and not worry about altering HDR maps in cops etc

regards Rob

I'm not sure what you mean by a "convoluted HDRI map" (a convolved HDRI map? convolved by what?), but as I understand it, exposure is just a "brightening" (a multiplication). So C*exposure (where "C" is the original value, and exposure is a float) would be one way to implement exposure. In this formulation, it's no different than the Brightness COP.

However, the more photographic way to express it would be in terms of relative f-stops (instead of a plain float). An f-stop is the base-2 logarithm of the ratio between two intensities: So if you want half the intensity (or exposure), you'd change your f-stop by log2(1/2)=-1 (or "down one stop"). And to double the exposure, you'd adjust the f-stop by log2(2)=1 (or "up one stop"). In short, each f-stop adjusts exposure by a factor of 2relative_fstop. So to implement an exposure operator in terms of f-stops, you replace that simple float by a power of 2:

```vector exposure(vector color; float relative_fstop) {
return color * pow(2.0,relative_fstop);
}```

Note that none of the above has anything to do with gamma correction, or linear vs. non-linear intensities (the fact that 2x is not linear doesn't change the linearity of the input -- it truly *is* just a "brightness" operator), but you mention "...I can keep my workflow linear...", which seems to imply some compensation for a non-linear input (which is a whole other topic), so I'm not sure if an exposure operator will help you. In any case, there it is.

Cheers!

##### Share on other sites

Thankyou Mario as ever for your expert view. Diffuse and Specular Convolution is discussed over here http://gl.ict.usc.edu/HDRShop/ .

Note that none of the above has anything to do with gamma correction, or linear vs. non-linear intensities (the fact that 2x is not linear doesn't change the linearity of the input -- it truly *is* just a "brightness" operator), but you mention "...I can keep my workflow linear...", which seems to imply some compensation for a non-linear input (which is a whole other topic), so I'm not sure if an exposure operator will help you. In any case, there it is.

Ok so if I get this correctly. My plan is - Pipe the HDR into Houdini via a shader use a setting to control the exposure of the HDR .To either increase or decrease the exposure.For viewing the gamma in mplay would be set to 2.2.

I will have a crack at this over the weekend using your code

Rob

Edited by rob
##### Share on other sites

Diffuse and Specular Convolution is discussed over here http://gl.ict.usc.edu/HDRShop/ .

Right. Convolution won't affect the linearity of the image, so don't worry about that. But do make sure to set gamma to 1.0 (I think HDRShop defaults to 2.2) before you save the image. With that correction in mind, the rest of your plan sounds good.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×