BACHELOR's THESIS Implicit Procedural Textures
Total Page:16
File Type:pdf, Size:1020Kb
2007:12 HIP BACHELOR'S THESIS Implicit Procedural Textures as a means of saving texture memory Joakim Lindqvist Luleå University of Technology BSc Programmes in Engineering BSc programme in Computer Engineering Department of Skellefteå Campus Division of Leisure and Entertainment 2007:12 HIP - ISSN: 1404-5494 - ISRN: LTU-HIP-EX--07/12--SE Implicit Procedural Textures as a means of saving texture memory Page | I Joakim Lindqvist LTU Skellefteå 6/4/07 Abstract This thesis explores the possibility of exchanging regular textures with procedural textures. It focuses on classic procedural textures like different types of rock and sand. Most time is spent on implicit textures generation on a GPU, this means a limit to the types of algorithms that can be used. As such, much of the work focuses on noise implementations. The goal is to lower video memory usage by changing regular sampled textures with procedural ones. In the end a few ways of creating textures with a satisfactory level of detail is suggested using a blend of regular textures and procedural ones. Sammanfattning Detta examensarbete undersöker möjligheterna att byta ut vanliga texturer mot procedurella texturer. Den fokuserar på klassiska procedurella texturer som exempelvis sten och sand. Jag jobbar mest med implicita texturer körda på GPUn vilket medför en del begränsningar i vilka algoritmer som kan köras. På grund av detta ligger väldigt mycket fokus på olika noise implementationer. Målet är att minska texturminnet som används igenom att ändra vanliga texturer med procedurella motsvarigheter. I slutändan presenterar jag några sätt att skapa texturer med tillräckliga detaljer där vi använder en blandning av vanliga texturer och procedurella. Page | II Implicit Procedural Textures as a means of saving texture memory Joakim Lindqvist LTU Skellefteå 6/4/07 Preface This thesis was written at Avalanche Studios with the purpose of investigating how procedural texture could be used to save memory, bandwidth and sample usage in their graphics engine by replacing regular high resolution textures with procedural counterparts. The main focus was the textures used in the terrain engine since they are classic examples of textures easily created procedurally I would like to thank everyone at Avalanche for being so nice and making me feel welcome especially my mentor Gustav Taxén. Joakim Lindqvist ([email protected]), Stockholm, 4. Jun. 2007 Implicit Procedural Textures as a means of saving texture memory Page | III Joakim Lindqvist LTU Skellefteå 6/4/07 Table of Contents ABSTRACT ......................................................................................................................... I SAMMANFATTNING ............................................................................................................. I PREFACE ..........................................................................................................................II INTRODUCTION ................................................................................................................. 1 BACKGROUND ........................................................................................................ 1 THESIS O UTLINE ..................................................................................................... 1 THEORY ........................................................................................................................... 2 P ROCEDURAL TEXTURING ............................................................................................. 2 TOOLS .............................................................................................................. 3 S HADERS ............................................................................................................ 4 S HADING ............................................................................................................ 4 P ATTERN ............................................................................................................ 4 N OISE ............................................................................................................... 5 Noise Terminology........................................................................................... 5 Value and Gradient Noise................................................................................... 5 Perlin Noise................................................................................................... 6 Improved Perlin Noise....................................................................................... 6 Simplex Noise................................................................................................ 7 mNoise......................................................................................................... 7 Fractal Sums .................................................................................................. 8 Aliasing........................................................................................................ 9 IMPLEMENTATION ............................................................................................................. 10 IMPLICIT AND E XPLICIT TEXTURING ................................................................................... 10 THE NOISES ........................................................................................................ 10 THE TEXTURE ...................................................................................................... 10 C OMPILERS ........................................................................................................ 11 P ERMUTATION TABLE ............................................................................................... 11 D ECALS ............................................................................................................ 12 F RACTAL S UMS .................................................................................................... 12 C REATING A COPY OF A REAL TEXTURE .............................................................................. 12 ALIASING ........................................................................................................... 13 B LENDING .......................................................................................................... 13 E XPLICIT NORMAL M AP............................................................................................. 13 RESULTS .........................................................................................................................14 DISCUS SION .................................................................................................................... 16 C ONCLUSION ....................................................................................................... 16 Shaders...................................................................................................... 16 Tools.......................................................................................................... 16 Higher dimension noise.................................................................................... 16 Drawbacks................................................................................................... 17 Other advantages of implicit procedural textures....................................................... 17 How to create the 2D textures we want.................................................................. 17 F URTHER WORK .................................................................................................... 18 REFERENCE S ...................................................................................................................19 Page | IV Implicit Procedural Textures as a means of saving texture memory Joakim Lindqvist LTU Skellefteå 6/4/07 Illustration Index ILLUSTRATION 1: PERLIN NOISE ............................................................................................ 2 ILLUSTRATION 2 : FX COMPOSER .......................................................................................... 3 ILLUSTRATION 3 : SMOOTHSTEP FUNCTION [1]........................................................................ 5 ILLUSTRATION 4: PROCEDURAL BRICK TEXTURE [1].................................................................. 5 ILLUSTRATION 5 : IMPROVED PERLIN NOISE ............................................................................ 6 ILLUSTRATION 6 : SIMPLEX NOISE ..........................................................................................7 ILLUSTRATION 7 : M = 1........................................................................................................8 ILLUSTRATION 8 : M = 61...................................................................................................... 8 ILLUSTRATION 9 : M = 151.....................................................................................................8 ILLUSTRATION 10 : 1/F FBM ...................................................................................................8 ILLUSTRATION 11 : TURBULENCE ...........................................................................................8 ILLUSTRATION 12 : THE MATERIAL ATLAS TEXTURE .................................................................11 ILLUSTRATION 13 : PROCEDURAL TEXTURE WITH DECALS ........................................................12 ILLUSTRATION 14 : PROCEDURAL TEXTURE WITHOUT FILTERING ...............................................13