SE 313 – Computer Graphics Lecture 12: Lighting and Materials Lecturer: Gazihan Alankuş 1 Projects • • • • Weekly reports Video Sources Final demo 2 Projects • Weekly reports – Help me understand your own contribution • Video • Sources • Final demo 3 Projects • Weekly reports • Video – Prepare a video that demonstrates your project – Example: https://www.youtube.com/watch?v=auurLcPFGrs&list=PL0E431E2DD85623D5&index=6 – Should include: • A title scene with your names, IEU, SE 313, my name • Project description and demonstration • Between 2-5 minutes – Upload to YouTube with this text(text in [brackets] are optional): • Term project for SE 313 Computer Graphics in İzmir University of economics. [your names (optional)] İzmir Ekonomi Üniversitesi SE 313 Bilgisayar Grafiği dönem projesi. [your names (optional)] • Sources • Final demo 4 Projects • Weekly reports • Video • Sources – Give me all your source files – Include a README file on how to use them • Step-by-step instructions • Versions of software that you used • External factors – If you had external help (downloaded models and textures, help you received from someone else, etc.), clearly write them. – Was this a project that was a joint project with some other class? If so, write it down. – If you don’t do these, you claim that it was all your work and was for this class only. If I prove that it wasn’t, you have cheated and will be punished according to university rules. • Final demo 5 Projects • • • • Weekly reports Video Sources Final demo – Set up a half-hour meeting with me – The last day for the meeting is 18th of January • My available times may be filled before that. Be quick and try to find a time. – Send everything (video, sources, etc.) me 24 hours before that 6 Lighting and Materials • Lighting – Real-time (local illumination) – Better (global illumination) • Materials and surface detail – Normals – Materials 7 Lighting and Materials • Lighting – Real-time (local illumination) – Better (global illumination) • Materials and surface detail – Normals – Materials 8 Lighting • Projecting 3D geometry into 2D is not enough. Projecting the edges only Projecting the faces Copying the object’s colors in the 2D projection does not look good 9 Lighting • We see objects through light bouncing from them • We see different tones according to the way light bounces • Computers need to simulate this to create realistic pictures 10 Lighting • Simulating light is very difficult. There can be infinite number of rays coming from a light source. We need something fast! 11 Lighting • Observation: if the light can bounce directly from the light source to the eye, the surface looks lighter 12 Lighting • Observation: if the light cannot bounce directly, then the face looks darker • We use these observations to simulate lighting • We use the normal vector to determine the orientation of the face 13 Two types of lighting • Diffuse reflection – We see darker color even if light does not bounce directly to the eye • Specular reflection – We only see color when light bounces directly to the eye 14 Ambient lighting • There is so much light that comes from the sun, light bounces from everything in the environment • Even if you are in a closed room in daytime, there is light in the environment 15 The three types of lighting 16 Emission • Emission is the fourth type of lighting • Simulates objects that emit light by themselves (if it’s a lamp, for example) 17 Different colors for different lighting 18 Simulating lighting in real time • These four types of light calculations (ambient, diffuse, specular, emission) help us simulate lighting in computers in real-time. • This way we can have video games that look real and react instantly 19 Lighting and Materials • Lighting – Real-time (local illumination) – Better (global illumination) • Materials and surface detail – Normals – Materials 20 Global Illumination • Simulating light locally is an approximation. Light bouncing from nearby objects is ignored. • There are algorithms to simulate light better. 21 Radiosity • Relationships between faces of polygons are computed to see whether they would illuminate or shade each other • Slower than local illumination, better results 22 Ray tracing • Light is reversible • Rather than simulating the actual lights, trace light rays that would come to the eye • Start from the eye and see whether you reach a light source after bouncing on objects • Slower than radiosity. Very real-looking results. 23 How they are used in practice Local Illumination • Real-time applications • Video Games • The image does not have to be very realistic • Renders very quickly • What you see in Blender 3D view Global Illumination • Batch applications • Movies • The image has to look very real • Renders slowly – Render farms with many supercomputers are used for long movies • What you see in Blender Render view 24 Lighting and Materials • Lighting – Real-time (local illumination) – Better (global illumination) • Materials and surface detail – Normals – Materials 25 Normals • Surface normals determine the color tones that the surface will have because of lights 26 Normal Mapping • Surface normals determine the color tones that the surface will have because of lights • Surfaces with such detail requires too much geometric detail and renders slowly. • We fake it by using normals from a detailed model on a non-detailed model 27 Normal Mapping • With normal mapping, you can have a mesh with less detail that looks like another mesh with more detail 28 Lighting and Materials • Lighting – Real-time (local illumination) – Better (global illumination) • Materials and surface detail – Normals – Materials 29 Materials • Things that determine the color of a surface – Properties of lights – Properties of surfaces 30 Materials • Things that determine the color of a surface – Properties of lights • Position • Colors and intensities for ambient, diffuse, specular components – Properties of surfaces • Normals • Colors for how ambient, diffuse and specular components will be reflected • Emission 31 Materials • Matching properties of the light and the surface are multiplied together Diffuse color of the light Diffuse color of the material Visible diffuse color on the surface LR LG LB MR MG MB SR SG SB Red light White material Red surface (1, 0, 0) (1, 1, 1) (1, 0, 0) 32 Next week • We will practice these in Blender next week • Now we will have a lab that you will be graded in 33 Lab • Modeling • Texturing 34 Lab: Modeling • Starting from a cube, model this table. 35 Lab: Modeling • Model the legs by subdividing the bottom face, extrude individually, scale, translate, extrude • Model the book on the table by creating the rectangle by cutting the edges one by one using the knife tool. Then, extrude it up. 36 Lab: Modeling • Model the drawer using extrude. • After taking the drawer out, extrude inwards to create the inside of the drawer. 37 Lab: Texturing • Open the redwood texture in the main uv mapping so that the whole model has the redwood texture. 38 Lab: Texturing • Map the book cover on the book cover on top of the table. • Create a separate UV map for the book and name it “book” • Map the book image in that UVMap • Using the clone brush, copy that to the main texture 39 Lab: Texturing • Create a separate UV map for the inside of the drawer and name it “drawer”. • Map the junk in it 40 Lab: Texturing • Use the clone brush to paint into the main UV map from the drawer UV map • Leave some empty places to give a dirty look. 41 Lab: Bonus • Bonus1: Use other wood textures to give a more detailed view to the table • Bonus2: create other geometry on top of the table and texture them with images you find on the internet 42