SlideShare a Scribd company logo
1 of 16
Download to read offline
Edge Masking and Per-Texel Depth
      Extent Propagation
    For Computation Culling
    During Shadow Mapping



                         http://ohyecloudy.com
             http://cafe.naver.com/shader.cafe

                                    2009.06.08
개요
어떻게 하면 그림자 aliasing을 줄일 수
있을까?
 어떻게 하면 shadow map을 잘 만들까 (X)
 shadow map 후처리를 할 수 있는 영역을 어떻게 하면
 잘 찾을 수 있을까 (O)
그림자 경계 영역 :
anti-aliasing을 위해 더 많은 texture fetch와 processing이
필요한 부분
계산이 더 필요한 그림자 경계 영역을 구
하는 두 가지 방법 소개.
이렇게 구한 영역만 anti-aliasing을 줄
이기 위한 복잡한 연산을 한다.
SM 3.0 필요
loop, dynamic flow control 등 제대로 된 flow-control을
  사용할 수 있다.
Shadow map




                              Edge mask map


      edge dilation
           or
depth extent propagation

                           Computation mask map
Computation Masking and Edge
Dilation Using Mipchain Generation
Depth-Extent Propagation for
Computation Masking
graphics hardware에 최적화된 간단한
방법.
edge mask로부터 mipchain을 생성한
다.
shadow mask의 효과적인 근사 확장
 8 pixel로 확장하고 싶다면 miplevel을 3.
edge pixel 과 nonedge pixel 을 구분
할 threshold 필요.
highest-resolution miplevel 의 edge filter 결과 값.


bilinear filtering을 사용
2x2 box filtering을 사용하면 mip level이 올라갈수록 모
  든 방향으로 확장되는게 아니라 한쪽으로 확장되는 경우
  가 발생.
Computation Masking and Edge
Dilation Using Mipchain Generation
 mipchain을 생성하고 확장하려는 edge 픽셀에 맞게
 miplevel을 설정한다.

Depth-Extent Propagation for
Computation Masking
depth extent map
 확장된 edge mask 대신에 light로부터 min, max 거리
 사용.
 edge-filtered shadow map 사용
shadow map 텍스쳐 좌표가 주어 졌을때(확장된 edge 영역),
            z 좌표가 min, max 사이일 때만 복잡한 연산 수행.




edge


                           9 점에서 min, max 값을 뽑아서 저장




       edge가 아니므로 min = 1, max = 0 으로 저장
float4 ps_EdgeMapRGMinMax( float2 oTex : TEXCOORD0 ) : COLOR0
{
            float4 neighborOffsets[4] = {
                        { 1.0, 0.0, 0, 0 },
                        {-1.0, 0.0, 0, 0 },
                        { 0.0, 1.0, 0, 0 },
                        { 0.0,-1.0, 0, 0 }
            };
            float centerTapDepth = tex2D( ShadowSampler, oTex ).r;
            for( int i=0; i< 4; i++ )
            {
                        currTapDepth = tex2D( ShadowSampler, oTex+(g_vFullTexelOffset*neighborOffsets[i]) ).r;
                        depthDiff = abs( centerTapDepth - currTapDepth );

                        if( depthDiff > g_fMinEdgeDelta )
                        {
                                    furthestTapDepth = max( currTapDepth, centerTapDepth );
                                    furthestTepDepthMin = min( furthestTepDepthMin, furthestTapDepth );
                                    furthestTepDepthMax = max( furthestTepDepthMax, furthestTapDepth );

                        }
            }

            outColor.r = furthestTapDepthMin;
            outColor.g = furthestTapDepthMax;

            return outColor;
}
Mipchain
min, max 때문에 filtering으로 생성(X).
PS를 만들어서 생성한다.
    float4 ps_MipLevel3x3MinMaxRG(
                float4 oTex0 : TEXCOORD0,
                float4 oFullTexelOffset : TEXCOORD1 ) : COLOR0
    {
                float4 tapOffset = oFullTexelOffset;

               outCol.rg = tex2Dlod( ShadowMipPointSampler, oTex0 ).rg;

               // 1, 1, 0, 0
               tapVals = tex2Dlod( ShadowMipPointSampler, oTex0 +
                           ( tapOffset * float4(1, 1, 0, 0) ) ).rg;
               outCol.r = min( outCol.r, tapVals.r );
               outCol.g = max( outCol.g, tapVals.g );

               //   0, 1, 0, 0
               //   1, 0, 0, 0
               //   -1, 1, 0, 0
               //   -1, 0, 0, 0
               //   1, -1, 0, 0
               //   0, -1, 0, 0
               //   -1, -1, 0, 0

               return outCol;
    }
