Detail mapping - Cornell University · 2016. 2. 4. · • displacement mapping! Normals • bump...
Transcript of Detail mapping - Cornell University · 2016. 2. 4. · • displacement mapping! Normals • bump...
-
05 Detail mapping
Steve Marschner CS5625 Spring 2016
-
Hierarchy of scalesmacroscopic
mesoscopic
microscopic
Predicting Reflectance Functions from Complex Surfaces
Stephen H. WestinJames R. Arvo
Kenneth E. Torrance
Program of Computer GraphicsCornell University
Ithaca, New York 14853
Abstract
We describe a physically-based Monte Carlo technique for ap-proximating bidirectional reflectance distribution functions(BRDFs) for a large class of geometries by directly simulatingoptical scattering. The technique is more general than pre-vious analytical models: it removes most restrictions on sur-face microgeometry. Three main points are described: a newrepresentation of the BRDF, a Monte Carlo technique to esti-mate the coefficients of the representation, and the means ofcreating a milliscale BRDF from microscale scattering events.These allow the prediction of scattering from essentially ar-bitrary roughness geometries. The BRDF is concisely repre-sented by a matrix of spherical harmonic coefficients; the ma-trix is directly estimated from a geometric optics simulation,enforcing exact reciprocity. The method applies to rough-ness scales that are large with respect to the wavelength oflight and small with respect to the spatial density at whichthe BRDF is sampled across the surface; examples includebrushed metal and textiles. The method is validated by com-paring with an existing scattering model and sample imagesare generated with a physically-based global illumination al-gorithm.
CR Categories and Subject Descriptors: I.3.7 [ComputerGraphics]: Three-Dimensional Graphics and Realism.Additional Key Words: spherical harmonics, Monte Carlo,anisotropic reflection, BRDF
1 Introduction
Since the earliest days of computer graphics, experimentershave recognized that the realism of an image is limited bythe sophistication of the model of local light scattering [3, 12].Non-physically-based local lighting models, such as that ofPhong [12], although computationally simple, exclude manyimportant physical effects and lack the energy consistencyneeded for global illumination calculations. Physically-basedmodels [2, 5, 15] reproduce many effects better, but cannot
0.01
0.1
1 mm
100
1000
10
BRDF
Texels
Texture, bump maps
Geometry
Object scale
Milliscale
Microscale
Figure 1: Applicability of Techniques
model many surfaces, such as those with anisotropic rough-ness. Models that deal with anisotropic surfaces [8, 11] fail toassure physical consistency.
This paper presents a new method of creating local scat-tering models. The method has three main components: aconcise, general representation of the BRDF, a technique toestimate the coefficients of the representation, and a meansof using scattering at one scale to create a BRDF for a largerscale. The representation used makes it easy to enforce the ba-sic physical property of scattering reciprocity, and its approx-imation does not require discretizing scattering directions asin the work of Kajiya [8] and Cabral et al. [1].
The method can predict scattering from any geometry thatcan be ray-traced: polygons, spheres, parametric patches,and even volume densities. Previous numerical techniqueswere limited to height fields, and analytical methods havebeen developed only for specific classes of surface geome-try. The new method accurately models both isotropic andanisotropic surfaces such as brushed metals, velvet, and wo-ven textiles.
Figure 1 shows several representations used in realistic ren-dering, along with approximate scale ranges where each isapplicable. At the smallest scale (size 1 mm), which we callmicroscale, the BRDF accurately captures the appearance of a
Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission.
1992 ACM-0-89791-479-1/92/007/0255
(Mesoscale)
-
• Most flexible part of graphics hardware• Textures can modulate
– Material§ Diffuse, Specular/roughness (gloss maps)
– Geometry§ Positions
• displacement mapping§ Normals
• bump mapping, normal mapping– Lighting§ Environment mapping§ Reflection mapping§ Shadow mapping
slide courtesy of Kavita Bala, Cornell University
Texture Maps
-
• Mimic effect of geometric detail/meso geometry– Also detail mapping
slide courtesy of Kavita Bala, Cornell University
Displacement and Bump/Normal Mapping
Geometry Bump mapping
Displacement mapping
-
slide courtesy of Kavita Bala, Cornell University
Displacement Mapping
p0(u, v) = p(u, v) + h(u, v)n(u, v)
-
slide courtesy of Kavita Bala, Cornell University
Displacement Maps: where?
-
slide courtesy of Kavita Bala, Cornell University
Displacement Maps: vertex map
-
• Pros– Gives you very complex surfaces
• Cons– Gives you very complex surfaces– Or boring with small numbers of vertices
• Relationship with tesselation shaders
slide courtesy of Kavita Bala, Cornell University
Displacement Maps
-
slide courtesy of Kavita Bala, Cornell University
Original Tesselated Displacement Mapped
-
• “Simulation of Wrinkled Surfaces” Blinn 78
• Blinn: keep surface, use new normals
slide courtesy of Kavita Bala, Cornell University
Bump mapping
-
• Alter normals of surface – Only affects shading normals
• Also, mimics effect of small scale geometry – Detail map– Except at silhouette – Adds perceived bumps, wrinkles
slide courtesy of Kavita Bala, Cornell University
Bump Mapping
-
slide courtesy of Kavita Bala, Cornell University
Bump Mapping
-
slide courtesy of Kavita Bala, Cornell University
Bump Mapping
-
• First, need some frame of reference– Normal is modified with respect to that– Have tangent space basis: t and b– Normal, tangent and bitangent vectors
slide courtesy of Kavita Bala, Cornell University
How to change the normal?
-
• Single scalar, more computation to infer N’
slide courtesy of Kavita Bala, Cornell University
Heightfield: Blinn’s original idea
-
Perturbed normal given height map
Normal is determined by partial derivatives of height • in the local frame of the displacement map:
• approx: heights are small compared to radius of curvature (constant normal)
• then the displaced surface is locally a linear transformation of the height field
• normal transforms by the adjoint matrix (as normals always to)
• perform 4 lookups to get 4 neighboring height values
• subtract to obtain finite difference derivatives
ndisp = (hu, hv, 1)
-
• Older technique, less memory• Texture map value is a height• Gray scale value: light is +, dark is -
slide courtesy of Kavita Bala, Cornell University
Height Field Bump Maps
-
• Look up bu and bv• N’ is not normalized
• N’ = N + bu T + bv B
slide courtesy of Kavita Bala, Cornell University
Bump Mapping
-
• N’.L• Perturb N to get N’ using bump map• Transform L to tangent space of surface
– Have N, T (tangent), bitangent B = T x N
slide courtesy of Kavita Bala, Cornell University
Rendering with Bump Maps
-
slide courtesy of Kavita Bala, Cornell University
http://www.youtube.com/watch?v=1mdR2imNeZI
http://www.youtube.com/watch?v=1mdR2imNeZI
-
• Preferred technique for bump mapping for modern graphics cards
• Store new normals in texture map– Encodes (x, y, z) mapped to [-1, 1]
• More memory but lower computation
slide courtesy of Kavita Bala, Cornell University
Normal Maps
Normal Map Height Map
-
colorComponent = 0.5 * normalComponent + 0.5•
slide courtesy of Kavita Bala, Cornell University
normalComponent = 2* colorComponent -1
• Store
• Use
-
slide courtesy of Kavita Bala, Cornell University
Normal Map
-
• First create complex geometry
• Simplify (in modeling time) to simple mesh with normal map
slide courtesy of Kavita Bala, Cornell University
Creating Normal Maps
-
slide courtesy of Kavita Bala, Cornell University
Displacement Maps vs. Normal Maps
-
slide courtesy of Kavita Bala, Cornell University
Compare with the opposite view
Original Tesselated Displacement Mapped
-
slide courtesy of Kavita Bala, Cornell University
Unreal 3
-
slide courtesy of Kavita Bala, Cornell University
2M polys
-
slide courtesy of Kavita Bala, Cornell University
5k
-
slide courtesy of Kavita Bala, Cornell University
Creating Normal Maps
-
• World space– Easy computation§ Get normal§ Get light vector§ Compute shading
– Can we use the same normal map for…§ two walls§ A rotating object
• Object space– Better, but cannot be reused for symmetric parts
of object
slide courtesy of Kavita Bala, Cornell University
Which space is normal map in?
-
• Tangent space normals– Can reuse for deforming surfaces– Transform lighting to this space and shade
slide courtesy of Kavita Bala, Cornell University
Which space is normal in?
-
• Problem with normal mapping– No self-occlusion– Supposed to be a height field but never see this
occlusion across different viewing angles
• Parallax mapping– Positions of objects move relative to one other
as viewpoint changes
slide courtesy of Kavita Bala, Cornell University
Parallax Mapping
-
• Want Tideal• Use Tp to approximate it
slide courtesy of Kavita Bala, Cornell University
Parallax Mapping
v
h
-
• Problem: at steep viewing, can offset too much
• Limit offset
slide courtesy of Kavita Bala, Cornell University
Parallax Offset Limiting
-
• Widely used in games– the standard in bump mapping
slide courtesy of Kavita Bala, Cornell University
Parallax Offset Limiting
Normal Mapping Parallax Mapping Offset Limiting
-
slide courtesy of Kavita Bala, Cornell University
1,100 polygon object w/ parallax occlusion mapping
1.5 million polygon
-
slide courtesy of Kavita Bala, Cornell University
http://www.youtube.com/watch?v=nZPsQtlHthQ
http://www.youtube.com/watch?v=nZPsQtlHthQ
-
• Aka Parallax occlusion mapping, relief mapping, steep parallax mapping
• Tries to find where the view ray intersects the height field
– Kinda
slide courtesy of Kavita Bala, Cornell University
Relief Mapping
-
slide courtesy of Kavita Bala, Cornell University
Relief Mapping
-
slide courtesy of Kavita Bala, Cornell University
Sample along ray (green points)Lookup violet points (texture values)
/* Inferthe black line shape */Compare green points with black pointsFind intersect between two conditions
prev: green above blacknext: green below black
-
slide courtesy of Kavita Bala, Cornell University
Parallax Mapping Relief Mapping
-
slide courtesy of Kavita Bala, Cornell University
http://www.youtube.com/watch?v=_erYebogWUw
http://www.youtube.com/watch?v=5gorm90TXJM
http://www.youtube.com/watch?v=_erYebogWUwhttp://www.youtube.com/watch?v=5gorm90TXJM
-
slide courtesy of Kavita Bala, Cornell University
Crysis, Crytek