SlideShare a Scribd company logo
1 of 18
Download to read offline
SHADERX5



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

                                               2010.03.22
Supersamping?, Multisampling?
Drawbacks
Overcoming drawbacks
Implement supersamping
Implement selective supersampling
Conclusion
2x2 supersampling




• 모든 픽셀에 대해 여러 픽셀 샘플링
• 퀄리티
• 퍼포먼스
2x multisampling




• polygon edge만 여러 픽셀 샘플링
 – surface 안 쪽은 하지 않는다.
• 퍼포먼스
Supersamping?, Multisampling?
Drawbacks
Overcoming drawbacks
Implement supersamping
Implement selective supersampling
Conclusion
No selective-supersampling   selective-supersampling


• high-frequency component가 문제
  – specular highlight가 어른거리게 만든다
  – 밉맵mip-map을 사용하는 이유와 같다.
Supersamping?, Multisampling?
Drawbacks
Overcoming drawbacks
Implement supersamping
Implement selective supersampling
Conclusion
multisampling




                             supersampling




• hybrid solution
  – edge : multisampling
  – aliasing 문제가 있는 부분 : supersampling
Supersamping?, Multisampling?
Drawbacks
Overcoming drawbacks
Implement supersamping
Implement selective supersampling
Conclusion
float4 vfSum = 0.0;
for (int i = 0; i < SAMPLE_COUNT; i++)
{
  vfSum += OriginalShader(sampleCoordinate[i]);
}
return vfSum / SAMPLE_COUNT;


                    좀 더 정확하게 근사하자.
                    ddx와 ddy를 사용
A

                                                                               ddx

                                                                        ddy
                texture

                                        projection
                                                        OR               A’s ddx != B’s ddx
                                                                         A’s ddy != B’s ddy

                                                                               B
                                                                                   ddx

ddx
                                                                         ddy
Returns the partial derivative of the specified value with respect to
the screen-space x-coordinate.

ddy
Returns the partial derivative of the specified value with respect to
the screen-space y-coordinate.
const float2 fSamples[SAMPLE_COUNT] =
{
   // using a rotated grid
   float2( 0.125, 0.375),
   float2( 0.375, -0.125),
   float2(-0.125, -0.375),
   float2(-0.375, 0.125),
};

// compute gradients
float2 fDX = ddx(texCoord);
float2 fDY = ddy(texCoord);

float4 vfSum = 0.0;
for (int i = 0; i < SAMPLE_COUNT; ++i)
{
   float2 vfSampleCoord =
        texCoord + fSamples[i].x * fDX + fSamples[i].y * fDY;
   vfSum += OriginalShader(vfSampleCoord);
}

return vfSum / SAMPLE_COUNT;
Supersamping?, Multisampling?
Drawbacks
Overcoming drawbacks
Implement supersamping
Implement selective supersampling
Conclusion
float4 main(
   float2 texCoord : TEXCOORD0,
   float3 vnLight : TEXCOORD1) : COLOR
{
   // compute the gradients of the texture coordinates
   float2 fDX = ddx(texCoord);
   float2 fDY = ddy(texCoord);

    // Compute lighting
                                                                라이팅은 그냥 수행
    float3 vBase = tex2D(tBase, texCoord).rgb;
    float3 vBump = tex2D(tBump, texCoord).xyz;
    float3 vNormal = normalize(vBump*2.0 – 1.0); // [0,1] -> [-1,1]
    float3 cAmbient = 0.15 * vBase;
    float fDiffuse = saturate(dot(vLight, vNormal));

    float fSpecular =                   specular만 selective supersampling
         (SPECULAR(vNormal) +
         SPECULAR(SAMPLENORMAL( 0.25, 0.75)) +
         SPECULAR(SAMPLENORMAL(-0.25,-0.75)) +
         SPECULAR(SAMPLENORMAL(-0.75, 0.25)) +
         SPECULAR(SAMPLENORMAL( 0.75,-0.25))) / 5.0;

    return float4(cAmbient + fDiffuse * vBase + fSpecular, 0);
}

    #define SAMPLENORMAL(x, y) 
    normalize(tex2D(tBump, texCoord + (0.5*x) * fDX + (0.5*y) * fDY).xyz * 2.0 – 1.0)