use depth extent map
float4 ps_LightPassPDisk12RandRotPCFCondEdgeDepthExtent(
            float3 oTex0 : TEXCOORD0,           // normal in world space
            float4 oTex1 : TEXCOORD1,           // shadow map tex coords
            float3 oTex2 : TEXCOORD2,
            float2 vPos : VPOS )                // world space light vector (not normalized
                        : COLOR0
{
            projCoords.xyz = oTex1 / oTex1.w;
            projCoords.w = 0;
            lightVal = ComputeLighting(oTex1, dist, oTex2, oTex0 );
            if( dot(lightVal, float3(1, 1, 1) ) == 0 )
            {
                        return 0;
            }
            else
            {
                        projCoords.w = g_fEdgeMaskMipLevel - 1;          // going up 1 miplevel

                        edgeValMinMax = tex2Dlod( EdgeMipPointSampler, projCoords ).rg;
                        if( (edgeValMinMax.r > projCoords.z ) || (edgeValMinMax.g < projCoords.z ) )
                        {
                                    // simple shadow map test
                        }
                        else
                        {
                                    // complex processing. ex) PCF 12taps
                        }
            }
}
Computation Masking and Edge
Dilation Using Mipchain Generation
 mipchain을 생성하고 확장하려는 edge 픽셀에 맞게
 miplevel을 설정한다.

Depth-Extent Propagation for
Computation Masking
 3x3의 min, max depth값을 기록해 depth extent map
 을 만들고 projection된 shadow map 텍스쳐 z좌표와
 비교해 min, max 범위 안이면 복잡한 연산을 한다.
결론
최대 3배까지 성능 향상.
 edge map, mipmap 을 생성하더라도 부분적으로만 많
 은 tap의 PCF를 거는 게 싸다는 결롞

Image-processing 연산.
 standard shadow mapping 알고리즘을 사용.
 추가적인 geometry 정보가 필요 없다.

More Related Content

What's hot

Deferred Shading
Deferred ShadingDeferred Shading
Deferred Shading
종빈 오
 
게임에서 사용할 수 있는 포물선 운동
게임에서 사용할 수 있는 포물선 운동게임에서 사용할 수 있는 포물선 운동
게임에서 사용할 수 있는 포물선 운동
세민 이
 
13장 연산자 오버로딩
13장 연산자 오버로딩13장 연산자 오버로딩
13장 연산자 오버로딩
유석 남
 
[GEG1] 3.volumetric representation of virtual environments
[GEG1] 3.volumetric representation of virtual environments[GEG1] 3.volumetric representation of virtual environments
[GEG1] 3.volumetric representation of virtual environments
종빈 오
 
[1106 조진현] if you( batch rendering )
[1106 조진현] if you( batch rendering )[1106 조진현] if you( batch rendering )
[1106 조진현] if you( batch rendering )
진현 조
 
어플 개발자의 서버개발 삽질기
어플 개발자의 서버개발 삽질기어플 개발자의 서버개발 삽질기
어플 개발자의 서버개발 삽질기
scor7910
 
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
종빈 오
 
Wpf3 D 기초부터 활용까지
Wpf3 D 기초부터 활용까지Wpf3 D 기초부터 활용까지
Wpf3 D 기초부터 활용까지
guestf0843c
 
2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdf2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdf
kd19h
 
Pyconkr2019 features for using python like matlab
Pyconkr2019 features for using python like matlabPyconkr2019 features for using python like matlab
Pyconkr2019 features for using python like matlab
Intae Cho
 

