HDR研究之一

来源:互联网 发布:网络管理工作站 编辑:程序博客网 时间:2024/06/04 19:46

第一步:曝光控制(Exposure Control: The First Step)

 

1. 需要一张 high dynamic range environment maps

HDR invermaps

2. 第2步是从这个图片的alpha通道里面获取的值去计算真正的HDR value

 

原文: 好吧.. 我没看懂..

The next step is to use the alpha channel from the environment map to calculate the real
HDR values. This is done by multiplying the environment color by the alpha channel
when each object is rendered, considering the alpha value as being within the zero to 64
range. This leads to the following pixel shader code snippet:

 

3. 最后在render monkey 里面添加一个 SCALAR类型的变量作为曝光系数

 

最终的PS代码

 

sampler Texture0;
float4 ps_main(float3 dir: TEXCOORD0) : COLOR
{
// Read texture and determine HDR color based on alpha
// channel and exposure level
float4 color = texCUBE(Environment, dir);
return color * ((1.0+(color.a*64.0))* Exposure_Level);
}

 

 

原创粉丝点击