Diploma Thesis Filtering Reflection Properties of Rough Surfaces
Total Page:16
File Type:pdf, Size:1020Kb
TECHNICAL UNIVERSITY DRESDEN FACULTY OF COMPUTER SCIENCE INSTITUTE OF SOFTWARE AND MULTIMEDIA TECHNOLOGY CHAIR OF COMPUTER GRAPHICS AND VISUALIZATION PROF.DR.STEFAN GUMHOLD Diploma thesis for the acquisition of the academic degree Diplom-Informatiker Filtering reflection properties of rough surfaces Andreas Ecke (Born 11. November 1987 in Ilmenau) Supervisor: Prof. Dr. rer. nat. Stefan Gumhold Dipl. Medien-Inf. Andreas Stahl Dresden, September 27, 2012 Task Filtering of color textures with mipmaps is important to reduce artifacts when rendering a surface at different resolutions. However, this approach does not work for rough surfaces with varying reflection properties. For filtering of reflection properties, solutions like BRDF hierarchies and BTF filters are available, but have several drawbacks. For geometry filtering commonly used techniques include geometry hierarchies and the rendering of displacement maps by ray-casting. The objective of this work is to design a filtering approach for the reflection properties of rough surfaces that can be used to realistically render a surface at different resolutions. This approach should combine BTFs with ray-casting based displacement mapping to allow the rendering of the surface in real-time. Subgoals: • Literature research on BTFs, filtering and displacement mapping • Procedure for synthesis of a BTF from a surface description • Design of a BTF filter with image correlation • Procedure for real-time rendering of a surface with displacement mapping • Investigation of properties of the implementation like handling the empty border of the BTF images, selection of the mipmap level, and application on curved surfaces • Evaluation of the approach concerning correctness and time requirements • Optional: BTF compression, illumination by sky maps Statement of authorship I hereby certify that the diploma thesis I submitted today to the examination board of the faculty of computer science with the title: Filtering reflection properties of rough surfaces has been composed solely by myself and that I did not use any sources and aids other than those stated, with quotations duly marked as such. Dresden, September 27, 2012 Andreas Ecke Abstract Filtering of color textures with mipmaps is important to reduce artifacts when rendering a surface at different resolutions. However, this approach does not work for rough surfaces with varying reflection properties. For filtering of reflection properties, solutions like BRDF hierarchies and BTF filters are available, but have several drawbacks. For geometry filtering commonly used techniques include geometry hierarchies and the rendering of displacement maps by ray-casting. In this thesis, a filtering approach is designed for the reflection properties of rough surfaces, that can be used to realistically render a surface at different resolutions. This approach combines BTFs with ray-casting based displacement mapping to allow high-quality rendering of the surface for any resolution in real-time. 1 Contents Nomenclature 3 1 Introduction 5 1.1 Structure of this thesis . .5 2 Preliminaries 7 2.1 Rough Surfaces . .7 2.1.1 Per-vertex displacement mapping . .7 2.1.2 Per-pixel displacement mapping . .8 2.1.3 Curved surfaces . 10 2.2 Varying reflectance . 10 2.2.1 BRDFs . 11 2.2.2 Models . 11 2.3 Filtering . 14 2.3.1 Mipmapping . 14 2.3.2 Transition between bump rendering algorithms . 15 2.3.3 BRDF mixture models . 16 2.4 Bidirectional texture functions . 16 2.4.1 LOD for BTFs . 17 2.4.2 Compression and rendering . 18 3 BTF generation 19 3.1 Surface rendering . 20 3.1.1 Lighting models . 20 3.1.2 Per-pixel displacement mapping . 21 3.2 Image rectification . 24 3.2.1 Transformation . 24 3.2.2 Projection matrix . 24 3.3 Filtering & Compression . 26 3.3.1 Laplacian pyramid . 26 3.3.2 Principal component analysis . 27 3.3.3 Texture packing . 28 3.4 Handling of empty border pixels . 28 4 Rendering 31 4.1 BTF rendering . 31 4.1.1 Projection & Directions . 31 4.1.2 Decompression . 32 4.1.3 Level of Detail . 32 4.1.4 Interpolation . 33 4.2 Transition between the BTF and relief renderer . 34 4.3 Curved surfaces . 35 4.3.1 Using BTFs with curved surfaces . 36 2 5 Evaluation 39 5.1 Performance . 39 5.1.1 Preprocessing . 39 5.1.2 Rendering . 40 5.2 Level of detail . 41 5.3 BTF compression . 43 5.3.1 Border pixels . 44 5.3.2 Mean encoding . 45 5.4 Interpolation . 46 5.5 Curved surfaces . 48 6 Conclusion 51 Bibliography 53 List of Figures 55 List of Tables 57 3 Nomenclature (n;t;b) or TBN tangent space consisting of normal vector n, tangent t and bi-tangent b (s;t) and (u;v) texture coordinates mk mean vector resulting from performing PCA on the kth Gaussian pyramid levels w = (q;f) direction consisting of inclination q and polar angle f wi = (qi;fi) direction of incident irradiance wr = (qr;fr) direction of emitted radiance r albedo of the surface s surface roughness for the Oren-Nayar reflection model depth(u;v) value stored in the depth map for texture coordinates (u;v) E0 light intensity F0 reflectance of a surface at normal incidence fr(wr;wi) general BRDF defined for incident direction wi and exitant direction wr fr(qr;qi;fr − fi) isotropic BRDF wi;wr Gk kth level of the Gaussian pyramid for light direction wi and view direction wr h half vector between l and v ka, kd and ks ambient, diffuse and specular color of a surface l light direction wi;wr Lk kth level of the Laplacian pyramid for light direction wi and view direction wr Lr resulting color by evaluating the reflection model lod level of detail parameter m surface roughness for the Cook-Torrance reflection model n normal vector p = (x;y) a point on the surface s shininess exponent for the Blinn-Phong reflection model v view direction 4 5 1 Introduction Rendering surfaces is one of the most fundamental tasks in computer graphics, as objects are generally represented by their surfaces only. Surfaces of natural objects can be highly complex, featuring roughness, a certain structure and variable reflection properties. Rendering such surfaces is an equally complex task. Much research has been done to find methods to render them as realistic and as fast as possible. An example of such a complex surface is a planet in a space simulation. The planet surface has different elevations, like high mountain ranges and flat oceans, and highly varying reflection properties such as specular water, diffuse forests and glistening, snowy mountain tops. This high complexity also holds for surfaces at other scales, such as house fronts with their reflective windows, a glossy car paint with dirt splashes or printed circuit boards. By combining several reflection models and using techniques such as displacement mapping to add geometric detail, these surfaces can be rendered fairly well. However, another important aspect of realistic rendering is filtering of the surface at low resolutions, i.e. when the surface is far away, and this is where these basic methods fail: They produce heavy aliasing artifacts or change the appearance of the filtered surface incorrectly. This is because standard filtering of the base textures is incorrect for general surfaces. This can be seen for our planet example: If the surface color of this planet is described by a simple color texture, filtering this texture would yield a mixture of the blue water, green forests, a white mountain tops. However, in reality, the blue water and green forest may not be visible when looking from shallow angles, as the are partially or fully occluded by the mountains. Then, the filtered textures should not contain these colors for that particular view direction. Hence, filtering the color texture using the usual methods produces wrong results. Therefore, this thesis main concern is the question of how to filter complex surfaces such that highly realistic and correct real-time rendering is possible at arbitrary resolutions. Given the importance of surface rendering as one of the most fundamental tasks and its huge impact on perceived image quality, a general method that solves this problem will be highly useful in various areas of computer graphics. The proposed solution consists of constructing a bidirectional texture function (BTF), which consists of images of the surface for many different view and light directions, from the surface description. Using such a BTF, each of these images of the BTF can be filtered separately using standard methods. While the constructed BTF solves the filtering problem this way, it introduces further difficulties: BTFs are generally too large for direct rendering on the GPU, and because of their small spatial resolution they are inappropriate when rendering the surface for large resolutions, i.e. when the surface is very close. 1.1 Structure of this thesis In Chapter 2, we introduce the basic concepts and methods needed for the rendering of realistic surfaces: reflection models, methods to add geometric detail such as displacement mapping and, of cause, standard approaches to filtering. We also discuss related work and point out the issues, and how a solution ultimately leads to a BTF-based filtering approach. The chapter will conclude with an introduction of BTFs and how filtering them can be achieved. The next two chapters explain our approach to surface rendering. In particular, Chapter 3 deals with the 6 1. INTRODUCTION preprocessing steps needed such as the construction of the BTF from the surface description, its filtering and compression, while Chapter 4 explains how the data from the preprocessing stage is finally used in the real-time renderer. Following this, in Chapter 5 we analyze a prototypic implementation and evaluate it in terms of quality, run time and memory requirements.