What's hot (20)

Deferred Shading
Deferred ShadingDeferred Shading
Deferred Shading
 
Light in screen_space(Light Pre Pass)
Light in screen_space(Light Pre Pass)Light in screen_space(Light Pre Pass)
Light in screen_space(Light Pre Pass)
 
Unity Surface Shader for Artist 03
Unity Surface Shader for Artist 03Unity Surface Shader for Artist 03
Unity Surface Shader for Artist 03
 
게임에서 사용할 수 있는 포물선 운동
게임에서 사용할 수 있는 포물선 운동게임에서 사용할 수 있는 포물선 운동
게임에서 사용할 수 있는 포물선 운동
 
Effective Python, Clean Code
Effective Python, Clean CodeEffective Python, Clean Code
Effective Python, Clean Code
 
[신경망기초] 퍼셉트론구현
[신경망기초] 퍼셉트론구현[신경망기초] 퍼셉트론구현
[신경망기초] 퍼셉트론구현
 
13장 연산자 오버로딩
13장 연산자 오버로딩13장 연산자 오버로딩
13장 연산자 오버로딩
 
Rendering realistic Ice objects
Rendering realistic Ice objectsRendering realistic Ice objects
Rendering realistic Ice objects
 
[GEG1] 3.volumetric representation of virtual environments
[GEG1] 3.volumetric representation of virtual environments[GEG1] 3.volumetric representation of virtual environments
[GEG1] 3.volumetric representation of virtual environments
 
GPU를 위한 병렬 음원 방향 추정 알고리즘
GPU를 위한 병렬 음원 방향 추정 알고리즘GPU를 위한 병렬 음원 방향 추정 알고리즘
GPU를 위한 병렬 음원 방향 추정 알고리즘
 
[1106 조진현] if you( batch rendering )
[1106 조진현] if you( batch rendering )[1106 조진현] if you( batch rendering )
[1106 조진현] if you( batch rendering )
 
Picking
PickingPicking
Picking
 
어플 개발자의 서버개발 삽질기
어플 개발자의 서버개발 삽질기어플 개발자의 서버개발 삽질기
어플 개발자의 서버개발 삽질기
 
Doing math with python.ch05
Doing math with python.ch05Doing math with python.ch05
Doing math with python.ch05
 
Doing mathwithpython.ch02
Doing mathwithpython.ch02Doing mathwithpython.ch02
Doing mathwithpython.ch02
 
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
[GPU Gems3] Chapter 28. Practical Post Process Depth Of Field
 
Wpf3 D 기초부터 활용까지
Wpf3 D 기초부터 활용까지Wpf3 D 기초부터 활용까지
Wpf3 D 기초부터 활용까지
 
2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdf2012 Dm A0 04 Pdf
2012 Dm A0 04 Pdf
 
Pyconkr2019 features for using python like matlab
Pyconkr2019 features for using python like matlabPyconkr2019 features for using python like matlab
Pyconkr2019 features for using python like matlab
 
2017 cupc solution
2017 cupc solution2017 cupc solution
2017 cupc solution
 

Viewers also liked (8)

클로져 소개 강의 (한국정보통신산업노동조합)
클로져 소개 강의 (한국정보통신산업노동조합)클로져 소개 강의 (한국정보통신산업노동조합)
클로져 소개 강의 (한국정보통신산업노동조합)
 
[Windows via c/c++] 4장 프로세스
[Windows via c/c++] 4장 프로세스[Windows via c/c++] 4장 프로세스
[Windows via c/c++] 4장 프로세스
 
Multithread design pattern
Multithread design patternMultithread design pattern
Multithread design pattern
 
내가 본 미드 이야기
내가 본 미드 이야기내가 본 미드 이야기
내가 본 미드 이야기
 
페리 수열(Farey sequence)
페리 수열(Farey sequence)페리 수열(Farey sequence)
페리 수열(Farey sequence)
 
적당한 스터디 발표자료 만들기 2.0
적당한 스터디 발표자료 만들기 2.0적당한 스터디 발표자료 만들기 2.0
적당한 스터디 발표자료 만들기 2.0
 
