SlideShare a Scribd company logo
Interactive Refractions and Caustics  Using Image-Space Techniques Shader Study  (http://cafe.naver.com/shader.cafe) Codevania  (http://codevania.blogspot.com)
Reflection… Refraction… Caustic…
 
Goal is…
Table of Contents Approximate, Image-Space Refraction Refraction Algorithm Approximating Distance Approximating Surface Normal Fixing Problem Cases Putting it Together Approximate, Image-Space Caustics Caustics Altorithm Rendering From the Light Rendering the Caustic Map Applying the Caustic Map Putting it Together Samples and Discussion Conclusion
Approximate, Image-Space Refraction Aim to solve problem of  previous GPU-based refraction technique The limitation to refract  through only a single interface -_-!? ^-^♬
Approximate, Image-Space Refraction The observation underlying our approach Find the location of the initial intersection Shader can compute a refraction direction Using an image & approximates the location
Approximate, Image-Space Refraction The observation underlying our approach Find the location of the initial intersection With scene geometry Shader can compute a refraction direction Once the refracted direction is known Problem is reduced Finding the 2 nd  refraction -> question of distance Namely, how far the 2 nd  surface is located Along what? The refracted ray! Using an image & approximates the location Approximates the location of the second refraction  By using distances  Distances are easily computed on the GPU
Approximate, Image-Space Refraction The observation underlying our approach Find the location of the initial intersection Shader can compute a refraction direction Using an image & approximates the location
Refraction Algorithm The steps in Computhing a pixels color Find P 1 Find N 1  at P 1 Refract to compute T 1 Intersect the RAY(  )  to find P 2 Find N 2  at P 2 Refract to compute T 2 Intersect the RAY(  )  to find P 3 Compute shading at point P 3
Approximate Distance d 1 Identify d1 Determine dv Using Depth-Peeling If, nt > ni  T1 bends toward –N1
Approximating Surface Normal N 2 = Exactly determining N 2  proves difficult ∵ normals are associated with vertices ∵ P 2  is not exactly on the refractor’s surface Resolve by Cheap multipass approach 1 st  pass: Render back-facing surface normals To texture map Apply projection matrix to P 2 To determine texture coords Index into the texture map To find the normal N 2
Graphical Overview of Rendering Image-Space Refraction Using V, N 1     T 1
Graphical Overview of Rendering Image-Space Refraction Using d V , d N     ~d 1
Graphical Overview of Rendering Image-Space Refraction P 1  + ( ~d 1  * T 1  ) = P 2
Graphical Overview of Rendering Image-Space Refraction Using P 2,  N BACK     N 2
Graphical Overview of Rendering Image-Space Refraction Using T 1,  N 2     T 2 Using all of them    Final Scene
Fixing Problem Cases Few problems and limitations How to deal with  Total Internal Reflection (TIR) Nonconvex refractors Inaccurate ~d1
Fixing Problem Cases Total Internal Reflection (TIR)
Fixing Problem Cases Nonconvex refractors
Fixing Problem Cases Inaccurate ~d1 When ~d1 overestimates p1 May not project onto a texel(contain srf Nrm) But, occurs realatively rarely Many occurrences fall in regions of TIR Rays    Refractor’s side of(Surface Nrm ⊥ ViewDir) Construct Surface Nrm N1( ⊥ V) .
Putting it Together
Approximate, Image-Space Caustics Traditional Technique Focusing of light from a specular obj Can be interactively rendered However, limit light to a single bounce Key Idea of Our Approach Light travels multiple path in space to reach a focal region It’s visibility problem How many times a point is visible from the light Shadow mapping? No, It determines a binary visibility
Caustics Algorithm Borrows from the 2pass approach of photon mapping Idea is… 1 st Render the scene once from the light Storing where photons land 2 nd Render a second time gathering nearby photons to determine a final color Difficulties exist so far Efficiently storing and gathering the photons
Caustics Algorithm Propose adding a 3 rd  render pass Renders photons into a caustic map Caustic map counts photons
Rendering From the Light Photon Shooting Use any existing reflection or refraction technique Similar to shadow mapping Depth Map Final Photon Locations Standard Rendering From Light’s View Incident Photon Direction
Rendering Caustic Map Use photon data in vertex shader, render points at photon locations Light Space Eye Space
Applying the Caustic Map Once the caustic map has been computed rendering the scene is straightforward Render the scene normally Using your favorite technique for shdows, reflections and refraction When rendering diffuse surfaces Add the caustic contribution  to the result of each pixel How to add caustic contribution? Modulated by the material properties
Putting it Together Update Caustic map After changes  the light  scene geometry  Approach must quick enough  to run twice per frame Cause, 1 st  pass and Last Pass use this routine
Examples and Discussion
Conclusion 2 Image-Space techniques Interactive refraction through complex object Interactive caustics rendering Rely on the use of images To store intermediate values Exist typical Img-spce aliasing problem But… Not expensive to determine intersection Provide a viable quality-performance spectrum
Code snippets RenderCaustics { // create the buffers needed for refraction from light (for caustics) createRefractionBuffers // create all the necessary buffers (normal, bg geom, depth, etc) from a particular POV // draw the normals for the back side createBackSideMaps // Draw just the background geometry createOtherObjectEyeTexture // draw the caustics positions & directions info to the framebuffer DrawSceneCausticsToBuffer // Draw refractive geometry from a particular POV // store positions of final hitpoints into a secondary buffer set the eye's lookat  Draw the environment map Draw the refractor Draw the non refractive objects in the scene PerformLightSpaceGather // find caustic contribution using an image-space gather using a image from the light's POV   draw photons splats using point sprites } // Now we've got our caustic map. However, simply projecting this onto the // scene means any surface will get a caustic, whether shadowed (from the refractor) or not! // By copying the depth buffer from the background image we used above, // we can sort this out to only cast caustics onto the "frontmost" surface behind the refractor
Code snippets DrawCausticsSceneWithLightSpaceGatheredPhotons { if ( needToRerenderCaustics )   RenderCaustics // create the buffers needed for refraction from the "eye's" point of view CreateRefractionBuffersForLightSpacePhotonGather  // create all the necessary buffers (normal, bg geom, depth, etc) from a particular POV // Draw just the background geometry (MacBeth, Dragon, etc)   DrawShadowedBackgroundWithLightSpaceCaustics DrawEnvironmentMap compute the shadow map matrix index into 'light-space caustic map' displayBackGroundGeometry   // draw the normals for the back side   createBackSideMaps // draw the scene, with caustics on the background geometry, refracted thru the refractor FinalDrawWithAlreadyComputedLightSpaceGather // takes the background geometry textures // (which includes one with accumulated photon contributions)   set the eye's lookat   //Draw the (background) non refractive objects in the scene   displayLargeTextureWithDepth   // Go ahead and actually draw the refractive object   glCallList }
Graphical Overview (1) Eye-space background image without refractor (2) Eye-space background surface depth map (3) Light-space background surface depth map (4) Eye-space view of refractor's backfacing surface normals (5) Eye-space view of refractor's backfacing surface depth (6) Four frame caustic map (one frame's intensity per channel) (7) Current frame's photon buffer (i.e., the photon positions) (8) Surface normal at final photon positions (light-space) (9) Light-space depth map (a.k.a. the shadow map)
References http://www.cs.uiowa.edu/~cwyman/  ( 저자홈피 ) http://en.wikipedia.org/wiki/Caustic_(optics) http://en.wikipedia.org/wiki/Caustic_(mathematics) Refraction of Light  ( 굴절 설명과 시뮬레이터 ) Atmospheric Optics  ( 각종 광학 관련 사진들 )
Appendix Total Internal Refraction

More Related Content

PPTX
Global illumination
PDF
Introduction to Global Illumination by Aryo
PPTX
Neural Scene Representation & Rendering: Introduction to Novel View Synthesis
PPT
Paris Master Class 2011 - 04 Shadow Maps
PPTX
Massive Point Light Soft Shadows
PDF
Phong Shading over any Polygonal Surface
PPT
Shading
PPT
Build Your Own 3D Scanner: Surface Reconstruction
Global illumination
Introduction to Global Illumination by Aryo
Neural Scene Representation & Rendering: Introduction to Novel View Synthesis
Paris Master Class 2011 - 04 Shadow Maps
Massive Point Light Soft Shadows
Phong Shading over any Polygonal Surface
Shading
Build Your Own 3D Scanner: Surface Reconstruction

What's hot (20)

PPT
Advanced Lighting Techniques Dan Baker (Meltdown 2005)
PDF
Hidden Surface Removal using Z-buffer
PPT
Lighting and shading
PDF
Volumetric Lighting for Many Lights in Lords of the Fallen
PDF
CG OpenGL surface detection+illumination+rendering models-course 9
PPT
Advanced Lighting for Interactive Applications
PPT
Build Your Own 3D Scanner: Conclusion
PPT
Shadow Mapping with Today's OpenGL Hardware
PPT
Lighting and shading
PPTX
Calibrating Lighting and Materials in Far Cry 3
PDF
Structure and Motion - 3D Reconstruction of Cameras and Structure
PPT
CS 354 Lighting
PPT
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
PDF
The Real-time Volumetric Cloudscapes of Horizon Zero Dawn
PDF
APPEARANCE-BASED REPRESENTATION AND RENDERING OF CAST SHADOWS
PPTX
study Active Refocusing Of Images And Videos
PPT
Real-time Shadowing Techniques: Shadow Volumes
PDF
01 ray-optics-mm
PPT
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
PPTX
Shiny Pixels and Beyond: Real-Time Raytracing at SEED
Advanced Lighting Techniques Dan Baker (Meltdown 2005)
Hidden Surface Removal using Z-buffer
Lighting and shading
Volumetric Lighting for Many Lights in Lords of the Fallen
CG OpenGL surface detection+illumination+rendering models-course 9
Advanced Lighting for Interactive Applications
Build Your Own 3D Scanner: Conclusion
Shadow Mapping with Today's OpenGL Hardware
Lighting and shading
Calibrating Lighting and Materials in Far Cry 3
Structure and Motion - 3D Reconstruction of Cameras and Structure
CS 354 Lighting
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
The Real-time Volumetric Cloudscapes of Horizon Zero Dawn
APPEARANCE-BASED REPRESENTATION AND RENDERING OF CAST SHADOWS
study Active Refocusing Of Images And Videos
Real-time Shadowing Techniques: Shadow Volumes
01 ray-optics-mm
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
Shiny Pixels and Beyond: Real-Time Raytracing at SEED
Ad

Viewers also liked (6)

PPTX
PPTX
ARCHITECTURE HISTORY OF MALAYSIA HOUSES
PPT
Unique Space Planning concepts for Lifestyle Apartment
PPTX
Interior space
PPTX
Top 10 Persuasive techniques
PPTX
Architectural case study of Apartments
ARCHITECTURE HISTORY OF MALAYSIA HOUSES
Unique Space Planning concepts for Lifestyle Apartment
Interior space
Top 10 Persuasive techniques
Architectural case study of Apartments
Ad

Similar to Interactive Refractions And Caustics Using Image Space Techniques (20)

PDF
reflective bump environment mappings.pdf
PPTX
Real-time lightmap baking
PDF
Ray Tracing.pdf
PPTX
Around the World in 80 Shaders
PPT
Praseed Pai
PPT
PPTX
Green Custard Friday Talk 17: Ray Tracing
PDF
Deferred shading
PDF
Deferred lighting
PPT
Paris Master Class 2011 - 07 Dynamic Global Illumination
PPT
Geometry Shader-based Bump Mapping Setup
PPTX
DirectX 11 Rendering in Battlefield 3
PPT
Order Independent Transparency
PDF
Screen space reflections on Epsilon Engine
PDF
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
PDF
Interactive Volumetric Lighting Simulating Scattering and Shadowing
PDF
PDF
OpenGL Starter L02
PPT
Shadow Techniques for Real-Time and Interactive Applications
reflective bump environment mappings.pdf
Real-time lightmap baking
Ray Tracing.pdf
Around the World in 80 Shaders
Praseed Pai
Green Custard Friday Talk 17: Ray Tracing
Deferred shading
Deferred lighting
Paris Master Class 2011 - 07 Dynamic Global Illumination
Geometry Shader-based Bump Mapping Setup
DirectX 11 Rendering in Battlefield 3
Order Independent Transparency
Screen space reflections on Epsilon Engine
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
Interactive Volumetric Lighting Simulating Scattering and Shadowing
OpenGL Starter L02
Shadow Techniques for Real-Time and Interactive Applications

More from codevania (16)

PDF
14 virtual memory
PPTX
Taocp 2_4
PDF
Taocp 2_3_1
PPT
Taocp 1 2-2
PPTX
Gstar gossip
PPT
Deferred rendering transparency
PPT
테스트 자동화의 원칙
PPT
3장 자동적으로 움직이는 게임 에이전트 생성법
PPT
Spin locks 추가 자료
PPT
Texture bombing
PPT
Memory corruption stack
PPTX
Mathematical Structures for CS [Chapter3]456
PPT
Optimizing The Content Pipeline
PPT
시간 있으면 설계나 합시다
PPT
Memory Corruption Heap
PPT
Generic Refraction Simulation
14 virtual memory
Taocp 2_4
Taocp 2_3_1
Taocp 1 2-2
Gstar gossip
Deferred rendering transparency
테스트 자동화의 원칙
3장 자동적으로 움직이는 게임 에이전트 생성법
Spin locks 추가 자료
Texture bombing
Memory corruption stack
Mathematical Structures for CS [Chapter3]456
Optimizing The Content Pipeline
시간 있으면 설계나 합시다
Memory Corruption Heap
Generic Refraction Simulation

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Empathic Computing: Creating Shared Understanding
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Approach and Philosophy of On baking technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
cuic standard and advanced reporting.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Big Data Technologies - Introduction.pptx
Understanding_Digital_Forensics_Presentation.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Spectral efficient network and resource selection model in 5G networks
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Empathic Computing: Creating Shared Understanding
Unlocking AI with Model Context Protocol (MCP)
The Rise and Fall of 3GPP – Time for a Sabbatical?
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Approach and Philosophy of On baking technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Agricultural_Statistics_at_a_Glance_2022_0.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Network Security Unit 5.pdf for BCA BBA.
cuic standard and advanced reporting.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation_ Review paper, used for researhc scholars
Mobile App Security Testing_ A Comprehensive Guide.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Big Data Technologies - Introduction.pptx

Interactive Refractions And Caustics Using Image Space Techniques

  • 1. Interactive Refractions and Caustics Using Image-Space Techniques Shader Study (http://cafe.naver.com/shader.cafe) Codevania (http://codevania.blogspot.com)
  • 3.  
  • 5. Table of Contents Approximate, Image-Space Refraction Refraction Algorithm Approximating Distance Approximating Surface Normal Fixing Problem Cases Putting it Together Approximate, Image-Space Caustics Caustics Altorithm Rendering From the Light Rendering the Caustic Map Applying the Caustic Map Putting it Together Samples and Discussion Conclusion
  • 6. Approximate, Image-Space Refraction Aim to solve problem of previous GPU-based refraction technique The limitation to refract through only a single interface -_-!? ^-^♬
  • 7. Approximate, Image-Space Refraction The observation underlying our approach Find the location of the initial intersection Shader can compute a refraction direction Using an image & approximates the location
  • 8. Approximate, Image-Space Refraction The observation underlying our approach Find the location of the initial intersection With scene geometry Shader can compute a refraction direction Once the refracted direction is known Problem is reduced Finding the 2 nd refraction -> question of distance Namely, how far the 2 nd surface is located Along what? The refracted ray! Using an image & approximates the location Approximates the location of the second refraction By using distances Distances are easily computed on the GPU
  • 9. Approximate, Image-Space Refraction The observation underlying our approach Find the location of the initial intersection Shader can compute a refraction direction Using an image & approximates the location
  • 10. Refraction Algorithm The steps in Computhing a pixels color Find P 1 Find N 1 at P 1 Refract to compute T 1 Intersect the RAY( ) to find P 2 Find N 2 at P 2 Refract to compute T 2 Intersect the RAY( ) to find P 3 Compute shading at point P 3
  • 11. Approximate Distance d 1 Identify d1 Determine dv Using Depth-Peeling If, nt > ni T1 bends toward –N1
  • 12. Approximating Surface Normal N 2 = Exactly determining N 2 proves difficult ∵ normals are associated with vertices ∵ P 2 is not exactly on the refractor’s surface Resolve by Cheap multipass approach 1 st pass: Render back-facing surface normals To texture map Apply projection matrix to P 2 To determine texture coords Index into the texture map To find the normal N 2
  • 13. Graphical Overview of Rendering Image-Space Refraction Using V, N 1  T 1
  • 14. Graphical Overview of Rendering Image-Space Refraction Using d V , d N  ~d 1
  • 15. Graphical Overview of Rendering Image-Space Refraction P 1 + ( ~d 1 * T 1 ) = P 2
  • 16. Graphical Overview of Rendering Image-Space Refraction Using P 2, N BACK  N 2
  • 17. Graphical Overview of Rendering Image-Space Refraction Using T 1, N 2  T 2 Using all of them  Final Scene
  • 18. Fixing Problem Cases Few problems and limitations How to deal with Total Internal Reflection (TIR) Nonconvex refractors Inaccurate ~d1
  • 19. Fixing Problem Cases Total Internal Reflection (TIR)
  • 20. Fixing Problem Cases Nonconvex refractors
  • 21. Fixing Problem Cases Inaccurate ~d1 When ~d1 overestimates p1 May not project onto a texel(contain srf Nrm) But, occurs realatively rarely Many occurrences fall in regions of TIR Rays  Refractor’s side of(Surface Nrm ⊥ ViewDir) Construct Surface Nrm N1( ⊥ V) .
  • 23. Approximate, Image-Space Caustics Traditional Technique Focusing of light from a specular obj Can be interactively rendered However, limit light to a single bounce Key Idea of Our Approach Light travels multiple path in space to reach a focal region It’s visibility problem How many times a point is visible from the light Shadow mapping? No, It determines a binary visibility
  • 24. Caustics Algorithm Borrows from the 2pass approach of photon mapping Idea is… 1 st Render the scene once from the light Storing where photons land 2 nd Render a second time gathering nearby photons to determine a final color Difficulties exist so far Efficiently storing and gathering the photons
  • 25. Caustics Algorithm Propose adding a 3 rd render pass Renders photons into a caustic map Caustic map counts photons
  • 26. Rendering From the Light Photon Shooting Use any existing reflection or refraction technique Similar to shadow mapping Depth Map Final Photon Locations Standard Rendering From Light’s View Incident Photon Direction
  • 27. Rendering Caustic Map Use photon data in vertex shader, render points at photon locations Light Space Eye Space
  • 28. Applying the Caustic Map Once the caustic map has been computed rendering the scene is straightforward Render the scene normally Using your favorite technique for shdows, reflections and refraction When rendering diffuse surfaces Add the caustic contribution to the result of each pixel How to add caustic contribution? Modulated by the material properties
  • 29. Putting it Together Update Caustic map After changes the light scene geometry Approach must quick enough to run twice per frame Cause, 1 st pass and Last Pass use this routine
  • 31. Conclusion 2 Image-Space techniques Interactive refraction through complex object Interactive caustics rendering Rely on the use of images To store intermediate values Exist typical Img-spce aliasing problem But… Not expensive to determine intersection Provide a viable quality-performance spectrum
  • 32. Code snippets RenderCaustics { // create the buffers needed for refraction from light (for caustics) createRefractionBuffers // create all the necessary buffers (normal, bg geom, depth, etc) from a particular POV // draw the normals for the back side createBackSideMaps // Draw just the background geometry createOtherObjectEyeTexture // draw the caustics positions & directions info to the framebuffer DrawSceneCausticsToBuffer // Draw refractive geometry from a particular POV // store positions of final hitpoints into a secondary buffer set the eye's lookat Draw the environment map Draw the refractor Draw the non refractive objects in the scene PerformLightSpaceGather // find caustic contribution using an image-space gather using a image from the light's POV draw photons splats using point sprites } // Now we've got our caustic map. However, simply projecting this onto the // scene means any surface will get a caustic, whether shadowed (from the refractor) or not! // By copying the depth buffer from the background image we used above, // we can sort this out to only cast caustics onto the "frontmost" surface behind the refractor
  • 33. Code snippets DrawCausticsSceneWithLightSpaceGatheredPhotons { if ( needToRerenderCaustics ) RenderCaustics // create the buffers needed for refraction from the "eye's" point of view CreateRefractionBuffersForLightSpacePhotonGather // create all the necessary buffers (normal, bg geom, depth, etc) from a particular POV // Draw just the background geometry (MacBeth, Dragon, etc) DrawShadowedBackgroundWithLightSpaceCaustics DrawEnvironmentMap compute the shadow map matrix index into 'light-space caustic map' displayBackGroundGeometry // draw the normals for the back side createBackSideMaps // draw the scene, with caustics on the background geometry, refracted thru the refractor FinalDrawWithAlreadyComputedLightSpaceGather // takes the background geometry textures // (which includes one with accumulated photon contributions) set the eye's lookat //Draw the (background) non refractive objects in the scene displayLargeTextureWithDepth // Go ahead and actually draw the refractive object glCallList }
  • 34. Graphical Overview (1) Eye-space background image without refractor (2) Eye-space background surface depth map (3) Light-space background surface depth map (4) Eye-space view of refractor's backfacing surface normals (5) Eye-space view of refractor's backfacing surface depth (6) Four frame caustic map (one frame's intensity per channel) (7) Current frame's photon buffer (i.e., the photon positions) (8) Surface normal at final photon positions (light-space) (9) Light-space depth map (a.k.a. the shadow map)
  • 35. References http://www.cs.uiowa.edu/~cwyman/  ( 저자홈피 ) http://en.wikipedia.org/wiki/Caustic_(optics) http://en.wikipedia.org/wiki/Caustic_(mathematics) Refraction of Light  ( 굴절 설명과 시뮬레이터 ) Atmospheric Optics  ( 각종 광학 관련 사진들 )