Download presentation
Presentation is loading. Please wait.
Published byKaliyah Catterall Modified over 10 years ago
1
Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Sampling Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung
2
Technische Universität München Computer Graphics Overview So far: –Image synthesis Ray tracing; models, transformations, shading & lighting, textures, acceleration Today –Aliasing and antialiasing techniques Prefiltering Supersampling Postfiltering Stochastic and adaptive sampling 2
3
Technische Universität München Computer Graphics Sampling Mathematically, point sampling using regularly spaced sample points is the multiplication of the function with a comb function 3 0 x T2T
4
Technische Universität München Computer Graphics Sampling Recall: image synthesis means point sampling of a continuous signal –Image contains samples of a continuous signal at a discrete set of positions –Pixel spacing determines the frequencies (the size of details) that can be reconstructed –Undersampling the image (taking too less samples to allow for the reconstruction of the signal from the samples) causes aliasing artifacts (alias = ghost) 4
5
Technische Universität München Computer Graphics Aliasing Original scene and luminosity (brightness) distribution along a scan line 5 5
6
Technische Universität München Computer Graphics Aliasing Point sampling the scene at pixel centers 6 6
7
Technische Universität München Computer Graphics Aliasing The rendered image 7 7
8
Technische Universität München Computer Graphics Aliasing Jagged profiles 8 8
9
Technische Universität München Computer Graphics Aliasing Loss of details 9 9
10
Technische Universität München Computer Graphics Aliasing Note: the sampling frequency decreases with increasing distance to the viewpoint 10 d0d1d2 d3 viewpoint
11
Technische Universität München Computer Graphics Aliasing With increasing distance to the viewer and slope of the surface, an ever larger surface area falls in-between adjacent rays 11
12
Technische Universität München Computer Graphics Aliasing Cause of aliasing –Sampling frequency is not high enough to cover all details –It is below the Niquist limit 12 Shannons Sampling Theorem: The signal has to be sampled at a frequency that is equal to or higher than two times the highest frequency in the signal
13
Technische Universität München Computer Graphics Aliasing Aliasing artefacts –Spatial aliasing –Temporal aliasing 13
14
Technische Universität München Computer Graphics Antialiasing How to avoid aliasing caused by an undersampling of the signal, i.e. the sampling frequency is not high enough to cover all details –Supersampling - increase sampling frequency –Prefiltering - decrease the highest frequency in the signal, i.e. filter the signal before sampling –Postfiltering – filtering after sampling, but just blurres the image 14
15
Technische Universität München Computer Graphics Antialiasing Supersampling - increase sampling frequency –Use more rays per pixel, i.e. virtually increase the resolution of the pixel raster –e.g. use 4x4 rays per pixel and compute average of all 16 colors as final pixel color –Sharp edges are washed out –OK, but doesn´t eliminate aliasing because sharp edges contain infinitely high frequencies 15
16
Technische Universität München Computer Graphics Antialiasing Supersampling –Regular supersampling 16
17
Technische Universität München Computer Graphics Antialiasing Filtering: average weighted samples 17
18
Technische Universität München Computer Graphics Antialiasing Filtering example 18
19
Technische Universität München Computer Graphics Antialiasing Filtering - jittered instead of regular sampling 19
20
Technische Universität München Computer Graphics Antialiasing Regular sampling –Visibility of aliases also caused by the regular sampling grid –Human visual system is sensitive against regular structures, but rather insensitive against high frequency noise Stochastic supersampling –Place samples randomly within pixel –Alias frequencies are converted to noise –But can result in clusters of sample 20
21
Technische Universität München Computer Graphics Antialiasing Poisson-disk sampling –Random generation of samples with limit for the minimum distance between samples Jittered sampling –Random jittering from regular grid points Stratified random sampling –Regular partitioning of pixel region –One random sample per partition 21
22
Technische Universität München Computer Graphics Antialiasing Comparison –Regular, 1x1 Regular 3x3 Regular, 7x7 Jittered, 3x3 Jittered, 7x7 22
23
Technische Universität München Computer Graphics Antialiasing Example: 23
24
Technische Universität München Computer Graphics Antialiasing Example: 24
25
Technische Universität München Computer Graphics Antialiasing Example: 25
26
Technische Universität München Computer Graphics Antialiasing Example: 26
27
Technische Universität München Computer Graphics Antialiasing Prefiltering –Antialiasing before sampling (mainly used in texture mapping) Filtering (smoothing) a signal to remove details below the frequency which is used to sample the signal 27
28
Technische Universität München Computer Graphics Antialiasing Prefiltering combines color contributions into a pixel 28
29
Technische Universität München Computer Graphics Antialiasing in texture mapping Many texels fall onto one pixels 29
30
Technische Universität München Computer Graphics Antialiasing in texture mapping Mip-Mapping: prefiltered levels of detail (LOD) in a pyramid At every level: average 2x2 texels from the finer level into one texel 30
31
Technische Universität München Computer Graphics Antialiasing in texture mapping 31
32
Technische Universität München Computer Graphics Antialiasing in texture mapping 32
33
Technische Universität München Computer Graphics Antialiasing in texture mapping Mip-Mapping: how does it work? –When a fragment is texture mapped, the mip-map level at which the texel size is equal to the pixel size is computed –From this level the texture is then sampled –It remains to be answered how the level is computed 33
34
Technische Universität München Computer Graphics Antialiasing in texture mapping We want to know what the size of one texel wrt the size of one pixel is – this allows estimating how many texels fall into one pixel 34
35
Technische Universität München Computer Graphics Antialiasing in texture mapping Computing the mip-map level: Check screen pixel “size” in texture coordinates 35 less than one texel per pixel we call this magnification more than one texel per pixel we call this minification u,v: fragments texture coordinates x,y: pixel coordinates
36
Technische Universität München Computer Graphics Antialiasing in texture mapping 36
37
Technische Universität München Computer Graphics Antialiasing in texture mapping 37 without MipMappingwith MipMapping
38
Technische Universität München Computer Graphics Antialiasing in texture mapping 38 Isotropic filtering (mipmapping) Anisotropic filtering
39
Technische Universität München Computer Graphics Antialiasing in texture mapping Mip-Mapping –The mip-map only stores a discrete set of levels –If pixel size matches texel size at a level in between, it is interpolated between the two adjacent levels 39 Sample 0 Sample 1 interpolate assign Select resolution Bilinear in texture + linear between levels = trilinear
40
Technische Universität München Computer Graphics Summary Quality of rendering strongly depends on antialiasing algorithms used –Typically, supersampling in combination with prefiltering is used Supersampling and mipmapping We are now ready to implement a high quality and efficient ray tracing algorithm What comes next is an alternative image synthesis approach based on the projection of geometry onto the image plane 40
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.