트위터 봇 개발 후기
트위터 봇 개발 후기트위터 봇 개발 후기
트위터 봇 개발 후기
 
[NDC12] 게임 물리 엔진의 내부 동작 원리 이해
[NDC12] 게임 물리 엔진의 내부 동작 원리 이해[NDC12] 게임 물리 엔진의 내부 동작 원리 이해
[NDC12] 게임 물리 엔진의 내부 동작 원리 이해
 

Similar to [ShaderX5] 4.4 Edge Masking and Per-Texel Depth Extent Propagation For Computation Culling During Shadow Mapping.

Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
Ndc2010 전형규   마비노기2 캐릭터 렌더링 기술Ndc2010 전형규   마비노기2 캐릭터 렌더링 기술
Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
henjeon
 
[0312 조진현] good bye dx9
[0312 조진현] good bye dx9[0312 조진현] good bye dx9
[0312 조진현] good bye dx9
진현 조
 
[0326 박민근] deferred shading
[0326 박민근] deferred shading[0326 박민근] deferred shading
[0326 박민근] deferred shading
MinGeun Park
 
12.05.26 roam algorithm
12.05.26 roam algorithm12.05.26 roam algorithm
12.05.26 roam algorithm
준섭 김
 

Similar to [ShaderX5] 4.4 Edge Masking and Per-Texel Depth Extent Propagation For Computation Culling During Shadow Mapping. (20)

Implements Cascaded Shadow Maps with using Texture Array
Implements Cascaded Shadow Maps with using Texture ArrayImplements Cascaded Shadow Maps with using Texture Array
Implements Cascaded Shadow Maps with using Texture Array
 
Volumetric Fog
Volumetric FogVolumetric Fog
Volumetric Fog
 
NDC11_슈퍼클래스
NDC11_슈퍼클래스NDC11_슈퍼클래스
NDC11_슈퍼클래스
 
Digit recognizer
Digit recognizerDigit recognizer
Digit recognizer
 
Reflective Shadow Maps
Reflective Shadow MapsReflective Shadow Maps
Reflective Shadow Maps
 
2012 Dm 07
2012 Dm 072012 Dm 07
2012 Dm 07
 
Cnn 발표자료
Cnn 발표자료Cnn 발표자료
Cnn 발표자료
 
Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
Ndc2010 전형규   마비노기2 캐릭터 렌더링 기술Ndc2010 전형규   마비노기2 캐릭터 렌더링 기술
Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
 
Computational Complexity
Computational ComplexityComputational Complexity
Computational Complexity
 
3ds maxscript 튜토리얼_20151206_서진택
3ds maxscript 튜토리얼_20151206_서진택3ds maxscript 튜토리얼_20151206_서진택
3ds maxscript 튜토리얼_20151206_서진택
 
