Presentation is loading. Please wait.

Presentation is loading. Please wait.

Real-time Shading with Filtered Importance Sampling

Similar presentations

Presentation on theme: "Real-time Shading with Filtered Importance Sampling"— Presentation transcript:

1 Real-time Shading with Filtered Importance Sampling
Mark Colbert University of Central Florida Jaroslav Křivánek Czech Technical University in Prague

2 Motivation Dynamic BRDF and lighting Applications
Material design Gaming Production pipeline friendly Single GPU shader No precomputation Minimal code base Solution that can be put into a game engine or Renderman

3 Demo

4 Our Approach BRDF proportional sampling Environment map filtering

5 Related Work A Unified Approach to Prefiltered Environment Maps [ Kautz et al ] Efficient Rendering of Spatial Bi-directional Reflectance Distribution Functions [ McAllister et al ] Efficient Reflectance and Visibility Approximations for Environment Map Rendering [ Green et al ] Interactive Illumination with Coherent Shadow Maps [ Ritschel et al ] Kautz et al. - Providing a good review of prefiltering techniques McAllister et al. – Demonstrates SBRDFs on GPU novel MIP-map Green et al. – Prefilter Gaussians for glossy materials (EG) Ritschel et al. – Importance sampling on GPU for visiblity (EGSR)

6 Illumination Integral
Ignores visibility [ Kozlowski and Kautz 2007 ] Computationally expensive Explain in terms of the equation components Li Incoming Radiance (Environment Map) f Material Function (BRDF) Angle between normal and incoming direction

7 Importance Sampling Choose a few random samples
Select according to the BRDF PDF – guides

8 Importance Sampling Result
40 samples per pixel

9 Random Numbers on the GPU
Relatively expensive Random numbers per pixel (computation) Random number textures (memory/indirection) Quasi-random sequence Good sample distribution (no clumping) Use same sequence for each pixel

10 Same Sequence Result 40 samples per pixel

11 Filtered Importance Sampling
Filter environment map between samples over hemisphere Samples distributed by the BRDF Support approximately equivalent to: Add omega being proportional to this thing N Number of samples p Probability density function

12 Filtering Use MIP-maps Level proportional to log of filter size
Spherical Harmonics diffuse component [Ramamoorthi and Hanrahan 2001]

13 Implementation Auto-generated MIP-map Dual paraboloids
Single GPU Shader Sum together filtered samples

14 Results Sphere – Grace Probe
Stochastic No Filtering Our Result Reference

15 Results Bunny – Ennis Probe
Stochastic No Filtering Our Result Reference

16 Approximations Constant BRDF across filter Isotropic filter shape
Tri-linear filtering

17 RMS Error Phong Reflection - Ennis Light Probe n=10 n=100 n=1000
TODO: Get from MATLAB Maybe show reference image? Make sure to mention the RMS error as a function of n n=1000

18 Performance 512x512 Sphere No portion of the algorithm is ran on the CPU From 7800 to 8800 SLI: 8.4x 40 spp From 7800 to : 5.75x 40 spp

19 Conclusions Real-time glossy surface reflections
Signal Processing Theory Practical Affords new interfaces For more information: GPU Gems 3 Download the code now!

20 Questions

21 Additional Slides

22 Performance From 7800 to 8800 SLI: 8.4x faster
From 7800 to : 5.75x faster

23 Which distribution? Product of lighting and BRDF Lighting BRDF
Requires bookkeeping Too expensive Lighting BRDF Sample-Importance Resample (SIR) Lighting – already know BRDF is higher frequency, so….

24 Which distribution? Product of lighting and BRDF Lighting BRDF
Too many samples for glossy surfaces BRDF Sample-Importance Resample (SIR) Lighting – already know BRDF is higher frequency, so….

25 Which distribution? Product of lighting and BRDF Lighting BRDF
Computationally efficient Sample-Importance Resample (SIR) Lighting – already know BRDF is higher frequency, so….

26 Environment Mapping Dual Paraboloid Error Support Region
Use because cube maps cause seams artifacts when using MIP-maps Support Region

27 Environment Mapping Cube Maps Low distortion Accelerated by GPU
Decimation/reconstruction filters non-spherical Introduces Seams Decimation/reconstruction is non-spherical (i.e. per face) causing filter region to

28 Environment Mapping Latitude/Longitude Too much distortion at poles
Makes rate of change from spherical to image vary greatly as a distance from the pole

29 Measured BRDF Data Fast primitive distribution for illustration [ Secord et al ] Efficient BRDF importance sampling using a factored representation [ Lawrence et al ] Probability Trees [ McCool and Harwood 1997 ]

30 PDF-Proportional Samples
Importance Sampling Random Samples on Unit Square PDF-Proportional Samples on Hemisphere 1 PDF Mapping TODO: Add animation Random values on unit square 1

31 Pseudocode float4 FilteredIS(float3 viewing : TEXCOORD1
uniform sampler2D env) : COLOR { float4 c = 0; // sample loop for (int k=0; k < N; k++) { float2 xi = quasi_random_seq(k); float3 u = sample_material(xi); float pdf = p(u, viewing); float lod = compute_lod(u, pdf); float3 L = tex2Dlod(env,float4(u, lod)); c += L*f(u,viewing)/pdf; } return c/N;

32 Filter Support Ideal Isotropic approximation
Assume sample points are perfectly stratified Implies area of 1 sample = 1 / N Use Jacobian approximation for warping function (Inverted PDF) Support region of sample  1 / p(i, o) N TODO: Convert text to equations Mention: Ideal = Support region between each sample Jacobian provides a rate of change from one domain to another Here we need to find the rate of change from the nearly stratified domain of the unit square (approximated by 1/N) to the BRDF-proportional domain

33 Ideal Sample Filter Design
h – Filter function More expensive than illumination integral TODO: Change color of BRDF

34 Approximate Sample Filter
Estimate for sample BRDF  PDF PDF is normalized BRDF Near constant over single sample Low frequency cosine approximation Use multiple samples to estimate effect Filter independent of BRDF and cosine

Download ppt "Real-time Shading with Filtered Importance Sampling"

Similar presentations

Ads by Google