TERRAIN SET09115 Intro to Graphics Programming. Breakdown  Basics  What do we mean by terrain?  How terrain rendering works  Generating terrain 

Slides:



Advertisements
Similar presentations
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
Advertisements

Exploration of advanced lighting and shading techniques
POST-PROCESSING SET09115 Intro Graphics Programming.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 1/16 Deferred Lighting Deferred Lighting – 11/18/2014.
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Exploration of bump, parallax, relief and displacement mapping
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
Cs123 INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Andries van Dam Texture Mapping Beautification of Surfaces 1/23.
The Art and Technology Behind Bioshock’s Special Effects
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Week 11 - Wednesday.  Image based effects  Skyboxes  Lightfields  Sprites  Billboards  Particle systems.
 Engineering Graphics & Introductory Design 3D Graphics and Rendering REU Modeling Course – June 13 th 2014.
Computer Graphics - Class 10
(conventional Cartesian reference system)
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
Basic Rendering Techniques V Recognizing basic rendering techniques.
Week 14 - Wednesday.  What did we talk about last time?  Collision handling  Collision detection  Collision determination  Collision response  BSPs.
GEOMETRY SHADER. Breakdown  Basics  Review – graphics pipeline and shaders  What can the geometry shader do?  Working with the geometry shader  GLSL.
Guilford County Sci Vis V204.01
SET09115 Intro Graphics Programming
Computer Graphics An Introduction. Computer Graphics 26/9/2008Lecture 12 What’s this course all about? We will cover… Graphics programming and algorithms.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
Shading (introduction to rendering). Rendering  We know how to specify the geometry but how is the color calculated.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
Modelling and Simulation Types of Texture Mapping.
Shading. What is Shading? Assigning of a color to a pixel in the final image. So, everything in shading is about how to select and combine colors to get.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
Week 11 - Thursday.  What did we talk about last time?  Image processing  Blurring  Edge detection  Color correction  Tone mapping  Lens flare.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Textures.
Jonathan M Chye Technical Supervisor : Mr Matthew Bett 2010.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Steve Sterley. Real World Lighting Physical objects tend to interact with light in three ways: Absorption (black body) Reflection (mirror) Transmission.
Illumination and Shading How to shade surfaces based on the position,orientation,characteristics of the surfaces and the light sources illuminating them.
CSE 381 – Advanced Game Programming GLSL Lighting.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
BUMP-MAPPING SET09115 Intro to Graphics Programming.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Maths & Technologies for Games Graphics Optimisation - Batching CO3303 Week 5.
Local Illumination and Shading
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Lighting and Shading Part 2. Global Ambient Light There are at least 8 OpenGL lights and 1 Global Ambient Setting the Global Ambient globalAmbient[] =
Graphics for Games Particle Systems CO2301 Games Development 1 Week 23.
MP3.. Start at the very beginning. Almost. Either start from nothing yourself, or use the empty template for this MP. Run through the provided files are.
Applications and Rendering pipeline
Shaders, part 2 alexandri zavodny.
Scene Manager Creates and places movable objects like lights and cameras so as to access them efficiently, e.g. for rendering. Loads and assembles world.
Ying Zhu Georgia State University
Week 7 - Monday CS361.
Tips for Shading Your Terrain
Deferred Lighting.
The Graphics Rendering Pipeline
Basic Rendering Techniques
Chapter 10: Computer Graphics
Chapter 14 Shading Models.
CSE 381 – Advanced Game Programming Terrain
UMBC Graphics for Games
Selective material rendering
Computer Graphics Module Overview
CS-378: Game Technology Lecture #4: Texture and Other Maps
Computer Graphics Introduction to Shaders
Computer Graphics Material Colours and Lighting
Chapter 14 Shading Models.
Presentation transcript:

TERRAIN SET09115 Intro to Graphics Programming

Breakdown  Basics  What do we mean by terrain?  How terrain rendering works  Generating terrain  Working with height maps  Rendering realistic terrain  Texturing

Recommended Reading  Non specific  Reimer has a tutorial on terrain rendering in XNA   The principles are essentially the same

Basics

Review  Texturing is the process of applying image data to a surface  Wall can be defined using simple geometry  Image of a brick wall can be added to make it a brick wall  Image of wooden wall can be added to make it a wooden wall  Texturing is the third part of what can be considered core 3D rendering  Geometry, Lighting, Texturing