2.supervised learning(epoch#2)-3
2.supervised learning(epoch#2)-32.supervised learning(epoch#2)-3
2.supervised learning(epoch#2)-3
 
[0312 조진현] good bye dx9
[0312 조진현] good bye dx9[0312 조진현] good bye dx9
[0312 조진현] good bye dx9
 
Python의 계산성능 향상을 위해 Fortran, C, CUDA-C, OpenCL-C 코드들과 연동하기
Python의 계산성능 향상을 위해 Fortran, C, CUDA-C, OpenCL-C 코드들과 연동하기Python의 계산성능 향상을 위해 Fortran, C, CUDA-C, OpenCL-C 코드들과 연동하기
Python의 계산성능 향상을 위해 Fortran, C, CUDA-C, OpenCL-C 코드들과 연동하기
 
Cheap realisticskinshading kor
Cheap realisticskinshading korCheap realisticskinshading kor
Cheap realisticskinshading kor
 
Mlp logical input pattern classfication report doc
Mlp logical input pattern classfication report docMlp logical input pattern classfication report doc
Mlp logical input pattern classfication report doc
 
[0326 박민근] deferred shading
[0326 박민근] deferred shading[0326 박민근] deferred shading
[0326 박민근] deferred shading
 
딥러닝을 위한 Tensor flow(skt academy)
딥러닝을 위한 Tensor flow(skt academy)딥러닝을 위한 Tensor flow(skt academy)
딥러닝을 위한 Tensor flow(skt academy)
 
12.05.26 roam algorithm
12.05.26 roam algorithm12.05.26 roam algorithm
12.05.26 roam algorithm
 
밑바닥부터 시작하는 딥러닝_신경망학습
밑바닥부터 시작하는 딥러닝_신경망학습밑바닥부터 시작하는 딥러닝_신경망학습
밑바닥부터 시작하는 딥러닝_신경망학습
 
Unity Surface Shader for Artist 01
Unity Surface Shader for Artist 01Unity Surface Shader for Artist 01
Unity Surface Shader for Artist 01
 

More from 종빈 오

비트 경제와 공짜
비트 경제와 공짜비트 경제와 공짜
비트 경제와 공짜
종빈 오
 
Intrusive data structure 소개
Intrusive data structure 소개Intrusive data structure 소개
Intrusive data structure 소개
종빈 오
 
2011 아꿈사 오전반 포스트모템
2011 아꿈사 오전반 포스트모템2011 아꿈사 오전반 포스트모템
2011 아꿈사 오전반 포스트모템
종빈 오
 
[프로젝트가 서쪽으로 간 까닭은] chap 17, 18, 26, 33, 81
[프로젝트가 서쪽으로 간 까닭은] chap 17, 18, 26, 33, 81[프로젝트가 서쪽으로 간 까닭은] chap 17, 18, 26, 33, 81
[프로젝트가 서쪽으로 간 까닭은] chap 17, 18, 26, 33, 81
종빈 오
 
넘쳐나는 정보 소화 노하우
넘쳐나는 정보 소화 노하우넘쳐나는 정보 소화 노하우
넘쳐나는 정보 소화 노하우
종빈 오
 
[Domain driven design] 17장 전략의 종합
[Domain driven design] 17장 전략의 종합[Domain driven design] 17장 전략의 종합
[Domain driven design] 17장 전략의 종합
종빈 오
 
LevelDB 간단한 소개
LevelDB 간단한 소개LevelDB 간단한 소개
LevelDB 간단한 소개
종빈 오
 
[GEG1] 2.the game asset pipeline
[GEG1] 2.the game asset pipeline[GEG1] 2.the game asset pipeline
[GEG1] 2.the game asset pipeline
종빈 오
 
[TAOCP] 2.5 동적인 저장소 할당
[TAOCP] 2.5 동적인 저장소 할당[TAOCP] 2.5 동적인 저장소 할당
[TAOCP] 2.5 동적인 저장소 할당
종빈 오
 
[GEG1] 24. key value dictionary
[GEG1] 24. key value dictionary[GEG1] 24. key value dictionary
[GEG1] 24. key value dictionary
종빈 오
 
[TAOCP] 2.2.3 연결된 할당 - 위상정렬
[TAOCP] 2.2.3 연결된 할당 - 위상정렬[TAOCP] 2.2.3 연결된 할당 - 위상정렬
[TAOCP] 2.2.3 연결된 할당 - 위상정렬
종빈 오
 
[TAOCP] 1.3.1 MIX 설명
[TAOCP] 1.3.1 MIX 설명[TAOCP] 1.3.1 MIX 설명
[TAOCP] 1.3.1 MIX 설명
종빈 오
 
[GEG1] 10.camera-centric engine design for multithreaded rendering
[GEG1] 10.camera-centric engine design for multithreaded rendering[GEG1] 10.camera-centric engine design for multithreaded rendering
[GEG1] 10.camera-centric engine design for multithreaded rendering
종빈 오
 
[TAOCP] 1.3.1 MIX 설명, 짝수 연습문제 풀이
[TAOCP] 1.3.1 MIX 설명, 짝수 연습문제 풀이[TAOCP] 1.3.1 MIX 설명, 짝수 연습문제 풀이
[TAOCP] 1.3.1 MIX 설명, 짝수 연습문제 풀이
종빈 오
 
[TAOCP] 1.2.1 수학적 귀납법
[TAOCP] 1.2.1 수학적 귀납법[TAOCP] 1.2.1 수학적 귀납법
[TAOCP] 1.2.1 수학적 귀납법
종빈 오
 
[shaderx7] 8.1 Cross-Platform Rendering Thread : Design and Implementation
[shaderx7] 8.1 Cross-Platform Rendering Thread : Design and Implementation	[shaderx7] 8.1 Cross-Platform Rendering Thread : Design and Implementation
[shaderx7] 8.1 Cross-Platform Rendering Thread : Design and Implementation
종빈 오
 
2010 아꿈사 오전반 포스트모템
2010 아꿈사 오전반 포스트모템2010 아꿈사 오전반 포스트모템
2010 아꿈사 오전반 포스트모템
종빈 오
 
[shaderx6]8.2 3d engine tools with c++cli
[shaderx6]8.2 3d engine tools with c++cli[shaderx6]8.2 3d engine tools with c++cli
[shaderx6]8.2 3d engine tools with c++cli
종빈 오
 
ManagingHumans/chap1~6
ManagingHumans/chap1~6ManagingHumans/chap1~6
ManagingHumans/chap1~6
종빈 오
 
아꿈사 매니저 인사
아꿈사 매니저 인사아꿈사 매니저 인사
아꿈사 매니저 인사
종빈 오
 

More from 종빈 오 (20)

비트 경제와 공짜
비트 경제와 공짜비트 경제와 공짜
비트 경제와 공짜
 
Intrusive data structure 소개
Intrusive data structure 소개Intrusive data structure 소개
Intrusive data structure 소개
 
2011 아꿈사 오전반 포스트모템
2011 아꿈사 오전반 포스트모템2011 아꿈사 오전반 포스트모템
2011 아꿈사 오전반 포스트모템
 
[프로젝트가 서쪽으로 간 까닭은] chap 17, 18, 26, 33, 81
[프로젝트가 서쪽으로 간 까닭은] chap 17, 18, 26, 33, 81[프로젝트가 서쪽으로 간 까닭은] chap 17, 18, 26, 33, 81
[프로젝트가 서쪽으로 간 까닭은] chap 17, 18, 26, 33, 81
 
넘쳐나는 정보 소화 노하우
넘쳐나는 정보 소화 노하우넘쳐나는 정보 소화 노하우
넘쳐나는 정보 소화 노하우
 
[Domain driven design] 17장 전략의 종합
[Domain driven design] 17장 전략의 종합[Domain driven design] 17장 전략의 종합
[Domain driven design] 17장 전략의 종합
 
LevelDB 간단한 소개
LevelDB 간단한 소개LevelDB 간단한 소개
LevelDB 간단한 소개
 
[GEG1] 2.the game asset pipeline
[GEG1] 2.the game asset pipeline[GEG1] 2.the game asset pipeline
[GEG1] 2.the game asset pipeline
 
[TAOCP] 2.5 동적인 저장소 할당
[TAOCP] 2.5 동적인 저장소 할당[TAOCP] 2.5 동적인 저장소 할당
[TAOCP] 2.5 동적인 저장소 할당
 
[GEG1] 24. key value dictionary
[GEG1] 24. key value dictionary[GEG1] 24. key value dictionary
[GEG1] 24. key value dictionary
 
[TAOCP] 2.2.3 연결된 할당 - 위상정렬
[TAOCP] 2.2.3 연결된 할당 - 위상정렬[TAOCP] 2.2.3 연결된 할당 - 위상정렬
[TAOCP] 2.2.3 연결된 할당 - 위상정렬
 
[TAOCP] 1.3.1 MIX 설명
[TAOCP] 1.3.1 MIX 설명[TAOCP] 1.3.1 MIX 설명
[TAOCP] 1.3.1 MIX 설명
 
[GEG1] 10.camera-centric engine design for multithreaded rendering
[GEG1] 10.camera-centric engine design for multithreaded rendering[GEG1] 10.camera-centric engine design for multithreaded rendering
[GEG1] 10.camera-centric engine design for multithreaded rendering
 
[TAOCP] 1.3.1 MIX 설명, 짝수 연습문제 풀이
[TAOCP] 1.3.1 MIX 설명, 짝수 연습문제 풀이[TAOCP] 1.3.1 MIX 설명, 짝수 연습문제 풀이
[TAOCP] 1.3.1 MIX 설명, 짝수 연습문제 풀이
 
[TAOCP] 1.2.1 수학적 귀납법
[TAOCP] 1.2.1 수학적 귀납법[TAOCP] 1.2.1 수학적 귀납법
[TAOCP] 1.2.1 수학적 귀납법
 
[shaderx7] 8.1 Cross-Platform Rendering Thread : Design and Implementation
[shaderx7] 8.1 Cross-Platform Rendering Thread : Design and Implementation	[shaderx7] 8.1 Cross-Platform Rendering Thread : Design and Implementation
[shaderx7] 8.1 Cross-Platform Rendering Thread : Design and Implementation
 
2010 아꿈사 오전반 포스트모템
2010 아꿈사 오전반 포스트모템2010 아꿈사 오전반 포스트모템
2010 아꿈사 오전반 포스트모템
 
[shaderx6]8.2 3d engine tools with c++cli
[shaderx6]8.2 3d engine tools with c++cli[shaderx6]8.2 3d engine tools with c++cli
[shaderx6]8.2 3d engine tools with c++cli
 
ManagingHumans/chap1~6
ManagingHumans/chap1~6ManagingHumans/chap1~6
ManagingHumans/chap1~6
 
아꿈사 매니저 인사
아꿈사 매니저 인사아꿈사 매니저 인사
아꿈사 매니저 인사
 

Recently uploaded

Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)
Wonjun Hwang
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)
Wonjun Hwang
 

Recently uploaded (6)

Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)
 
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)
 