// Center sample
float fSpecular = SPECULAR(vNormal);

// Compute specular gradients
float2 ds = float2(ddx(fSpecular), ddy(fSpecular));

// If it’s above the threshold, then take the other four samples too
if (dot(ds, ds) > 0.0002)
{
   fSpecular += SPECULAR(SAMPLENORMAL( 0.25, 0.75));
   fSpecular += SPECULAR(SAMPLENORMAL(-0.25,-0.75));
   fSpecular += SPECULAR(SAMPLENORMAL(-0.75, 0.25));
   fSpecular += SPECULAR(SAMPLENORMAL( 0.75,-0.25));
   fSpecular /= 5.0;
}


                         dynamic branch
                         threshold를 둬서 넘으면 supersampling
Supersamping?, Multisampling?
Drawbacks
Overcoming drawbacks
Implement supersamping
Implement selective supersampling
Conclusion
• 성능을 위해 multisampling을 쓰는 경우
  internal aliasing 문제가 발생할 수 있다.

• 발생하는 부분만 supersampling을 사용해서
  문제를 해결할 수 있다.
  – 전체 supersampling보다는 퍼포먼스
[shaderx5] 3.2 Selective Supersampling

More Related Content

What's hot

Derivatives Lesson Oct 14
Derivatives Lesson  Oct 14Derivatives Lesson  Oct 14
Derivatives Lesson Oct 14
ingroy
 
[shaderx4] 4.2 Eliminating Surface Acne with Gradient Shadow Mapping
[shaderx4] 4.2 Eliminating Surface Acne with Gradient Shadow Mapping[shaderx4] 4.2 Eliminating Surface Acne with Gradient Shadow Mapping
[shaderx4] 4.2 Eliminating Surface Acne with Gradient Shadow Mapping
종빈 오
 
Lesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of CalculusLesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of Calculus
Matthew Leingang
 
Approximate Integration
Approximate IntegrationApproximate Integration
Approximate Integration
Silvius
 
Coq setoid 20110129
Coq setoid 20110129Coq setoid 20110129
Coq setoid 20110129
tmiya
 
Lesson 8: Basic Differentiation Rules (Section 41 slides)
Lesson 8: Basic Differentiation Rules (Section 41 slides)Lesson 8: Basic Differentiation Rules (Section 41 slides)
Lesson 8: Basic Differentiation Rules (Section 41 slides)
Matthew Leingang
 

What's hot (20)

Lesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation RulesLesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation Rules
 
Lesson 8: Basic Differentation Rules (slides)
Lesson 8: Basic Differentation Rules (slides)Lesson 8: Basic Differentation Rules (slides)
Lesson 8: Basic Differentation Rules (slides)
 
Derivatives Lesson Oct 14
Derivatives Lesson  Oct 14Derivatives Lesson  Oct 14
Derivatives Lesson Oct 14
 
[shaderx4] 4.2 Eliminating Surface Acne with Gradient Shadow Mapping
[shaderx4] 4.2 Eliminating Surface Acne with Gradient Shadow Mapping[shaderx4] 4.2 Eliminating Surface Acne with Gradient Shadow Mapping
[shaderx4] 4.2 Eliminating Surface Acne with Gradient Shadow Mapping
 
Lesson 25: Evaluating Definite Integrals (slides)
Lesson 25: Evaluating Definite Integrals (slides)Lesson 25: Evaluating Definite Integrals (slides)
Lesson 25: Evaluating Definite Integrals (slides)
 
Lesson 27: Evaluating Definite Integrals
Lesson 27: Evaluating Definite IntegralsLesson 27: Evaluating Definite Integrals
Lesson 27: Evaluating Definite Integrals
 
Lesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation RulesLesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation Rules
 
Lesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of CalculusLesson 28: The Fundamental Theorem of Calculus
Lesson 28: The Fundamental Theorem of Calculus
 
Cea0001 ppt project
Cea0001 ppt projectCea0001 ppt project
Cea0001 ppt project
 
Lesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation RulesLesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation Rules
 
Lec 3-mcgregor
Lec 3-mcgregorLec 3-mcgregor
Lec 3-mcgregor
 
Lesson 18: Maximum and Minimum Values (slides)
Lesson 18: Maximum and Minimum Values (slides)Lesson 18: Maximum and Minimum Values (slides)
Lesson 18: Maximum and Minimum Values (slides)
 
Approximate Integration
Approximate IntegrationApproximate Integration
Approximate Integration
 
Integration. area undera curve
Integration. area undera curveIntegration. area undera curve
Integration. area undera curve
 
Wikiproject
WikiprojectWikiproject
Wikiproject
 
Coq setoid 20110129
Coq setoid 20110129Coq setoid 20110129
Coq setoid 20110129
 
Lesson 26: The Fundamental Theorem of Calculus (Section 4 version)
Lesson 26: The Fundamental Theorem of Calculus (Section 4 version)Lesson 26: The Fundamental Theorem of Calculus (Section 4 version)
Lesson 26: The Fundamental Theorem of Calculus (Section 4 version)
 
Rolle's Theorem
Rolle's TheoremRolle's Theorem
Rolle's Theorem
 
Lesson 26: The Fundamental Theorem of Calculus (slides)
Lesson 26: The Fundamental Theorem of Calculus (slides)Lesson 26: The Fundamental Theorem of Calculus (slides)
Lesson 26: The Fundamental Theorem of Calculus (slides)
 
Lesson 8: Basic Differentiation Rules (Section 41 slides)
Lesson 8: Basic Differentiation Rules (Section 41 slides)Lesson 8: Basic Differentiation Rules (Section 41 slides)
Lesson 8: Basic Differentiation Rules (Section 41 slides)
 

Similar to [shaderx5] 3.2 Selective Supersampling

[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
종빈 오
 
Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)
Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)
Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)
Kyuseok Hwang(allosha)
 
MTH 2001 Project 2Instructions• Each group must choos.docx
MTH 2001 Project 2Instructions• Each group must choos.docxMTH 2001 Project 2Instructions• Each group must choos.docx
MTH 2001 Project 2Instructions• Each group must choos.docx
gilpinleeanna
 
20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers
Computer Science Club
 
Modern features-part-3-software
Modern features-part-3-softwareModern features-part-3-software
Modern features-part-3-software
zukun
 
C++totural file
C++totural fileC++totural file
C++totural file
halaisumit
 

Similar to [shaderx5] 3.2 Selective Supersampling (20)

[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
[shaderx5] 4.2 Multisampling Extension for Gradient Shadow Maps
 
openFrameworks 007 - 3D
openFrameworks 007 - 3DopenFrameworks 007 - 3D
openFrameworks 007 - 3D
 
CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9
 
Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)
Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)
Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)
 
Nis differentiation1
Nis differentiation1Nis differentiation1
Nis differentiation1
 
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksBeginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
 
Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5
 
Nodebox for Data Visualization
Nodebox for Data VisualizationNodebox for Data Visualization
Nodebox for Data Visualization
 
Trident International Graphics Workshop 2014 5/5
Trident International Graphics Workshop 2014 5/5Trident International Graphics Workshop 2014 5/5
Trident International Graphics Workshop 2014 5/5
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and Culling
 
Mini-curso JavaFX Aula2
Mini-curso JavaFX Aula2Mini-curso JavaFX Aula2
Mini-curso JavaFX Aula2
 
MTH 2001 Project 2Instructions• Each group must choos.docx
MTH 2001 Project 2Instructions• Each group must choos.docxMTH 2001 Project 2Instructions• Each group must choos.docx
MTH 2001 Project 2Instructions• Each group must choos.docx
 
CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10
 
Cascades Demo Secrets
Cascades Demo SecretsCascades Demo Secrets
Cascades Demo Secrets
 
Implementing a modern, RenderMan compliant, REYES renderer
Implementing a modern, RenderMan compliant, REYES rendererImplementing a modern, RenderMan compliant, REYES renderer
Implementing a modern, RenderMan compliant, REYES renderer
 
