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

Lesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation RulesLesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation RulesMatthew Leingang
 
Lesson 8: Basic Differentation Rules (slides)
Lesson 8: Basic Differentation Rules (slides)Lesson 8: Basic Differentation Rules (slides)
Lesson 8: Basic Differentation Rules (slides)Matthew Leingang
 
Derivatives Lesson Oct 14
Derivatives Lesson  Oct 14Derivatives Lesson  Oct 14
Derivatives Lesson Oct 14ingroy
 
[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)Matthew Leingang
 
Lesson 27: Evaluating Definite Integrals
Lesson 27: Evaluating Definite IntegralsLesson 27: Evaluating Definite Integrals
Lesson 27: Evaluating Definite IntegralsMatthew Leingang
 
Lesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation RulesLesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation RulesMatthew Leingang
 
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 CalculusMatthew Leingang
 
Cea0001 ppt project
Cea0001 ppt projectCea0001 ppt project
Cea0001 ppt projectcea0001
 
Lesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation RulesLesson 8: Basic Differentiation Rules
Lesson 8: Basic Differentiation RulesMatthew Leingang
 
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)Matthew Leingang
 
Approximate Integration
Approximate IntegrationApproximate Integration
Approximate IntegrationSilvius
 
Coq setoid 20110129
Coq setoid 20110129Coq setoid 20110129
Coq setoid 20110129tmiya
 
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)Matthew Leingang
 
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)Matthew Leingang
 
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종빈 오
 
openFrameworks 007 - 3D
openFrameworks 007 - 3DopenFrameworks 007 - 3D
openFrameworks 007 - 3Droxlu
 
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 9fungfung Chen
 
Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)
Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)
Shaderx5 2.6normalmappingwithoutprecomputedtangents 130318 (1)Kyuseok Hwang(allosha)
 
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksBeginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksJinTaek Seo
 
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/5Takao Wada
 
Nodebox for Data Visualization
Nodebox for Data VisualizationNodebox for Data Visualization
Nodebox for Data VisualizationLynn Cherny
 
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/5Takao Wada
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingMark Kilgard
 
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.docxgilpinleeanna
 
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 10fungfung Chen
 
Cascades Demo Secrets
Cascades Demo SecretsCascades Demo Secrets
Cascades Demo Secretsicastano
 
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 rendererDavide Pasca
 
Deep Learning for AI (2)
Deep Learning for AI (2)Deep Learning for AI (2)
Deep Learning for AI (2)Dongheon Lee
 
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_compilersComputer Science Club
 
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.60Ali Adeel
 
Modern features-part-3-software
Modern features-part-3-softwareModern features-part-3-software
Modern features-part-3-softwarezukun
 
C++totural file
C++totural fileC++totural file
C++totural filehalaisumit
 

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 종빈 오

트위터 봇 개발 후기
트위터 봇 개발 후기트위터 봇 개발 후기
트위터 봇 개발 후기종빈 오
 
적당한 스터디 발표자료 만들기 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종빈 오
 

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

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Recently uploaded (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

[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보다는 퍼포먼스