Normal Mapping and Tangent Spaces

Total Page:16

File Type:pdf, Size:1020Kb

Normal Mapping and Tangent Spaces Normal Mapping and Tangent Spaces University of Texas at Austin CS384G - Computer Graphics Don Fussell Normal Maps Like bump maps but normals already computed 3 elements per texel – x,y,z components of normal Defined in texture (surface) space Must map to object space to use Problem: What vectors in object space correspond to the x,y, and z axes in texture space? Solution: Define two orthogonal vectors tangent to the surface and one normal to the surface Surface space can now be called tangent space University of Texas at Austin CS384G - Computer Graphics Don Fussell 2 Mapping normal to surface Step 1: Find texture coordinate of surface Step 2: Look up texel at that coordinate Step 3: Find rotation that maps tangent space normal to object space normal for the given pixel Step 4: Rotate tangent space normal defined in the texel by this rotation to define the normal at the surface point z n y=v b n'' z t n' x=u Tangent space y (Texture map) Object space x University of Texas at Austin CS384G - Computer Graphics Don Fussell 3 Axes in object space ϕ For sphere in x = rsinθ cosϕ u = x = −rsinπvcos2πu 2π polar coordinates y = rsinθ sinϕ y = −rsinπvsin2πu π −θ z = r cosθ v = z = −r cosπv π ⎡ ⎤ ⎡ dx ⎤ dx ⎡ dx ⎤ ⎡ dx ⎤ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ − ⎥ ⎢ dϕ ⎥ ⎢ du ⎥ ⎡ −rsinθ sinϕ ⎤ ⎢ dv ⎥ ⎢ dθ ⎥ ⎡ −r cosθ cosϕ ⎤ ⎢ dy ⎥ ⎢ dy ⎥ ⎢ ⎥ ⎢ dy ⎥ ⎢ dy ⎥ ⎢ ⎥ t = ⎢ ⎥ = ⎢ ⎥ = ⎢ rsinθ cosϕ ⎥ b = ⎢ ⎥ = ⎢ − ⎥ = ⎢ −r cosθ sinϕ ⎥ du ⎢ dϕ ⎥ ⎢ ⎥ dv dθ ⎢ ⎥ 0 ⎢ ⎥ ⎢ ⎥ ⎢ rsinθ ⎥ ⎢ dz ⎥ ⎢ dz ⎥ ⎣ ⎦ ⎢ dz ⎥ ⎢ dz ⎥ ⎣ ⎦ ⎢ ⎥ − ⎢ du ⎥ ⎢ dv ⎥ ⎢ dθ ⎥ ⎣ ⎦ ⎣⎢ dϕ ⎦⎥ ⎣ ⎦ ⎣ ⎦ n = t × b need to normalize t, b, and n University of Texas at Austin CS384G - Computer Graphics Don Fussell 4 Rotation – tangent and object space Object space to tangent space For light vectors ⎡ t t t 0 ⎤ ⎢ x y z ⎥ ⎢ bx by bz 0 ⎥ L' = ⎢ ⎥L ⎢ nx ny nz 0 ⎥ ⎢ ⎥ ⎣ 0 0 0 1 ⎦ Tangent space to object space For normals ⎡ t b n 0 ⎤ ⎢ x x x ⎥ ⎢ ty by ny 0 ⎥ nʹʹ = ⎢ ⎥nʹ ⎢ tz bz nz 0 ⎥ ⎣⎢ 0 0 0 1 ⎦⎥ University of Texas at Austin CS384G - Computer Graphics Don Fussell 5 Messier for polygons (triangles) Given a triangle with vertices P0,P1,P2 and texture coordinates for those vertices We need to solve for t and b We already know how to get the triangle normal n z b n P1 (u1,v1) P2 (u2,v2) t P0 (u0,v0) y x Object space University of Texas at Austin CS384G - Computer Graphics Don Fussell 6 Solving for t and b V1 = P1 − P0 = (u1 − u0 )t + (v1 − v0 )b = Δu1t + Δv1b V2 = P2 − P0 = (u2 − u0 )t + (v2 − v0 )b = Δu2t + Δv2b ⎡ ⎤ ⎡ ⎤⎡ ⎤ V1 Δu1 Δv1 t ⎢ ⎥ = ⎢ ⎥⎢ ⎥ V u v b ⎣⎢ 2 ⎦⎥ ⎣⎢ Δ 2 Δ 2 ⎦⎥⎣ ⎦ −1 ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ Δu1 Δv1 V1 t ⎢ ⎥ ⎢ ⎥ = ⎢ ⎥ u v V b ⎣⎢ Δ 2 Δ 2 ⎦⎥ ⎣⎢ 2 ⎦⎥ ⎣ ⎦ ⎡ ⎤⎡ ⎤ ⎡ ⎤ 1 Δv2 −Δv1 V1 t ⎢ ⎥⎢ ⎥ = ⎢ ⎥ u v u v u u V b Δ 1Δ 2 − Δ 2Δ 1 ⎣⎢ −Δ 2 Δ 1 ⎦⎥⎣⎢ 2 ⎦⎥ ⎣ ⎦ University of Texas at Austin CS384G - Computer Graphics Don Fussell 7 Why is it messy? For smooth shading you average the tangents and bitangents as well as normals of triangles sharing a vertex to get different t, b and n at each vertex. The you interpolate these across the triangle. At each pixel, the t, b and n vectors you get are no longer orthogonal. So you have to fix them, e.g. using Gram-Schmidt orthogonalization, before you can make a rotation matrix from them. University of Texas at Austin CS384G - Computer Graphics Don Fussell 8 Gram-Schmidt Orthogonalization Start with unit vector n, make t’ orthogonal to it -(t•n)n t' t tʹ = t − (t ⋅ n)n n (t•n)n Normalize t’ Now make b orthogonal to both n and t’ bʹ = b − (b⋅ n)n − (b⋅ tʹ)tʹ Normalize b’ University of Texas at Austin CS384G - Computer Graphics Don Fussell 9 .
Recommended publications
  • Glossary Physics (I-Introduction)
    1 Glossary Physics (I-introduction) - Efficiency: The percent of the work put into a machine that is converted into useful work output; = work done / energy used [-]. = eta In machines: The work output of any machine cannot exceed the work input (<=100%); in an ideal machine, where no energy is transformed into heat: work(input) = work(output), =100%. Energy: The property of a system that enables it to do work. Conservation o. E.: Energy cannot be created or destroyed; it may be transformed from one form into another, but the total amount of energy never changes. Equilibrium: The state of an object when not acted upon by a net force or net torque; an object in equilibrium may be at rest or moving at uniform velocity - not accelerating. Mechanical E.: The state of an object or system of objects for which any impressed forces cancels to zero and no acceleration occurs. Dynamic E.: Object is moving without experiencing acceleration. Static E.: Object is at rest.F Force: The influence that can cause an object to be accelerated or retarded; is always in the direction of the net force, hence a vector quantity; the four elementary forces are: Electromagnetic F.: Is an attraction or repulsion G, gravit. const.6.672E-11[Nm2/kg2] between electric charges: d, distance [m] 2 2 2 2 F = 1/(40) (q1q2/d ) [(CC/m )(Nm /C )] = [N] m,M, mass [kg] Gravitational F.: Is a mutual attraction between all masses: q, charge [As] [C] 2 2 2 2 F = GmM/d [Nm /kg kg 1/m ] = [N] 0, dielectric constant Strong F.: (nuclear force) Acts within the nuclei of atoms: 8.854E-12 [C2/Nm2] [F/m] 2 2 2 2 2 F = 1/(40) (e /d ) [(CC/m )(Nm /C )] = [N] , 3.14 [-] Weak F.: Manifests itself in special reactions among elementary e, 1.60210 E-19 [As] [C] particles, such as the reaction that occur in radioactive decay.
    [Show full text]
  • A Geometric Take on Metric Learning
    A Geometric take on Metric Learning Søren Hauberg Oren Freifeld Michael J. Black MPI for Intelligent Systems Brown University MPI for Intelligent Systems Tubingen,¨ Germany Providence, US Tubingen,¨ Germany [email protected] [email protected] [email protected] Abstract Multi-metric learning techniques learn local metric tensors in different parts of a feature space. With such an approach, even simple classifiers can be competitive with the state-of-the-art because the distance measure locally adapts to the struc- ture of the data. The learned distance measure is, however, non-metric, which has prevented multi-metric learning from generalizing to tasks such as dimensional- ity reduction and regression in a principled way. We prove that, with appropriate changes, multi-metric learning corresponds to learning the structure of a Rieman- nian manifold. We then show that this structure gives us a principled way to perform dimensionality reduction and regression according to the learned metrics. Algorithmically, we provide the first practical algorithm for computing geodesics according to the learned metrics, as well as algorithms for computing exponential and logarithmic maps on the Riemannian manifold. Together, these tools let many Euclidean algorithms take advantage of multi-metric learning. We illustrate the approach on regression and dimensionality reduction tasks that involve predicting measurements of the human body from shape data. 1 Learning and Computing Distances Statistics relies on measuring distances. When the Euclidean metric is insufficient, as is the case in many real problems, standard methods break down. This is a key motivation behind metric learning, which strives to learn good distance measures from data.
    [Show full text]
  • Surface Regularized Geometry Estimation from a Single Image
    SURGE: Surface Regularized Geometry Estimation from a Single Image Peng Wang1 Xiaohui Shen2 Bryan Russell2 Scott Cohen2 Brian Price2 Alan Yuille3 1University of California, Los Angeles 2Adobe Research 3Johns Hopkins University Abstract This paper introduces an approach to regularize 2.5D surface normal and depth predictions at each pixel given a single input image. The approach infers and reasons about the underlying 3D planar surfaces depicted in the image to snap predicted normals and depths to inferred planar surfaces, all while maintaining fine detail within objects. Our approach comprises two components: (i) a four- stream convolutional neural network (CNN) where depths, surface normals, and likelihoods of planar region and planar boundary are predicted at each pixel, followed by (ii) a dense conditional random field (DCRF) that integrates the four predictions such that the normals and depths are compatible with each other and regularized by the planar region and planar boundary information. The DCRF is formulated such that gradients can be passed to the surface normal and depth CNNs via backpropagation. In addition, we propose new planar-wise metrics to evaluate geometry consistency within planar surfaces, which are more tightly related to dependent 3D editing applications. We show that our regularization yields a 30% relative improvement in planar consistency on the NYU v2 dataset [24]. 1 Introduction Recent efforts to estimate the 2.5D layout of a depicted scene from a single image, such as per-pixel depths and surface normals, have yielded high-quality outputs respecting both the global scene layout and fine object detail [2, 6, 7, 29]. Upon closer inspection, however, the predicted depths and normals may fail to be consistent with the underlying surface geometry.
    [Show full text]
  • CS 468 (Spring 2013) — Discrete Differential Geometry 1 the Unit Normal Vector of a Surface. 2 Surface Area
    CS 468 (Spring 2013) | Discrete Differential Geometry Lecture 7 Student Notes: The Second Fundamental Form Lecturer: Adrian Butscher; Scribe: Soohark Chung 1 The unit normal vector of a surface. Figure 1: Normal vector of level set. • The normal line is a geometric feature. The normal direction is not (think of a non-orientable surfaces such as a mobius strip). If possible, you want to pick normal directions that are consistent globally. For example, for a manifold, you can pick normal directions pointing out. • Locally, you can find a normal direction using tangent vectors (though you can't extend this globally). • Normal vector of a parametrized surface: E1 × E2 If TpS = spanfE1;E2g then N := kE1 × E2k This is just the cross product of two tangent vectors normalized by it's length. Because you take the cross product of two vectors, it is orthogonal to the tangent plane. You can see that your choice of tangent vectors and their order determines the direction of the normal vector. • Normal vector of a level set: > [DFp] N := ? TpS kDFpk This is because the gradient at any point is perpendicular to the level set. This makes sense intuitively if you remember that the gradient is the "direction of the greatest increase" and that the value of the level set function stays constant along the surface. Of course, you also have to normalize it to be unit length. 2 Surface Area. • We want to be able to take the integral of the surface. One approach to the problem may be to inegrate a parametrized surface in the parameter domain.
    [Show full text]
  • Curl, Divergence and Laplacian
    Curl, Divergence and Laplacian What to know: 1. The definition of curl and it two properties, that is, theorem 1, and be able to predict qualitatively how the curl of a vector field behaves from a picture. 2. The definition of divergence and it two properties, that is, if div F~ 6= 0 then F~ can't be written as the curl of another field, and be able to tell a vector field of clearly nonzero,positive or negative divergence from the picture. 3. Know the definition of the Laplace operator 4. Know what kind of objects those operator take as input and what they give as output. The curl operator Let's look at two plots of vector fields: Figure 1: The vector field Figure 2: The vector field h−y; x; 0i: h1; 1; 0i We can observe that the second one looks like it is rotating around the z axis. We'd like to be able to predict this kind of behavior without having to look at a picture. We also promised to find a criterion that checks whether a vector field is conservative in R3. Both of those goals are accomplished using a tool called the curl operator, even though neither of those two properties is exactly obvious from the definition we'll give. Definition 1. Let F~ = hP; Q; Ri be a vector field in R3, where P , Q and R are continuously differentiable. We define the curl operator: @R @Q @P @R @Q @P curl F~ = − ~i + − ~j + − ~k: (1) @y @z @z @x @x @y Remarks: 1.
    [Show full text]
  • Multidisciplinary Design Project Engineering Dictionary Version 0.0.2
    Multidisciplinary Design Project Engineering Dictionary Version 0.0.2 February 15, 2006 . DRAFT Cambridge-MIT Institute Multidisciplinary Design Project This Dictionary/Glossary of Engineering terms has been compiled to compliment the work developed as part of the Multi-disciplinary Design Project (MDP), which is a programme to develop teaching material and kits to aid the running of mechtronics projects in Universities and Schools. The project is being carried out with support from the Cambridge-MIT Institute undergraduate teaching programe. For more information about the project please visit the MDP website at http://www-mdp.eng.cam.ac.uk or contact Dr. Peter Long Prof. Alex Slocum Cambridge University Engineering Department Massachusetts Institute of Technology Trumpington Street, 77 Massachusetts Ave. Cambridge. Cambridge MA 02139-4307 CB2 1PZ. USA e-mail: [email protected] e-mail: [email protected] tel: +44 (0) 1223 332779 tel: +1 617 253 0012 For information about the CMI initiative please see Cambridge-MIT Institute website :- http://www.cambridge-mit.org CMI CMI, University of Cambridge Massachusetts Institute of Technology 10 Miller’s Yard, 77 Massachusetts Ave. Mill Lane, Cambridge MA 02139-4307 Cambridge. CB2 1RQ. USA tel: +44 (0) 1223 327207 tel. +1 617 253 7732 fax: +44 (0) 1223 765891 fax. +1 617 258 8539 . DRAFT 2 CMI-MDP Programme 1 Introduction This dictionary/glossary has not been developed as a definative work but as a useful reference book for engi- neering students to search when looking for the meaning of a word/phrase. It has been compiled from a number of existing glossaries together with a number of local additions.
    [Show full text]
  • INTRODUCTION to ALGEBRAIC GEOMETRY 1. Preliminary Of
    INTRODUCTION TO ALGEBRAIC GEOMETRY WEI-PING LI 1. Preliminary of Calculus on Manifolds 1.1. Tangent Vectors. What are tangent vectors we encounter in Calculus? 2 0 (1) Given a parametrised curve α(t) = x(t); y(t) in R , α (t) = x0(t); y0(t) is a tangent vector of the curve. (2) Given a surface given by a parameterisation x(u; v) = x(u; v); y(u; v); z(u; v); @x @x n = × is a normal vector of the surface. Any vector @u @v perpendicular to n is a tangent vector of the surface at the corresponding point. (3) Let v = (a; b; c) be a unit tangent vector of R3 at a point p 2 R3, f(x; y; z) be a differentiable function in an open neighbourhood of p, we can have the directional derivative of f in the direction v: @f @f @f D f = a (p) + b (p) + c (p): (1.1) v @x @y @z In fact, given any tangent vector v = (a; b; c), not necessarily a unit vector, we still can define an operator on the set of functions which are differentiable in open neighbourhood of p as in (1.1) Thus we can take the viewpoint that each tangent vector of R3 at p is an operator on the set of differential functions at p, i.e. @ @ @ v = (a; b; v) ! a + b + c j ; @x @y @z p or simply @ @ @ v = (a; b; c) ! a + b + c (1.2) @x @y @z 3 with the evaluation at p understood.
    [Show full text]
  • Lecture 2 Tangent Space, Differential Forms, Riemannian Manifolds
    Lecture 2 tangent space, differential forms, Riemannian manifolds differentiable manifolds A manifold is a set that locally look like Rn. For example, a two-dimensional sphere S2 can be covered by two subspaces, one can be the northen hemisphere extended slightly below the equator and another can be the southern hemisphere extended slightly above the equator. Each patch can be mapped smoothly into an open set of R2. In general, a manifold M consists of a family of open sets Ui which covers M, i.e. iUi = M, n ∪ and, for each Ui, there is a continuous invertible map ϕi : Ui R . To be precise, to define → what we mean by a continuous map, we has to define M as a topological space first. This requires a certain set of properties for open sets of M. We will discuss this in a couple of weeks. For now, we assume we know what continuous maps mean for M. If you need to know now, look at one of the standard textbooks (e.g., Nakahara). Each (Ui, ϕi) is called a coordinate chart. Their collection (Ui, ϕi) is called an atlas. { } The map has to be one-to-one, so that there is an inverse map from the image ϕi(Ui) to −1 Ui. If Ui and Uj intersects, we can define a map ϕi ϕj from ϕj(Ui Uj)) to ϕi(Ui Uj). ◦ n ∩ ∩ Since ϕj(Ui Uj)) to ϕi(Ui Uj) are both subspaces of R , we express the map in terms of n ∩ ∩ functions and ask if they are differentiable.
    [Show full text]
  • 5. the Inverse Function Theorem We Now Want to Aim for a Version of the Inverse Function Theorem
    5. The inverse function theorem We now want to aim for a version of the Inverse function Theorem. In differential geometry, the inverse function theorem states that if a function is an isomorphism on tangent spaces, then it is locally an isomorphism. Unfortunately this is too much to expect in algebraic geometry, since the Zariski topology is too weak for this to be true. For example consider a curve which double covers another curve. At any point where there are two points in the fibre, the map on tangent spaces is an isomorphism. But there is no Zariski neighbourhood of any point where the map is an isomorphism. Thus a minimal requirement is that the morphism is a bijection. Note that this is not enough in general for a morphism between al- gebraic varieties to be an isomorphism. For example in characteristic p, Frobenius is nowhere smooth and even in characteristic zero, the parametrisation of the cuspidal cubic is a bijection but not an isomor- phism. Lemma 5.1. If f : X −! Y is a projective morphism with finite fibres, then f is finite. Proof. Since the result is local on the base, we may assume that Y is affine. By assumption X ⊂ Y × Pn and we are projecting onto the first factor. Possibly passing to a smaller open subset of Y , we may assume that there is a point p 2 Pn such that X does not intersect Y × fpg. As the blow up of Pn at p, fibres over Pn−1 with fibres isomorphic to P1, and the composition of finite morphisms is finite, we may assume that n = 1, by induction on n.
    [Show full text]
  • AN INTRODUCTION to the CURVATURE of SURFACES by PHILIP ANTHONY BARILE a Thesis Submitted to the Graduate School-Camden Rutgers
    AN INTRODUCTION TO THE CURVATURE OF SURFACES By PHILIP ANTHONY BARILE A thesis submitted to the Graduate School-Camden Rutgers, The State University Of New Jersey in partial fulfillment of the requirements for the degree of Master of Science Graduate Program in Mathematics written under the direction of Haydee Herrera and approved by Camden, NJ January 2009 ABSTRACT OF THE THESIS An Introduction to the Curvature of Surfaces by PHILIP ANTHONY BARILE Thesis Director: Haydee Herrera Curvature is fundamental to the study of differential geometry. It describes different geometrical and topological properties of a surface in R3. Two types of curvature are discussed in this paper: intrinsic and extrinsic. Numerous examples are given which motivate definitions, properties and theorems concerning curvature. ii 1 1 Introduction For surfaces in R3, there are several different ways to measure curvature. Some curvature, like normal curvature, has the property such that it depends on how we embed the surface in R3. Normal curvature is extrinsic; that is, it could not be measured by being on the surface. On the other hand, another measurement of curvature, namely Gauss curvature, does not depend on how we embed the surface in R3. Gauss curvature is intrinsic; that is, it can be measured from on the surface. In order to engage in a discussion about curvature of surfaces, we must introduce some important concepts such as regular surfaces, the tangent plane, the first and second fundamental form, and the Gauss Map. Sections 2,3 and 4 introduce these preliminaries, however, their importance should not be understated as they lay the groundwork for more subtle and advanced topics in differential geometry.
    [Show full text]
  • The Orientation Manifesto (For Undergraduates)
    The Orientation Manifesto (for undergraduates) Timothy E. Goldberg 11 November 2007 An orientation of a vector space is represented by an ordered basis of the vector space. We think of an orientation as a twirl, namely the twirl that rotates the first basis vector to the second, and the second to the third, and so on. Two ordered bases represent the same orientation if they generate the same twirl. (This amounts to the linear transformation taking one basis to the other having positive determinant.) If you think about it carefully, there are only ever two choices of twirls, and hence only two choices of orientation. n Because each R has a standard choice of ordered basis, fe1; e2; : : : ; eng (where ei is has 1 in the ith coordinates and 0 everywhere else), each Rn has a standard choice of orientation. The standard orientation of R is the twirl that points in the positive direction. The standard orientation of R2 is the counterclockwise twirl, moving from 3 e1 = (1; 0) to e2 = (0; 1). The standard orientation of R is a twirl that sweeps from the positive x direction to the positive y direction, and up the positive z direction. It's like a directed helix, pointed up and spinning in the counterclockwise direction if viewed from above. See Figure 1. An orientation of a curve, or a surface, or a solid body, is really a choice of orientations of every single tangent space, in such a way that the twirls all agree with each other. (This can be made horribly precise, when necessary.) There are several ways for a manifold to pick up an orientation.
    [Show full text]
  • On Manifolds of Negative Curvature, Geodesic Flow, and Ergodicity
    ON MANIFOLDS OF NEGATIVE CURVATURE, GEODESIC FLOW, AND ERGODICITY CLAIRE VALVA Abstract. We discuss geodesic flow on manifolds of negative sectional curva- ture. We find that geodesic flow is ergodic on the tangent bundle of a manifold, and present the proof for both n = 2 on surfaces and general n. Contents 1. Introduction 1 2. Riemannian Manifolds 1 2.1. Geodesic Flow 2 2.2. Horospheres and Horocycle Flows 3 2.3. Curvature 4 2.4. Jacobi Fields 4 3. Anosov Flows 4 4. Ergodicity 5 5. Surfaces of Negative Curvature 6 5.1. Fuchsian Groups and Hyperbolic Surfaces 6 6. Geodesic Flow on Hyperbolic Surfaces 7 7. The Ergodicity of Geodesic Flow on Compact Manifolds of Negative Sectional Curvature 8 7.1. Foliations and Absolute Continuity 9 7.2. Proof of Ergodicity 12 Acknowledgments 14 References 14 1. Introduction We want to understand the behavior of geodesic flow on a manifold M of constant negative curvature. If we consider a vector in the unit tangent bundle of M, where does that vector go (or not go) when translated along its unique geodesic path. In a sense, we will show that the vector goes \everywhere," or that the vector visits a full measure subset of T 1M. 2. Riemannian Manifolds We first introduce some of the initial definitions and concepts that allow us to understand Riemannian manifolds. Date: August 2019. 1 2 CLAIRE VALVA Definition 2.1. If M is a differentiable manifold and α :(−, ) ! M is a dif- ferentiable curve, where α(0) = p 2 M, then the tangent vector to the curve α at t = 0 is a function α0(0) : D ! R, where d(f ◦ α) α0(0)f = j dt t=0 for f 2 D, where D is the set of functions on M that are differentiable at p.
    [Show full text]