Deep Learning for AI (2)
Deep Learning for AI (2)Deep Learning for AI (2)
Deep Learning for AI (2)
 
20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers
 
267 handout 2_partial_derivatives_v2.60
267 handout 2_partial_derivatives_v2.60267 handout 2_partial_derivatives_v2.60
267 handout 2_partial_derivatives_v2.60
 
Modern features-part-3-software
Modern features-part-3-softwareModern features-part-3-software
Modern features-part-3-software
 
C++totural file
C++totural fileC++totural file
C++totural file
 

More from 종빈 오

내가 본 미드 이야기
내가 본 미드 이야기내가 본 미드 이야기
내가 본 미드 이야기
종빈 오
 
비트 경제와 공짜
비트 경제와 공짜비트 경제와 공짜
비트 경제와 공짜
종빈 오
 
[NDC12] 게임 물리 엔진의 내부 동작 원리 이해
[NDC12] 게임 물리 엔진의 내부 동작 원리 이해[NDC12] 게임 물리 엔진의 내부 동작 원리 이해
[NDC12] 게임 물리 엔진의 내부 동작 원리 이해
종빈 오
 
[Windows via c/c++] 4장 프로세스
[Windows via c/c++] 4장 프로세스[Windows via c/c++] 4장 프로세스
[Windows via c/c++] 4장 프로세스
종빈 오
 
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
종빈 오
 
