Download - DOF
DOF 란
● 피사계심도
● 사진 렌즈로 어떤 거리의 피사체에 초점을 맞추면 그 앞쪽 [ 近點 ] 과 뒤쪽 [ 遠點 ] 의 일정한 거리 내에 초점이 맞는데 이때 그 범위를 이르는 말 .
● PhotoRealistic Rendering
Pinhole Camera Model
Thin Lens Camera Model
Implementation
● Simulation of CoC
● Pass 1 : Scene Rendering
● Pass 2 : Pos-processing
Pass 1 : Scene Rendering
● 장면 랜더링
● Depth and Blurriness factor
● MRT 사용
Pass 1 : Scene Rendering
● Depth
Pass 1 : Scene Rendering
● Mapping Depth to Blur
float blur = saturate( abs( depth - focalDist) * (2/focalRange));
1
-1
Focal Range
Focal Dist
Blur
Depth
Pass 1 : Scene Rendering
● MRT output
Pass 2 : Pos-processing
● Use CoC
● Poisson distribution
Pass 2 : Pos-processing
● Blurriness 와 Filter Size
Pass 2 : Pos-processing
● Leaking
Pass 2 : Pos-processing// Get center samplefloat4 colorSum = tex2D(SceneColorSampler, v.vTexCoord);float2 centerDepthBlur = tex2D(DepthBlurSampler, v.vTexCoord);// Compute CoC size based on blurrinessfloat sizeCoC = centerDepthBlur.y * maxCoC;float totalContribution = 1.0f;// Run through all tapsfor (int i = 0; i < NUM_DOF_TAPS; i++){
// Compute tap coordinatesfloat2 tapCoord = v.vTexCoord + filterTaps[i] * sizeCoC;// Fetch tap samplefloat4 tapColor = tex2D(SceneColorSampler, tapCoord);float2 tapDepthBlur = tex2D(DepthBlurSampler, tapCoord);// Compute tap contributionfloat tapContribution = (tapDepthBlur.x > centerDepthBlur.x) ?
1.0f : tapDepthBlur.y;// Accumulate color and contributioncolorSum += tapColor * tapContribution;totalContribution += tapContribution;
}// Normalize to get proper luminancefloat4 finalColor = colorSum / totalContribution;
샘플링 탭이 Blurriness 0 면 색이 적용 X
탭의 깊이 비교