dof

13

Click here to load reader

Upload: ozlael-ozlael

Post on 24-Jun-2015

876 views

Category:

Technology


0 download

DESCRIPTION

DOF, depth of field

TRANSCRIPT

Page 1: DOF

Depth of Field

http://ozlael.egloos.com/

Page 2: DOF

DOF 란

● 피사계심도

● 사진 렌즈로 어떤 거리의 피사체에 초점을 맞추면 그 앞쪽 [ 近點 ] 과 뒤쪽 [ 遠點 ] 의 일정한 거리 내에 초점이 맞는데 이때 그 범위를 이르는 말 .

● PhotoRealistic Rendering

Page 3: DOF

Pinhole Camera Model

Page 4: DOF

Thin Lens Camera Model

Page 5: DOF

Implementation

● Simulation of CoC

● Pass 1 : Scene Rendering

● Pass 2 : Pos-processing

Page 6: DOF

Pass 1 : Scene Rendering

● 장면 랜더링

● Depth and Blurriness factor

● MRT 사용

Page 7: DOF

Pass 1 : Scene Rendering

● Depth

Page 8: DOF

Pass 1 : Scene Rendering

● Mapping Depth to Blur

float blur = saturate( abs( depth - focalDist) * (2/focalRange));

1

-1

Focal Range

Focal Dist

Blur

Depth

Page 9: DOF

Pass 1 : Scene Rendering

● MRT output

Page 10: DOF

Pass 2 : Pos-processing

● Use CoC

● Poisson distribution

Page 11: DOF

Pass 2 : Pos-processing

● Blurriness 와 Filter Size

Page 12: DOF

Pass 2 : Pos-processing

● Leaking

Page 13: DOF

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

탭의 깊이 비교