[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
종빈 오
 
넘쳐나는 정보 소화 노하우
넘쳐나는 정보 소화 노하우넘쳐나는 정보 소화 노하우
넘쳐나는 정보 소화 노하우
종빈 오
 
[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
종빈 오
 

More from 종빈 오 (20)

트위터 봇 개발 후기
트위터 봇 개발 후기트위터 봇 개발 후기
트위터 봇 개발 후기
 
적당한 스터디 발표자료 만들기 2.0
적당한 스터디 발표자료 만들기 2.0적당한 스터디 발표자료 만들기 2.0
적당한 스터디 발표자료 만들기 2.0
 
페리 수열(Farey sequence)
페리 수열(Farey sequence)페리 수열(Farey sequence)
페리 수열(Farey sequence)
 
내가 본 미드 이야기
내가 본 미드 이야기내가 본 미드 이야기
내가 본 미드 이야기
 
비트 경제와 공짜
비트 경제와 공짜비트 경제와 공짜
비트 경제와 공짜
 
[NDC12] 게임 물리 엔진의 내부 동작 원리 이해
[NDC12] 게임 물리 엔진의 내부 동작 원리 이해[NDC12] 게임 물리 엔진의 내부 동작 원리 이해
[NDC12] 게임 물리 엔진의 내부 동작 원리 이해
 
[Windows via c/c++] 4장 프로세스
[Windows via c/c++] 4장 프로세스[Windows via c/c++] 4장 프로세스
[Windows via c/c++] 4장 프로세스
 
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
 
[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
 
넘쳐나는 정보 소화 노하우
넘쳐나는 정보 소화 노하우넘쳐나는 정보 소화 노하우
넘쳐나는 정보 소화 노하우
 
[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
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

[shaderx5] 3.2 Selective Supersampling

  • 1. SHADERX5 shader study http://cafe.naver.com/shader.cafe ohyecloudy http://ohyecloudy.com 2010.03.22
  • 2. Supersamping?, Multisampling? Drawbacks Overcoming drawbacks Implement supersamping Implement selective supersampling Conclusion
  • 3. 2x2 supersampling • 모든 픽셀에 대해 여러 픽셀 샘플링 • 퀄리티 • 퍼포먼스
  • 4. 2x multisampling • polygon edge만 여러 픽셀 샘플링 – surface 안 쪽은 하지 않는다. • 퍼포먼스
  • 5. Supersamping?, Multisampling? Drawbacks Overcoming drawbacks Implement supersamping Implement selective supersampling Conclusion
  • 6. No selective-supersampling selective-supersampling • high-frequency component가 문제 – specular highlight가 어른거리게 만든다 – 밉맵mip-map을 사용하는 이유와 같다.
  • 7. Supersamping?, Multisampling? Drawbacks Overcoming drawbacks Implement supersamping Implement selective supersampling Conclusion
  • 8. multisampling supersampling • hybrid solution – edge : multisampling – aliasing 문제가 있는 부분 : supersampling
  • 9. Supersamping?, Multisampling? Drawbacks Overcoming drawbacks Implement supersamping Implement selective supersampling Conclusion
  • 10. float4 vfSum = 0.0; for (int i = 0; i < SAMPLE_COUNT; i++) { vfSum += OriginalShader(sampleCoordinate[i]); } return vfSum / SAMPLE_COUNT; 좀 더 정확하게 근사하자. ddx와 ddy를 사용
  • 11. A ddx ddy texture projection OR A’s ddx != B’s ddx A’s ddy != B’s ddy B ddx ddx ddy Returns the partial derivative of the specified value with respect to the screen-space x-coordinate. ddy Returns the partial derivative of the specified value with respect to the screen-space y-coordinate.
  • 12. const float2 fSamples[SAMPLE_COUNT] = { // using a rotated grid float2( 0.125, 0.375), float2( 0.375, -0.125), float2(-0.125, -0.375), float2(-0.375, 0.125), }; // compute gradients float2 fDX = ddx(texCoord); float2 fDY = ddy(texCoord); float4 vfSum = 0.0; for (int i = 0; i < SAMPLE_COUNT; ++i) { float2 vfSampleCoord = texCoord + fSamples[i].x * fDX + fSamples[i].y * fDY; vfSum += OriginalShader(vfSampleCoord); } return vfSum / SAMPLE_COUNT;
  • 13. Supersamping?, Multisampling? Drawbacks Overcoming drawbacks Implement supersamping Implement selective supersampling Conclusion
  • 14. float4 main( float2 texCoord : TEXCOORD0, float3 vnLight : TEXCOORD1) : COLOR { // compute the gradients of the texture coordinates float2 fDX = ddx(texCoord); float2 fDY = ddy(texCoord); // Compute lighting 라이팅은 그냥 수행 float3 vBase = tex2D(tBase, texCoord).rgb; float3 vBump = tex2D(tBump, texCoord).xyz; float3 vNormal = normalize(vBump*2.0 – 1.0); // [0,1] -> [-1,1] float3 cAmbient = 0.15 * vBase; float fDiffuse = saturate(dot(vLight, vNormal)); float fSpecular = specular만 selective supersampling (SPECULAR(vNormal) + SPECULAR(SAMPLENORMAL( 0.25, 0.75)) + SPECULAR(SAMPLENORMAL(-0.25,-0.75)) + SPECULAR(SAMPLENORMAL(-0.75, 0.25)) + SPECULAR(SAMPLENORMAL( 0.75,-0.25))) / 5.0; return float4(cAmbient + fDiffuse * vBase + fSpecular, 0); } #define SAMPLENORMAL(x, y) normalize(tex2D(tBump, texCoord + (0.5*x) * fDX + (0.5*y) * fDY).xyz * 2.0 – 1.0)
  • 15. // Center sample float fSpecular = SPECULAR(vNormal); // Compute specular gradients float2 ds = float2(ddx(fSpecular), ddy(fSpecular)); // If it’s above the threshold, then take the other four samples too if (dot(ds, ds) > 0.0002) { fSpecular += SPECULAR(SAMPLENORMAL( 0.25, 0.75)); fSpecular += SPECULAR(SAMPLENORMAL(-0.25,-0.75)); fSpecular += SPECULAR(SAMPLENORMAL(-0.75, 0.25)); fSpecular += SPECULAR(SAMPLENORMAL( 0.75,-0.25)); fSpecular /= 5.0; } dynamic branch threshold를 둬서 넘으면 supersampling
  • 16. Supersamping?, Multisampling? Drawbacks Overcoming drawbacks Implement supersamping Implement selective supersampling Conclusion
  • 17. • 성능을 위해 multisampling을 쓰는 경우 internal aliasing 문제가 발생할 수 있다. • 발생하는 부분만 supersampling을 사용해서 문제를 해결할 수 있다. – 전체 supersampling보다는 퍼포먼스