11/27/2016

2 THIS WEEK’S OBJECTIVES

The main goal is to get upto scratch with MAX and do a few things we explored in POVray:

1. CSG 2. Material and Texture: a) Material properties b) Texture maps c) Image Maps MATERIALS REVISITED d) Global Illumination Material Modelling in 3DS Max e) Environment Maps 3. Lights

3 MATERIALS MODELLING 4 MODELLING COMPLEXITY

Visual appearance of objects depends on properties of the materials they are made of. Modelling implies manual creation of objects by artists/modellers

In order to achieve realism or complexity of the real world, several options

 Lots of manual work  Scanning  Procedural generation

Materials in MetaSL © NVIDIA ARC GmbH

How we represent materials depends on the rendering technique used

 Realistic techniques require physical parameters e.g. density, index of refraction, etc.  Often, intermediate information is used (“colour”) to allow more direct control over appearance

Surface Appearance Scanner at Columbia University © Columbia Univ.

5 TEXTURES 6 RECAP: PHONG ILLUMINATION MODEL

Light reflected off a point always depends on some (or all) of the following vectors: DIFFUSE REFLECTION is the main Textures add complexity to scenes without additional geometry contributor to the colour of an object. 풏 The colour (intensity) of light reflected off an object is determined by:  Approximate using an image how additional geometry will affect the final rendering 풗 • Light Intensity (푅), 풍 • Diffuse reflectance of material (푘푑) 풓 • and the angle between Surface 휃 휙 Many different types: Normal and the Light Direction 휃.  Diffuse map (most common, this is what we’ve used): assigns colours to points on an object 퐼푑 = 푅. 푘푑. 푐표푠θ  Ambient, specular, gloss maps: assigns different illumination parameters (as in Phong Model) 풏: Normal to surface 풗: Viewer direction 풍: Light Direction 풓: direction of reflection  Bump, normal, displacement maps: affects the illumination by modifying normal etc.

 Reflection, refraction maps (approximating more complex global illumination effects) SPECULAR REFLECTION causes small glossy highlights on the surface of smooth objects Intensity is affected by • Light Intensity (푅) • Specular reflectance of material (푘푠) • Glossiness/shininess (훼) • Angle between Viewer and Direction of Reflection 휙 AMBIENT ILLUMINATION caters for randomly scattered light in the scene. Multiply ambient light in scene (푅푎) with 훼 ambient reflectivity (푘푎) 퐼푠 = 푅. 푘푠. cos 휙 퐼 = 푅. 푘 DIFFUSE MAP GLOSS MAP BUMP MAP REFLECTANCE MAP 푎 푎

1 11/27/2016

7 SHADING ALGORITHM (A.K.A. SHADER) 8 RECAP: RENDERING EQUATION

N.B. No need to understand this equation, but it is important to know what factors affect it

Light received Occlusion / Emission from a point distance

퐼 푥, 푥′ = 푔 푥, 푥′ [휀 푥, 푥′ + න 휌 푥, 푥′, 푥′′ 퐼 푥′, 푥′′ 푑푥′′] 푆

Reflectance: Reflected Light Incoming Light

Local Illumination: Diffuse Repeat the process of calculating illumination across the surface of each Specular object – we can take shortcuts by calculating lighting just once for each Ambient vertex – and then interpolating between vertices Global Illumination Reflection Transmission / refraction

퐼 푥, 푥′ = 푔 푥, 푥′ [휀 푥, 푥′ + න 휌 푥, 푥′,푥′′ 퐼 푥′,푥′′ 푑푥′′] 퐼 푥, 푥′ = 푔 푥, 푥′ [휀 푥, 푥′ + න 휌 푥, 푥′,푥′′ 퐼 푥′,푥′′ 푑푥′′] 푆 푆 9 10 DIFFUSE MAP AFFECTS: Reflected Light SPECULAR MAP Specular Reflected Light

Simplest texturing directly applies a colour to object

 In basic illumination colour is mostly based on diffuse component Specular level + Specular color

 Controls the intensity of specular highlights

Glossiness (“Gloss Map”) / Shininess

 Control the specular exponent in Phong light model  Or roughness in other light models

퐼 푥, 푥′ = 푔 푥, 푥′ [휀 푥, 푥′ + න 휌 푥, 푥′,푥′′ 퐼 푥′,푥′′ 푑푥′′] 푆 11 12 SPECULAR+ GLOSSINESS MAP SELF-ILLUMINATION MAP Emitted Light

A.k.a. Emission

 Models light sources on a surface  Does not depend on surface normal or light sources.

Diffuse Color Specular Color Glossiness

Shiny Specular map allows a subset of object to be Dull shiny (without making the whole object uniformly shiny)

2 11/27/2016

퐼 푥, 푥′ = 푔 푥, 푥′ [휀 푥, 푥′ + න 휌 푥, 푥′,푥′′ 퐼 푥′,푥′′ 푑푥′′] 퐼 푥, 푥′ = 푔 푥, 푥′ [휀 푥, 푥′ + න 휌 푥, 푥′,푥′′ 퐼 푥′,푥′′ 푑푥′′] 푆 푆 13 14 VISIBILITY MAPPINGS Occlusion BUMP MAP All Reflected Light

