Procedural Textures Generation Adaptation into a Unity tool Treball de Final de Grau Grau en Disseny i Desenvolupament de Videojocs Alumne: Busquets Duran, Roger Pla 2014 Director: Zuñiga Zarate, Anna Gabriela Roger Busquets Procedural Texture Generation Summary 3 Keywords 3 Tables 4 Figures 4 Glossary 6 1. Introduction 7 1.1. Motivation 8 1.2. Problem Formulation 8 1.3. General Objectives 9 1.4. Specific Objectives 9 1.5. Project Scope 10 2. State of the Art 11 2.1. PBR 11 2.1.1. Diffuse texture 11 2.1.2. Normal maps 12 2.1.3. Height map 12 2.1.4. Specular Map 13 2.1.5. Ambient Occlusion 14 2.1.6. Roughness/ Glossiness map 14 2.1.7. Metallic map 14 2.1.8. Grayscale Images 14 2.2. Procedural Content Generation 15 2.2.1. Introduction to PCG 15 2.2.2. Procedural Texture Generation 16 2.2.3. Noise Generation 16 2.2.4. Common filters 18 2.3 Similar applications 20 2.3.1 Substance designer 20 2.3.2. Libraries 21 2.4. Game Engines 21 2.4.1 Unity3D 21 2.5. Market Study 22 3. Project Management 23 3.1. Tools and Procedures 24 3.2. Validation Tools 24 1 Roger Busquets Procedural Texture Generation 3.3. SWOT 24 3.4. Risks and Contingency Plan 25 3.5. Initial Costs Analysis 26 4. Methodology 28 4.1. Feature-Driven Development 28 4.1.1. Project Model 28 4.1.2 Feature Development 29 4.2. Trello 29 5. Development 30 5.1. Basic Interface 30 5.1.1. Editor Window 31 5.1.2. Node Editor 31 5.1.3. User Interaction 35 5.1.4 Node Inspector 36 5.2. Texture filtering 37 5.2.1 GPU vs CPU 37 5.2.1.1. Unity Compute Shaders 38 5.3. Noises 40 5.3.1 Perlin Noise 40 5.3.1.1. Perlin Variations 42 5.3.2. Worley Noise 43 5.3.3. Fractals 45 5.4. Blending 47 5.5. Domain Warping 49 5.6. Generating Normal Maps 51 5.7. Blur 53 5.8. Image Levels 55 5.9. Unity Mask Map 57 5.10. Tileable Patterns 58 5.11. Color Gradients 61 5.12. Generating Unity Materials 63 6. Bibliography 67 2 Roger Busquets Procedural Texture Generation Summary This is a description document that explains the procedure and development of the “Procedural Texture Generator” tool for Unity. It is a node-based editor that allows the user to create textures by generating different types of noises, combining them, and using several filters to generate the different textures needed for PBR materials. In this document there are described the techniques and procedures used for procedural texturing and the adaptation into a Unity tool, as well as all the difficulties encountered during the development. Keywords Procedural generation, Textures, Unity, Videogames, Programming, C# Links Source code: https://github.com/rogerbusquets97/ProceduralTextureGenerator Github Release (Import it as a Unity package): https://github.com/rogerbusquets97/ProceduralTextureGenerator/releases/tag/1.0 3 Roger Busquets Procedural Texture Generation Tables T 3.1 - Gantt diagram 23 T 3.2 - SWOT table 25 T 3.3 - Risks and contingency plan 26 T 3.4 - Hours costs 27 T 3.5 - Costs 28 Figures F 1.1 - Procedural texture sample 7 F 2.1 - Diffuse Texture sample 11 F 2.2 - Normal map sample 12 F 2.3 - Height blending sample 13 F 2.4 - Heightmap sample 13 F 2.5 - Ambient occlusion sample 14 F 2.6 - Perlin Noise sample 16 F 2.7 - Fractal Perlin noise sample 17 F 2.8 - Ridged Perlin noise sample 17 F 2.9 - Billow Perlin noise sample 17 F 2.10 - Voronoi noise sample 18 F 2.11 - Voronoi noise sample 2 18 F 2.12 - Substance designer editor 20 F 4.1 - FDD sample 29 F 4.2 - Trello interface 30 F 5.1 - Editor Window 31 F 5.2 - Editor Window C# code 32 F 5.3 - Node base C# class 33 F 5.4 - GUI Boxes 34 F 5.5 - Connection point C# class 34 F 5.6 - NodeConnection C# class 35 F 5.7 - Nodes Connections 35 F 5.8 - Processing events C# code 36 F 5.9 - Context Menu C# code 37 F 5.10 - Custom Inspector for nodes 38 F 5.11 - Basic Unity Compute shader 40 F 5.12 - Initializing compute shaders 40 F 5.13 - Sending data to compute shaders 41 F 5.14 - Perlin Gradient Vectors 41 F 5.15 - Perlin Distance Vectors 42 F 5.16 - Perlin Direction Values 42 F 5.17 - Perlin Generated Texture 42 F 5.18 - Billow Generated Texture 43 F 5.19 - Ridged Generated Texture 43 F 5.20 - Worley Generated Texture 44 4 Roger Busquets Procedural Texture Generation F 5.21 - Worley: F2 45 F 5.22 - Worley: F2 - F1 45 F 5.23 - Worley: 1 - F1 45 F 5.24 - Worley: F1 * F2 45 F 5.25 - HLSL Fractal code 47 F 5.26 - Perlin Fractal 47 F 5.27 - Billow Fractal 47 F 5.28 - Octaves variations 48 F 5.29 - Worley fractals 47 F 5.30 - Blended noises 48 F 5.31 - Warped fractal 51 F 5.33 - HLSL warp code 52 F 5.34 - Height map to Normal map 53 F 5.35 - Normal map applied 53 F 5.36 - Kernel Convolution 54 F 5.37 - Gaussian Kernel 54 F 5.38 - Blurred Fractal 55 F 5.39 - Mask 56 F 5.40 - Image Leveling HLSL code 58 F 5.41 - Mask Map Node 58 F 5.42 - Mask Map 58 F 5.43 - Procedural circle HLSL code 60 F 5.44 - Procedural Circle 60 F 5.45 - Sided polygons HLSL code 61 F 5.46 - 3 sided procedural polygons 61 F 5.47 - Tileable Pattern 62 F 5.48 - Brick Pattern 63 F 5.49 - Procedural box HLSL code 63 F 5.50 - Gradient Brick Pattern 64 F 5.51 - Detailed Brick Pattern 64 F 5.52 - Micro detailed textures 65 F 5.53 - Color Blending 66 F 5.54 - Color interpolation 66 F 5.55 - Color Gradient 67 F 5.56 - Mud Heightmap 68 F 5.57 - Mud Normal Map 69 F 5.58 - Mud Smoothness Map 69 F 5.59 - Mud Diffuse Map 69 F 5.60 - Unity Material Inspector 70 F 5.61 - Unity Final Material 71 5 Roger Busquets Procedural Texture Generation 6 Roger Busquets Procedural Texture Generation Glossary G UI - Graphical User Interface. Visual elements through which the user interacts with the application. P BR - Physically based rendering. Computer graphic discipline that attempts to simulate lightning by using physics. P CG - Any content created by a computer through an algorithm. F DD - Feature Driven Development. Agile development methodology. G PU - Graphics Processing Unit. Computer component specialized in graphics rendering. R GB - Red, Green, Blue channels of a pixel color. 7 Roger Busquets Procedural Texture Generation 1. Introduction In this document I will analyze how procedural textures are generated, their pros and cons, as well as how to use Unity’s in-editor GUI system to create tools, in this case how to create a node based editor. Regardless of its implementation in Unity, the theory applied could be used in any implementation. Procedural content is any content that has been generated by a computer using an algorithm. Procedural generation is being used in so many areas of video games, from procedural terrain generation to procedural animations. Its main strength is that using procedural content, we can speed up the production process. One of its main applications is, of course, procedural texture generation. As we know textures are used in video games to apply color to our models (diffuse texture), and to add extra detail (normal maps, occlusion maps, roughness maps, ...). Traditionally all this textures were hand-made by artists or taken from photos. Even though using, those methodologies we can achieve good results, and we have all the control over the look of each texture, the process to generate them is quite long. To speed up the texture creation process we will use procedural generation. Procedural generated textures are those textures that are created by a computer through an algorithm. (different algorithms will be explained later on). Even though procedural textures can generate good looking results, we do not have much control over it so most likely most of the textures generated will end up looking alike. So, the next step is to allow some user interaction over the procedural creation process. The idea is to use different procedurally created textures as a base and apply transformations and filters to them so the user can get to the desired result, and that is the main purpose of this tool, to allow users to generate procedural textures and tweek them as they want to fill their needs. In the image below that function has been used to calculate the grayscale color for each pixel. F1.1- Procedural texture sample 8 Roger Busquets Procedural Texture Generation 1.1. Motivation I am not really skilled when it comes to art, so whenever I have tried to make a game one of the most difficult tasks that I have encountered has been the texture creation process. Even though we can get textures for free from different websites, most of the time you do not find exactly what you were looking for, so I end up discovering procedural texture generation. There are several software applications specialized in procedural texture creation, most of them use a node based editor interface.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages80 Page
-
File Size-