Simulating Decorative Mosaics Alejo Hausner University of Toronto Mosaic Tile Simulation • Reproduce mosaic tiles – long-lasting (graphics is ephemeral) – realism with very few pixels – pixels have orientation Simulating Decorative Mosaics 2 Real Tile Mosaics Simulating Decorative Mosaics 3 Real Mosaics II Simulating Decorative Mosaics 4 The Problem • Square tiles cover the plane perfectly • Variable orientation --> loose packing • Opposing goals: – non-uniform grid – dense packing Simulating Decorative Mosaics 5 Previous Work • Romans: algorithm? • Relaxation (Haeberli’90) – scatter points on image – voronoi region = tile – tiles not square Simulating Decorative Mosaics 6 Previous Work • Escherization (Kaplan’00) – regular tilings – use symmetry groups • Stippling (Deussen’01) – voronoi relaxation – round dots Simulating Decorative Mosaics 7 Voronoi Diagrams • What are they – sites, and regions closest to each site • How to compute them? – Divide & conquer (PS) – sweepline (Fortune) – incremental Simulating Decorative Mosaics 8 Voronoi Diagram Simulating Decorative Mosaics 9 Centroidal Voronoi Diagrams • VD sites are not centroids • Lloyd’s method (k-means) – move site to centroid, – recalculate VD – repeat Simulating Decorative Mosaics 10 Centroidal Voronoi Diagrams • VD sites are not centroids • Lloyd’s method (k-means) – move site to centroid, – recalculate VD – repeat Simulating Decorative Mosaics 11 Centroidal Voronoi Diagrams • VD sites are not centroids • Lloyd’s method (k-means) – move site to centroid, – recalculate VD – repeat Simulating Decorative Mosaics 12 Centroidal Voronoi Diagram Simulating Decorative Mosaics 13 CVD uses • Nature: – honeycombs – giraffe spots • Sampling – approximates Poisson-disk (low discrepancy) – can bias for filter function Simulating Decorative Mosaics 14 Hardware-assisted VD’s • SG99: Hoff et al – – – – – uses graphics hardware draw cone at each site orthogonal view from above each region is single-coloured can extend to non-point sites (curves) Simulating Decorative Mosaics project 15 Key idea r • Cone is distance function h – radius = height • Non-euclidean distance: – different kind of cone – eg square pyramid – can be non-isotropic (rotate pyramid around Z) (a,b) h (x,y) h=|x-a|+|y-b| Simulating Decorative Mosaics 16 Basic Tiling Algorithm • Compute orientation field (details later) • scatter points on image – use pyramids to get oriented tiles • apply Lloyd’s method to spread sites evenly • draw oriented tile at each site Simulating Decorative Mosaics 17 Details • Lloyd’s method: – To compute centroid of each Voronoi region: 1: read back pixels, 2: get average (row,col) per colour 3: convert back to object coords. Simulating Decorative Mosaics 18 Lloyd Near Convergence Simulating Decorative Mosaics 19 Orientation Field • Choose edges that need emphasis • compute generalized VD for edges (Hoff99) • get gradient vector of distance field – distance = z-buffer distance • gradient orientation = tile orientation – points away from edges Simulating Decorative Mosaics 20 Orientation Field Simulating Decorative Mosaics 21 Edge Discrimination • Must line up tiles on edges • But both sides of edge oriented same o – square tiles ==> 180 rotational symmetry • Use hardware – draw edge thick, different colour – voronoi regions move away from edges – leaves gap where edge is. Simulating Decorative Mosaics 22 Tiles Straddle Edge Simulating Decorative Mosaics 23 Thick Edge: Centroid Repelled Simulating Decorative Mosaics 24 After 10 Iterations Simulating Decorative Mosaics 25 Original Voronoi Diagram Simulating Decorative Mosaics 26 After 20 Iterations Simulating Decorative Mosaics 27 One Tile per Voronoi Region Simulating Decorative Mosaics 28 Thinner Tiles Simulating Decorative Mosaics 29 Round Tiles Simulating Decorative Mosaics 30 Rhomboidal Tiles Simulating Decorative Mosaics 31 Tiles are not Pixels 4000 tiles 4000 pixels Simulating Decorative Mosaics 32 More Pictures Simulating Decorative Mosaics 33 “Painterly” Rendering Tile = Paint stroke Simulating Decorative Mosaics 34 Summary • New method for packing squares on curvilinear grid • Minimizes sum of particle distances Simulating Decorative Mosaics 35 Further Work • Reduce “grout” – final pass: adjust tile shapes • currently don’t use adjacency info – use divergence of orientation field · • Improve colour – real tiles have fixed colour set: Dither? How? Simulating Decorative Mosaics 36