Displacement Map Use texture as an input to perturb geometric representation

 Shift in texture lookup based on view-ray intersection with heightfield  Can account for occlusions

Opacity Map

 Transparency mapping across primitive

BUMP MAP OBJECT WITH DIFFUSE TEXTURE

퐼 푥, 푥′ = 푔 푥, 푥′ [휀 푥, 푥′ + න 휌 푥, 푥′,푥′′ 퐼 푥′,푥′′ 푑푥′′] 푆 15 16 LIGHT MAPS Incoming Light ENVIRONMENT MAPPING Incoming Light

퐼 푥, 푥′ = 푔 푥, 푥′ [휀 푥, 푥′ + න 휌 푥, 푥′,푥′′ 퐼 푥′,푥′′ 푑푥′′] 푆 Approximation of complex lighting in scene Approximation of incoming light from scene TEXTURED ENVIRONMENT  Pre-computed incident light across 2D surfaces  Global effects, such as reflection and refraction require information on light coming in from the scene  When there are multiple light sources it can be too  But it usually too expensive to illuminate the whole scene complex to calculate how they illuminate surfaces  Approximate “the rest of the scene” as images  If the light and object are not expected to move, we can use static textures that capture the effect of lighting the object LIGHT MAPS ONLY  Very popular technique in computer games

© 2003, Keshav Chana and FLipcode

COMBINED TEXTURES AND

18

For 2D textures, we need a 3D to 2D mapping  Sometimes called a “projector function”

Object Space UV-MAPPING  Each vertex in the model will need a (u,v) co-ordinate  Normally defined by the artist and added to the vertex stream

3 11/27/2016

19 UV MAPPINGS

LIGHTS

21 22 LIGHTS Positional/Point Light: light source Directional Light: light source is near – distorts shadow is far away Positional Light Source: Angle of incoming light changes across a surface; This in turn affects colour at different points.

Directional Light Source: source is very distant thus the angle of incoming light remains (almost) constant

23 LIGHTING 24 LIGHT AND SHADOW

On the Command Panel: When you create a lightsource, you can choose to  Under the “Create” tab let it cast shadows (by default this is off for some  Select Lights lights)  Start with “Standard” Lights for now

 Spot and Omni are Positional lights The choice of shadow renderer affects the quality  “Direct” indicates a Directional light of the shadow

 some are more realistic but conversely cause the Target and Free simply refer to how the light can be moved rendering to take a longer time (transformed) in max

 Target remains aimed at a certain point when you translate it  Free remains facing a certain direction when you translate it

4 11/27/2016

25 MATERIALS M 26 BASIC SHADERS

Press M or click on the material icon to bring up the Shader Basic Parameters material editor window. Choose a types:  This stores all current materials used in your scene.  Phong – we know this one already  You can drag any existing material onto objects in your scene.  Blinn – a more accurate version of Phong  You can also load in materials from other .MAT libraries  Strauss – metallic objects  Oren-Nayer-Blinn – matte surfaces

Selecting any shader changes the nature of the Basic Parameters and Extended Parameters

27 THE MAPS ROLLOUT 28 TEXTURES

To Texture Map an object, most frequently we  Maps allow you to apply a filter or pattern change its diffuse mapping to some of the objects properties  recall that diffuse is what mostly affects an object’s colour  The Map will decide which colors (or distortions in the case of some mappings)  In effect, we give MAX a function which will decide the colour of individual points on the object  The map can be derived from an image or procedurally (from some mathematically defined function)

29 30 MATERIAL BROWSER Once you select a map the material Editor window changes.  The Material/Map Browser gives you a list of existing functions you can map to a material  Additional ones can be generated or imported from outside sources Here we selected marble so  Most of these are procedural and can apply the editor shows options for to both texture and bump/normal maps affecting the marble procedure  To add your own image use BITMAP

To go back to the original object (and perhaps add other effects, click “Go To Parent”

5 11/27/2016

31 HIGHLY REFLECTIVE OBJECTS 32 REFRACTION

For refraction choose a Refraction map and in the Maps window choose Raytrace

The index of refraction (IOR) value can be changed under Extended Parameters (you may have to click “Go to Parent” to get there)

If you don’t see this select a Blinn or Phong Shader

Tick reflection – click on the map button to bring up the Material/Maps browser Select Raytrace

33 BUMP MAPS 34

Displacement mapping actually changes the geometry before rendering – displaced “bumps” can actually occlude and cast shadows on other objects.

Tick Bump under the Maps rollout. In the Material/Map Browser. Select a preset pattern or Load Exaggerated displacement Click on the Map to open the one from an image file by mapping with same texture as Material/Map Browser selecting Bitmap previous slide

35 ENVIRONMENT MAP 36

An environment map (similar to the sky_sphere in POV-Ray) adds a background texture which can add an extra touch of realism to your reflective/refractive (ray-traced) objects

Cylindrical mapping Under the co-ordinates roll-out. Spherical mapping Click Environ.

Select an empty slot. Double click Bitmap In the Menu – Click “Rendering  Then click on Get Material. Environment” and then select your environment map Shrink Wrap mapping

6 11/27/2016

37 ENVIRONMENT MAP EXAMPLE 38

Without Environment Map

WithEnvironment Map

39

7