您好,欢迎访问三七文档
OverviewWhatisHDR?WhatcanbedonewithHDR?HowtogetHDRimage?HDRFileFormatWhatdoesHDRrequire?HDRRenderingProcessTypicalHDRWorkflowToneMappingHDRpost-processingeffects1,WhatisHDR?HDR=highdynamicrange一幅图像亮度级的最大值和最小值之比被称为动态范围(DynamicRange),定义如下:a=Imax/Imiin真实世界场景中亮度的动态范围可达到100,000:1采用HDR,亮度值可以超过[0..1]的范围Natureisn’tclampedto[0..1],neithershouldCG通过floatingpoint计算完成Inlayterm(quotedfromnVIDIA’spresentation)BrightthingcanbereallybrightDarkthingcanbereallydarkAndthedetailcanbeseeninboth采用HDR的优点HDR,即高动态范围直观的理解是:将光照渲染到浮点纹理上,获得全范围的亮度然后再通过调制,将其映射到256级的[0,1]之间如果按照传统的非HDR做法,亮度大于1的值将会clamp成1,因此1和1.5之间所显示的亮度是相同的,缺少了对比度HDR的做法,是通过浮点纹理保存任意范围的亮度,然后映射到[0,1]之间,这样可以保留对比度,使得场景更加自然HDRrenderingatwork:Lightthroughwindowsis10,000softimesbrighterthanobelisks–butbothareperceptibleinthesame8-bits/componentimage2,WhatcanbedonewithHDR?Dazzlinglight(耀眼的光源)Dazzlingreflection(耀眼的反射)Fresnelreflection(菲涅耳反射)brightreflectioninthenormaldirectionExposurecontroleffects(曝光控制)Realisticdepth-of-fieldeffectsRealisticmotionblurDazzlingLight(耀眼的光源)DazzlingReflection(耀眼的反射)HDRFresnel在低反射率材质上的明亮反射(Brightreflectionofflow-reflectancesurfaces)ExposureControl(曝光控制)具有真实感的景深效果(HDRDepth-of-Field)具有真实感的运动模糊效果(HDRMotionBlur)3,HDR图像的获取一、用不同的曝光时间拍摄一系列图像,然后把它们合成为高动态范围图像二、直接用高动态范围相机来拍摄HDRvalueforeachpixelRecoverresponsecurve4,HDRFormatOpenEXR由工业光魔(IndustrialLight&Magic)开发的一种HDR标准每个通道的数据类型是FP16,一共四个通道64bpp,每个通道1个bit位用来标志“指数”,5个bit用来存放指数的值,10个bit存放色度坐标(u,v)的尾数,其动态范围从6.14×10^-5到6.41×10^4FloatTiff每个通道为FP32(32bitFloatPoint)类型,一共3个通道96bppHDRFormatRadianceRGBERGBE文件的扩展名为.hdr这个本来是BR、FR等作为radiance材质的一种格式,也叫做radiancemap,后来成为流行的一种HDR格式所谓E,就是指数RadianceRGBE文件每个通道为8bitBYTE数据类型,4个通道一共是32bitRGBE可以使用RLE压缩编码压缩,也可以不压缩。由文件头、RGBE数据组成RGB到E8R8G8B8格式转化(E8R8G8B8Encoding(HLSL))//a^n=b#defineLOG(a,b)(log((b))/log((a)))#defineEXP_BASE(1.06)#defineEXP_OFFSET(128.0)//PixelShader(6instructionslots)//rgbalreadyexposure-scaledfloat4EncodeHDR_RGB_RGBE8(infloat3rgb){//ComputeacommonexponentfloatfLen=dot(rgb.rgb,1.0);floatfExp=LOG(EXP_BASE,fLen);float4ret;ret.a=(fExp+EXP_OFFSET)/256;ret.rgb=rgb/fLen;returnret;}//Moreaccurateencoding#defineEXP_BASE(1.04)#defineEXP_OFFSET(64.0)//PixelShader(13instructionslots)float4EncodeHDR_RGB_RGBE8(infloat3rgb){float4ret;//Computeacommonexponent//basedonthebrightestcolorchannelfloatfLen=max(rgb.r,rgb.g);fLen=max(fLen,rgb.b);floatfExp=floor(LOG(EXP_BASE,fLen));float4ret;ret.a=clamp((fExp+EXP_OFFSET)/256,0.0,1.0);ret.rgb=rgb/pow(EXP_BASE,ret.a*256-EXP_OFFSET);returnret;}E8R8G8B8Decoding//PixelShader(5instructionslots)float3DecodeHDR_RGBE8_RGB(infloat4rgbe){floatfExp=rgbe.a*256-EXP_OFFSET;floatfScale=pow(EXP_BASE,fExp);return(rgbe.rgb*fScaler);}Encoding/decodingshouldbedoneusingpartial-precisioninstructions纹理格式固有的舍入误差更大Roundingerrorsinherentinthetextureformataremuchbigger//IfR16Ftextureformatisavailable,//youcanusetexturetoconvertalphatoscalefactorfloat3DecodeHDR_RGBE8_RGB(infloat4rgbe){//samp1D_Exp:1Dfloattextureof256x1//pow(EXP_BASE,uCoord*256-EXP_OFFSET)floatfScale=tex1D(samp1D_Exp,rgbe.a).r;return(rgbe.rgb*fScale);}5,WhatdoesHDRrequire?TrueHDRrequiresFPeverywhereFloating-pointarithmeticFloating-pointrendertargetsFloating-pointblendingFloating-pointtexturesFloating-pointfilteringFloating-pointdisplay?6,TrueHDRRenderingProcessSceneGeometrylitwithHDRLightProbesHDRSceneBloomFilter+ToneMappingDisplayableImageImageSpaceOperationsFramePost-ProcessingHDRScene¼SizeFrameVerticalGaussianFilterHorizontalGaussianFilter+¼SizeFrameOnePassEachOneFinalEachSeparableGaussianFilterSeparableGaussianFilterfloatPixelWeight[8]={0.2537,0.2185,0.0821,0.0461,0.0262,0.0162,0.0102,0.0052};float4ps_main(float2inTex:TEXCOORD0):COLOR0{float4color=tex2D(BlurXSampler,inTex);//在该象素点的左右两侧采样,并乘以权值for(inti=0;i8;++i){color+=tex2D(BlurXSampler,inTex+(BlurOffset*i))*PixelWeight[i];color+=tex2D(BlurXSampler,inTex-(BlurOffset*i))*PixelWeight[i];}returncolor;}ToneMappingfloat4ps_main(float2inTex:TEXCOORD0):COLOR0{float4original=tex2D(FullSampler,inTex);float4blur=tex2D(BlurSampler,inTex);//返回x+s(y-x)float4color=lerp(original,blur,0.4f);//将坐标移到-1/2to1/2范围inTex-=0.5;//到起点(屏幕中心)的距离的平方floatvignette=1-dot(inTex,inTex);//乘上vignette的4次方color*=pow(vignette,4.0);//乘上曝光度color*=fExposureLevel;//使用gamma校正,并返回returnpow(color,0.55);}7,TypicalHDRWorkflow(FakeHDR)8,ToneMapping–MoreexactlyToneMapping就是以某种方式将图像的动态范围进行缩放,使之匹配只能输出LDR的现实设备的过程又称ToneReproduction除了压缩亮度范围,还必须保留原始图像的感观质量(PerceptualQuality),如:原始图像对比度、明亮程度、细节等信息ToneMapping的分类动态范围的重建算法大致分为两种空域不变(SpatiallyUniform),或者叫全局范围动态压缩空域变化的(SpatiallyVarying),或者叫局部动态范围压缩ToneMapping之空域不变这类算法中以WardLarson等人(Avisibilitymatchingtonereproductionoperatorforhighdynamicrangescenes)基于直方图调整的动态范围重建技术为标志优点:此类算法在对图像进行动态范围变换时,每个像素(Pixel)上使用同一条变换曲线,变换曲线可以预先指定或者根据图像的内容获取不足:不变的变换曲线不能自适应图像的各个区域,导致结果图像在细节、颜色、明亮程度上损失ToneMapping之空域变化的该类算法针对图像不同的区域进行不同的变换根据人类视觉系统(HVS)的不同模型,各种不同算法在压缩动态范围的同时都以保留图像质量的某一方面为标准直到90年代末期,各种算法都是在多层模型上针对不同的HVS模型进行调整,但是由于低频图像上采用的滤波函数特性不佳,在结果图像中物体边缘会产生严重光晕(halo)一直是困扰该类算法多年的问题1999年,Tumblin等人提出了LCIS算法(
本文标题:HDR介绍
链接地址:https://www.777doc.com/doc-7275605 .html