Download presentation

Presentation is loading. Please wait.

Published byWyatt Shaw Modified over 2 years ago

1
10.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 10 Solid Textures Bump Mapping Environment Mapping

2
10.2 si31_2001 Marble Texture

3
10.3 si31_2001 Solid Texture n A difficulty with 2D textures is the mapping from the object surface to the texture image – ie constructing f u (x,y,z) and f v (x,y,z) solid n This is avoided in 3D, or solid, texturing – texture now occupies a volume – can imagine object being carved out of the texture volume U V W texture space X Y Z object space Mapping functions trivial: u = x; v = y; w = z

4
10.4 si31_2001 Defining the Texture n The texture volume itself is usually defined procedurally – ie as a function that can be evaluated, such as: texture (u, v, w) = sin (u) sin (v) sin (w) – this is because of the vast amount of storage required if it were defined by data values

5
10.5 si31_2001 Example: Wood Texture n Wood grain texture can be modelled by a set of concentric cylinders – cylinders coloured dark, gaps between adjacent cylinders coloured light radius r = sqrt(u*u + w*w) if radius r = r 1, r 2, r 3, then texture (u,v,w) = dark else texture (u,v,w) = light looking down: cross section view U V W texture space

6
10.6 si31_2001 Example: Wood Texture n It is a bit more interesting to apply a sinusoidal perturbation – radius:= radius + 2 * sin( 20* ), with 0< <2 n.. and a twist along the axis of the cylinder – radius:= radius + 2 * sin( 20* + v/150 ) n This gives a realistic wood texture effect

7
10.7 si31_2001 Wood Texture

8
10.8 si31_2001 How to do Marble? n First create noise function (in 1D): – noise [i] = random numbers on lattice of points n Next create turbulence: – turbulence (x) = noise(x) + 0.5*noise(2x) *noise(4x) + … n Marble created by: – basic pattern: marble (x) = marble_colour (sin (x) ) – with turbulence: marble (x) = marble_colour (sin (x + turbulence (x) ) )

9
10.9 si31_2001 Marble Texture

10
10.10 si31_2001 Using Turbulence for Flame Simulation n Flame in 2D region [-b,b] x [0,h] can be modelled as: – flame(x,y) = (1-y/h) * flame_col(abs(x/b)) flame_col has max intensity at 0, min at 1 n Adding turbulence factor to flame_col gives more realistic effect: – flame(x,y) = (1-y/h) * flame_col(abs(x/b)+turb(x))

11
10.11 si31_2001 Animating the Turbulence n The noise function, and hence the turbulence function, can be made time- dependent

12
10.12 si31_2001 Bump Mapping n This is another texturing technique n Aims to simulate a dimpled or wrinkled surface – for example, surface of an orange trick n Like Gouraud and Phong shading, it is a trick – surface stays the same – but the true normal is perturbed, or jittered, to give the illusion of surface bumps

13
10.13 si31_2001 Bump Mapping

14
10.14 si31_2001 How Does It Work? n Looking at it in 1D: original surface P(u) bump map b(u) add b(u) to P(u) in surface normal direction, N(u) new surface normal N(u) for reflection model

15
10.15 si31_2001 How It Works - The Maths! n Any 3D surface can be described in terms of 2 parameters – eg cylinder of fixed radius r is defined by parameters (s,t) x=rcos(s); y=rsin(s); z=t n Thus a point P on surface can be written P(s,t) where s,t are the parameters n The vectors: P s = dP(s,t)/ds and P t = dP(s,t)/dt are tangential to the surface at (s,t)

16
10.16 si31_2001 How it Works - The Maths n Thus the normal at (s,t) is: N = P s x P t n Now add a bump map to surface in direction of N: P(s,t) = P(s,t) + b(s,t) N n To get the new normal we need to calculate P s and P t P s = P s + b s N + b N s approx P s = P s + b s N - because b small n P t similar – P t = P t + b t N

17
10.17 si31_2001 How it Works - The Maths n Thus the perturbed surface normal is: N = P s x P t or N = P s x P t + b t (P s x N) + b s (N x P t ) + b s b t (N x N) n But since – P s x P t = N and N x N = 0, this simplifies to: N = N + D – where D = b t (P s x N) + b s (N x P t ) = b s (N x P t ) - b t (N x P s ) = A - B

18
10.18 si31_2001 Worked Example for a Cylinder n P has co-ordinates: n Thus: n and then x (s,t) = r cos (s) y (s,t) = r sin (s) z (s,t) = t P s : x s (s,t) = -r sin (s) y s (s,t) = r cos (s) z s (s,t) = 0 P t : x t (s,t) = 0 y t (s,t) = 0 z t (s,t) = 1 N = P s x P t :Nx = r cos (s) Ny = r sin (s) Nz = 0

19
10.19 si31_2001 Worked Example for a Cylinder n Then: D = b t (P s x N) + b s (N x P t ) becomes: n and perturbed normal N = N + D is: D : b t *0 + b s *r sin (s)= b s *r sin (s) b t *0 - b s *r cos (s)= - b s *r cos (s) b t *(-r 2 ) + b s *0= - b t *(r 2 ) N :r cos (s) + b s *r sin (s) r sin (s) - b s *r cos (s) -b t *r 2

20
10.20 si31_2001 Bump Mapping A Bump Map

21
10.21 si31_2001 Bump Mapping Resulting Image

22
10.22 si31_2001 Bump Mapping - Another Example

23
10.23 si31_2001 Bump Mapping Another Example

24
10.24 si31_2001 Bump Mapping Procedurally Defined Bump Map

25
10.25 si31_2001 Environment Mapping n This is another famous piece of trickery in computer graphics n Look at a highly reflective surface – what do you see? – does the Phong reflection model predict this? n Phong reflection is a local illumination model – does not convey inter-object reflection – global illumination methods such as ray tracing and radiosity provide this n.. but can we cheat?

26
10.26 si31_2001 Environment Mapping - Recipe n Place a large cube around the scene with a camera at the centre environment map n Project six camera views onto faces of cube - known as an environment map camera projection of scene on face of cube - environment map

27
10.27 si31_2001 Environment Mapping - Rendering n When rendering a shiny object, calculate the reflected viewing direction (called R earlier) n This points to a colour on the surrounding cube which we can use as a texture when rendering eye point environment map

28
10.28 si31_2001 Environment Mapping Example The six views from the teapot Environment Mapped Teapot

29
10.29 si31_2001 Environment Mapping - Limitations n Obviously this gives far from perfect results - but it is much quicker than the true global illumination methods (ray tracing and radiosity) n It can be improved by multiple environment maps (why?) - one per key object reflection mapping n Also known as reflection mapping n Can use sphere rather than cube

30
10.30 si31_2001 Jim Blinn n Both bump mapping and environment mapping concepts are due to Jim Blinn n Pioneer figure in computer graphics keynote/slides.html

31
10.31 si31_2001 Acknowledgements n Thanks again to Alan Watt for many of the images n Flame simulation movie from Josef Pelikan, Charles University Prague n Environment mapping examples from Mizutani and Reindel, Japan

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google