[ShaderX5] 4.4 Edge Masking and Per-Texel Depth Extent Propagation For Computation Culling During Shadow Mapping.

  • 1. Edge Masking and Per-Texel Depth Extent Propagation For Computation Culling During Shadow Mapping http://ohyecloudy.com http://cafe.naver.com/shader.cafe 2009.06.08
  • 2. 개요 어떻게 하면 그림자 aliasing을 줄일 수 있을까? 어떻게 하면 shadow map을 잘 만들까 (X) shadow map 후처리를 할 수 있는 영역을 어떻게 하면 잘 찾을 수 있을까 (O)
  • 3. 그림자 경계 영역 : anti-aliasing을 위해 더 많은 texture fetch와 processing이 필요한 부분
  • 4. 계산이 더 필요한 그림자 경계 영역을 구 하는 두 가지 방법 소개. 이렇게 구한 영역만 anti-aliasing을 줄 이기 위한 복잡한 연산을 한다. SM 3.0 필요 loop, dynamic flow control 등 제대로 된 flow-control을 사용할 수 있다.
  • 5. Shadow map Edge mask map edge dilation or depth extent propagation Computation mask map
  • 6. Computation Masking and Edge Dilation Using Mipchain Generation Depth-Extent Propagation for Computation Masking
  • 7. graphics hardware에 최적화된 간단한 방법. edge mask로부터 mipchain을 생성한 다. shadow mask의 효과적인 근사 확장 8 pixel로 확장하고 싶다면 miplevel을 3.
  • 8. edge pixel 과 nonedge pixel 을 구분 할 threshold 필요. highest-resolution miplevel 의 edge filter 결과 값. bilinear filtering을 사용 2x2 box filtering을 사용하면 mip level이 올라갈수록 모 든 방향으로 확장되는게 아니라 한쪽으로 확장되는 경우 가 발생.
  • 9. Computation Masking and Edge Dilation Using Mipchain Generation mipchain을 생성하고 확장하려는 edge 픽셀에 맞게 miplevel을 설정한다. Depth-Extent Propagation for Computation Masking
  • 10. depth extent map 확장된 edge mask 대신에 light로부터 min, max 거리 사용. edge-filtered shadow map 사용
  • 11. shadow map 텍스쳐 좌표가 주어 졌을때(확장된 edge 영역), z 좌표가 min, max 사이일 때만 복잡한 연산 수행. edge 9 점에서 min, max 값을 뽑아서 저장 edge가 아니므로 min = 1, max = 0 으로 저장
  • 12. float4 ps_EdgeMapRGMinMax( float2 oTex : TEXCOORD0 ) : COLOR0 { float4 neighborOffsets[4] = { { 1.0, 0.0, 0, 0 }, {-1.0, 0.0, 0, 0 }, { 0.0, 1.0, 0, 0 }, { 0.0,-1.0, 0, 0 } }; float centerTapDepth = tex2D( ShadowSampler, oTex ).r; for( int i=0; i< 4; i++ ) { currTapDepth = tex2D( ShadowSampler, oTex+(g_vFullTexelOffset*neighborOffsets[i]) ).r; depthDiff = abs( centerTapDepth - currTapDepth ); if( depthDiff > g_fMinEdgeDelta ) { furthestTapDepth = max( currTapDepth, centerTapDepth ); furthestTepDepthMin = min( furthestTepDepthMin, furthestTapDepth ); furthestTepDepthMax = max( furthestTepDepthMax, furthestTapDepth ); } } outColor.r = furthestTapDepthMin; outColor.g = furthestTapDepthMax; return outColor; }
  • 13. Mipchain min, max 때문에 filtering으로 생성(X). PS를 만들어서 생성한다. float4 ps_MipLevel3x3MinMaxRG( float4 oTex0 : TEXCOORD0, float4 oFullTexelOffset : TEXCOORD1 ) : COLOR0 { float4 tapOffset = oFullTexelOffset; outCol.rg = tex2Dlod( ShadowMipPointSampler, oTex0 ).rg; // 1, 1, 0, 0 tapVals = tex2Dlod( ShadowMipPointSampler, oTex0 + ( tapOffset * float4(1, 1, 0, 0) ) ).rg; outCol.r = min( outCol.r, tapVals.r ); outCol.g = max( outCol.g, tapVals.g ); // 0, 1, 0, 0 // 1, 0, 0, 0 // -1, 1, 0, 0 // -1, 0, 0, 0 // 1, -1, 0, 0 // 0, -1, 0, 0 // -1, -1, 0, 0 return outCol; }
  • 14. use depth extent map float4 ps_LightPassPDisk12RandRotPCFCondEdgeDepthExtent( float3 oTex0 : TEXCOORD0, // normal in world space float4 oTex1 : TEXCOORD1, // shadow map tex coords float3 oTex2 : TEXCOORD2, float2 vPos : VPOS ) // world space light vector (not normalized : COLOR0 { projCoords.xyz = oTex1 / oTex1.w; projCoords.w = 0; lightVal = ComputeLighting(oTex1, dist, oTex2, oTex0 ); if( dot(lightVal, float3(1, 1, 1) ) == 0 ) { return 0; } else { projCoords.w = g_fEdgeMaskMipLevel - 1; // going up 1 miplevel edgeValMinMax = tex2Dlod( EdgeMipPointSampler, projCoords ).rg; if( (edgeValMinMax.r > projCoords.z ) || (edgeValMinMax.g < projCoords.z ) ) { // simple shadow map test } else { // complex processing. ex) PCF 12taps } } }
  • 15. Computation Masking and Edge Dilation Using Mipchain Generation mipchain을 생성하고 확장하려는 edge 픽셀에 맞게 miplevel을 설정한다. Depth-Extent Propagation for Computation Masking 3x3의 min, max depth값을 기록해 depth extent map 을 만들고 projection된 shadow map 텍스쳐 z좌표와 비교해 min, max 범위 안이면 복잡한 연산을 한다.
  • 16. 결론 최대 3배까지 성능 향상. edge map, mipmap 을 생성하더라도 부분적으로만 많 은 tap의 PCF를 거는 게 싸다는 결롞 Image-processing 연산. standard shadow mapping 알고리즘을 사용. 추가적인 geometry 정보가 필요 없다.