Review  Shaders are small programs that run on the GPU  Shaders allow us to implement effects that we may wish for in our rendered scene  Lighting, texturing being the most basic  Three types of shader  Vertex  Geometry  Fragment (or pixel)

What is Terrain Rendering?  Terrain rendering is the process of rendering realistic world surfaces  Can be real-world or alien world  The goal of terrain rendering is to provide an outdoor environment for your game  Even cityscapes can have underlying terrain  Terrain rendering generally focuses on the development of hills, valleys, mountains, etc.  These can be procedurally generated

Example

How Terrain Rendering Works  Terrain rendering utilises base triangle meshes, manipulated by a height map, with relevant lighting and texturing added  Four key concepts  Generation of a triangle grid  Reading of texture data to set vertex heights  Generation of normals for each vertex  Texturing / colouring of vertices based on height / change in height

Triangle Grid  The basic part of a terrain is a large, flat grid of triangles  A 2D array of 3D vertices  Each vertex initially has a height of 0  The heights of each vertex are manipulated, leading to a terrain like effect

Height Map  To get the heights of an individual vertex, we use a height map  Each pixel of the texture represents a height value of the terrain  Dark low, light high

Texturing and Lighting  Finally, we add texturing and lighting to the terrain to get the effect we want  Normals have to be generated (or read from an image)  Textures can be blended

Question?

Generating Terrain

Height Map Examples

Terrain Mesh  The goal is to create a triangle mesh that represents the terrain to be rendered  Each vertex has a height based on the colour of the height map  Some smoothing may be required

Texture Data  As you know, a texture is just a 2D array of pixels  Each pixel has an RGB(A) value associated with it when it is read in  These pixels can be analysed to determine there colour  We can use the intensity calculation from last week  This value can then be used to set the individual y components of our vertices

Creating a Height Map  Sometimes you will want to create a height map from real world data  You can normally acquire height data from somewhere  Sometimes you may want your artist to generate your height map  Think Sim City or similar  You can also generate this map yourself  Procedural  Bryce (

Filtering and Smoothing  Depending on how you get your height data, you might have a limited range  For example, if you used the red component, you only have 255 unique values  Technique is to take these values as large steps, and then filter based on the neighbouring vertex heights  Take the average of the vertex and its eight neighbours

Generating Normals  For each vertex, we have to also generate the normals  Generally, we calculate based on the neighbouring vertices  Use cross product to generate  Can also use normal maps  Coming up next week

Lighting a Terrain  Once we have a terrain and the normals, we can go about lighting it  Use the same techniques as before  Ambient light  Diffuse light  Specular light (depends on the terrain)  We can also use occlusion maps and other light maps to help provide more realistic lighting  Longer to generate

Example

Questions?

Rendering Realistic Terrain

Colouring by Height  Simplest method to increase believability of the terrain is to colour vertices based on height  Easily done in the shader  Choose a number of colours and based on height use that colour

Colouring by Height Change  We can also colour based on the change of height  Steeper slopes have different colours  Usually we want to combine this with colouring by height to provide a more realistic terrain  Height used to determine base colour  Steepness used to determine colour to blend with

Texturing by Height  We can perform the same operation as colouring using textures  Normally we want to blend textures between heights  Looks too artificial otherwise

Texturing by Height Change  We can also take into account the change in height as a blend factor for the terrain  Provide cliff faces  This will provide the most realistic terrain using standard techniques

Using Multiple Terrain Maps  Sometimes we want to use multiple terrain maps to provide other features  For example a road  Blending textures allows us to create realistic features in our terrain

Grass and Vegetation  One final step in generating terrain is adding vegetation  Trees  Grass  We won’t be doing this in the practical, but if you are interested you should do some further reading  Common technique for adding grass is billboarding  Common technique for adding trees is instancing

Billboarding  Billboarding involves rendering sprites in world space  As sprites are 2D, they always face the camera  Gives a weird effect when moving  Billboarding is often used in particle effects

Example

Questions?

To do this week…  Practical this week is on lighting  Ambient, diffuse, specular, phong  Long practical, with lots of shade usage  Terrain will be the last practical we do  Three weeks time  If you are interested, there are numerous tutorials online so you don’t have to wait

Summary  Terrain rendering is one of the commonest techniques used in 3D games  Realistic outdoor environments being the goal  Generating terrain is actually quite easy  Height map  Triangle mesh  Terrain textures  You normally want to optimise as well  Sub grids of the terrain for culling