Surface Mapping One. CS7GV3 Real-time Rendering

Similar documents
Color in OpenGL Polygonal Shading Light Source in OpenGL Material Properties Normal Vectors Phong model

Lighting. Dr. Scott Schaefer

Computer Graphics. Jeng-Sheng Yeh 葉正聖 Ming Chuan University (modified from Bing-Yu Chen s slides)

Some Tutorial about the Project. Computer Graphics

Real-time. Shading of Folded Surfaces

Scan Conversion & Shading

Scan Conversion & Shading

Interactive Rendering of Translucent Objects

Monte Carlo Rendering

Diffuse and specular interreflections with classical, deterministic ray tracing

Discussion. History and Outline. Smoothness of Indirect Lighting. Irradiance Caching. Irradiance Calculation. Advanced Computer Graphics (Fall 2009)

Discussion. History and Outline. Smoothness of Indirect Lighting. Irradiance Calculation. Irradiance Caching. Advanced Computer Graphics (Fall 2009)

Global Illumination: Radiosity

Lab 9 - Metal and Glass

Global Illumination and Radiosity

Realistic and Detail Rendering of Village Virtual Scene Based on Pixel Offset

CSE 4431/ M Advanced Topics in 3D Computer Graphics. TA: Margarita Vinnikov

Global Illumination and Radiosity

Monte Carlo 1: Integration

PBRT core. Announcements. pbrt. pbrt plug-ins

TN348: Openlab Module - Colocalization

Plane Sampling for Light Paths from the Environment Map

R s s f. m y s. SPH3UW Unit 7.3 Spherical Concave Mirrors Page 1 of 12. Notes

Global Illumination and Radiosity

Type-2 Fuzzy Non-uniform Rational B-spline Model with Type-2 Fuzzy Data

Computer Graphics (CS 543) Lecture 8a: Per-Vertex lighting, Shading and Per-Fragment lighting

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Monte Carlo 1: Integration

Global Illumination. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/26/07 1

Consistent Illumination within Optical See-Through Augmented Environments

Radial Basis Functions

Light Factorization for Mixed-Frequency Shadows in Augmented Reality

Today. Texture mapping in OpenGL. Texture mapping. Basic shaders for texturing. Today. Computergrafik

Interactive Virtual Relighting of Real Scenes

Analysis of 3D Cracks in an Arbitrary Geometry with Weld Residual Stress

Simplification of 3D Meshes

Fast, Arbitrary BRDF Shading for Low-Frequency Lighting Using Spherical Harmonics

Introduction to Radiosity

CSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Motivation. Motivation. Monte Carlo. Example: Soft Shadows. Outline. Monte Carlo Algorithms. Advanced Computer Graphics (Fall 2009)

Slide 1 SPH3UW: OPTICS I. Slide 2. Slide 3. Introduction to Mirrors. Light incident on an object

Parallax Bumpmapping. Whitepaper

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

A DATA ANALYSIS CODE FOR MCNP MESH AND STANDARD TALLIES

Array transposition in CUDA shared memory

FEATURE EXTRACTION. Dr. K.Vijayarekha. Associate Dean School of Electrical and Electronics Engineering SASTRA University, Thanjavur

Topic 13: Radiometry. The Basic Light Transport Path

Rail-Track Viewer An Image-Based Virtual Walkthrough System

Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping

Assignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009.

EDAF80 Introduction to Computer Graphics. Seminar 3. Shaders. Michael Doggett. Slides by Carl Johan Gribel,

Realistic Rendering. Traditional Computer Graphics. Traditional Computer Graphics. Production Pipeline. Appearance in the Real World

Computer Sciences Department

COMP250: Computer Graphics

Introduction to Shaders for Visualization. The Basic Computer Graphics Pipeline

2.2 Photometric Image Formation

Corner-Based Image Alignment using Pyramid Structure with Gradient Vector Similarity

An efficient method to build panoramic image mosaics

Computer graphics III Light reflection, BRDF. Jaroslav Křivánek, MFF UK

Input Nodes. Surface Input. Surface Input Nodal Motion Nodal Displacement Instance Generator Light Flocking

The Rasterization Pipeline

Hermite Splines in Lie Groups as Products of Geodesics

Computer Graphics Introduction. Taku Komura

Computer Graphics Coursework 1

Shading 1: basics Christian Miller CS Fall 2011

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Simulation and Animation of Fire

Rendering of Complex Materials for Driving Simulators

Technical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS 4731 Computer Graphics

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

What are the camera parameters? Where are the light sources? What is the mapping from radiance to pixel color? Want to solve for 3D geometry

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

Shape Representation Robust to the Sketching Order Using Distance Map and Direction Histogram

12/2/2009. Announcements. Parametric / Non-parametric. Case-Based Reasoning. Nearest-Neighbor on Images. Nearest-Neighbor Classification

Technical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS 4731 Computer Graphics

Computer Graphics with OpenGL ES (J. Han) Chapter 6 Fragment shader

Recall: Indexing into Cube Map

Real-time Rendering of Enhanced Shallow Water Fluid Simulations

Repetition of TDA361. Misc. GEOMETRY Summary. Lecture 2: Transforms. Homogeneous notation. Ulf Assarsson

Form-factors Josef Pelikán CGG MFF UK Praha.

Wishing you all a Total Quality New Year!

The stream cipher MICKEY-128 (version 1) Algorithm specification issue 1.0

Multiblock method for database generation in finite element programs

Advanced Lighting Techniques Due: Monday November 2 at 10pm

LEAST SQUARES. RANSAC. HOUGH TRANSFORM.

Physics 132 4/24/17. April 24, 2017 Physics 132 Prof. E. F. Redish. Outline

Comparison of calculation methods and models in software for computer graphics and radiative heat exchange

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

CS5620 Intro to Computer Graphics

INFOGR Computer Graphics

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

Geometric Primitive Refinement for Structured Light Cameras

Outline. Seamless Image Stitching in the Gradient Domain. Related Approaches. Image Stitching. Introduction Related Work

Course Introduction. Algorithm 8/31/2017. COSC 320 Advanced Data Structures and Algorithms. COSC 320 Advanced Data Structures and Algorithms

APPLICATION OF AN AUGMENTED REALITY SYSTEM FOR DISASTER RELIEF

Monte Carlo Integration

DIFFRACTION SHADING MODELS FOR IRIDESCENT SURFACES

Object centered stereo: displacement map estimation using texture and shading

Dependence of the Color Rendering Index on the Luminance of Light Sources and Munsell Samples

Transcription:

Surface Mappng One CS7GV3 Real-tme Renderng

Textures Add complexty to scenes wthout addtonal geometry Textures store ths nformaton, can be any dmenson Many dfferent types: Dffuse most common Ambent, specular, gloss maps Bump, normal, dsplacement maps Reflecton, refracton maps

Textures and Renderng Recall the Renderng Equaton: I( x, x') g( x, x')[ e( x, x') ( x, x', x") I( x', x") dx"] I(x, x ) : ntensty of lght passng from x to x g(x, x ) = (geometry factor) e (x, x ) : ntensty of lght emtted by x and passng to x r (x, x, x ) : b-drectonal reflectance scalng factor for lght passng from x to x by reflectng off x Based on last few lectures, lets smplfy ths as: I g e L df df s n.l L h.n s s L a a

Dffuse Map Smplest texturng drectly apples a colour to object In basc llumnaton colour s mostly based on dffuse component I g e L df df n.l L h.n s s L a a

Emsson Map A..a. Glow map Models lght sources on a surface Does not depend on surface normal or lght sources. I g e L df df n.l L h.n s s L a a

Specular Map Specular color : Gloss map Shnness Control the specular exponent n Phong lght model Or roughness n other lght models I g e L df df n.l L h.n s s L a a

Specular Map + Specular Exp. Map Dffuse Color Specular Color Specular Exponent Shny Dull

Normal Map Use texture as a nput to perturb geometrc representaton I g e L df df n.l L h.n s s L a a

Vsblty Mappngs Parallax mappng Shft n texture looup based on vew-ray ntersecton wth heghtfeld Can account for occlusons Alpha Mappng: Transparency mappng across prmtve Shadow mappng I g e L df df n.l L h.n s s L a a

Lght & Envronment Mappng Approxmaton of ncomng radance Lght maps: pre-computed ncdent flux across 2D surfaces Envronment Maps: more complex 3D loo up of ncomng flux n scene Can combne wth other maps Texture d envronment Lght Maps Merged Scene I g e L df df n.l L h.n s s L a a

Texture Mappng For 2D textures, we need a 3D to 2D mappng Sometmes called a projector functon Each vertex n the model wll need a (u,v) co-ordnate Normally defned by the artst and added to the vertex stream

Texture Mappng Components XYZ UV [0,1] U [0-wdth] V [0-heght] RGB K d? N, From: Aenne-Moller, Hanes, Hoffman Real-tme Renderng 3 rd Ed.

UV Mappngs

Example: Cylndrcal

Tlng, Wrappng etc. Can specfy rules for (u, v) behavour outsde [0, 1] Tlng: number of repettons of texture wthn space Tlng Mode: normal, mrror, no-tlng (clamp) The (u, v) co-ordnate can be manpulated by shader Just another nput e.g. could rotate texture co-ordnate

Bump Mappng Add surface geometrc detal wthout addtonal vertces A real bump dstorts the drectons of the normals (ths effects calculatons of lght reflectance) Fae bumps created by dstortng the normals although the model geometry s stll flat. e.g. A bump-map texture appled to a flat polygon.

Bump Mappng Use a texture map to perturb the normal to the surface Tradtonally represent ths as ether: d stored n 2 separate scalar textures (for d u and d v ) store a heghtfeld and compute or approxmate d from the surface dfferentals

Bump/Normal Mappng Gve the lluson of geometrc detal Shape percepton depends on lghtng cues Wthout normal mappng Wth bump mappng

Normal Mappng A more commonly used method s normal mappng Also nown as dot3 bump mappng Image taen from Wpeda avalable at http://en.wpeda.org/w/normal_mappng

Object Space Normal Mappng Basc Idea: Store the actual surface normal n the texture (RGB = nx, ny, nz) At each pxel, loo up the normal map, and use ths nstead of the nterpolated normal Tool support requred f generatng normals from hgh-res surfaces

Per-vertex Lghtng Only Normal Maps e.g. Combne wth Mesh Smplfcaton Cohen, Olano, Manocha, Appearance-preservng smplfcaton, SIGGRAPH, 1998. http://gamma.cs.unc.edu/aps/aps.pdf

Object Space Normal Mappng Object space has some problems: Not very flexble Strongly ted to specfc object Can t tle map or use symmetry Don t wor so well wth MIP maps or sharp edges Image from http://www.3dngdoms.com/tutoral.htm

Tangent Space Normal Mappng Normal s stored relatve to the tangent space of the object Sort of le a local normal Defne a local co-ordnate frame Form a co-ordnate system from normal n and tangent t and bnormal b Then defne dsplaced normal n n ths space n t b z y x z y x z y x T n n n b b b t t t n b t M t n n' b

Shader Setup Applcaton must send normal and tangent vector to the shader The normal s straghtforward avalable as bult n attrbute The tangent s slghtly trcy (for polygonal objects) Pass ths down as a custom attrbute B-tangent can be calculated n the shader Must be consstent wth the tangent vector to avod nterpolaton problems

Lghtng wth the bump map Transform lght and vew vectors nto tangent space (per vertex) Vertex Shader: varyng vec3 v; varyng vec3 l; unform vec4 L; //drectonal lght n eye space attrbute vec3 rm_tangent; attrbute vec3 rm_btangent; //here we get the btangent from applcaton //but we could calculate ths n the shader vod man(vod) { gl_poston = ftransform(); gl_texcoord[0] = gl_texturematrx[0]*gl_multtexcoord0; vec4 camera = gl_modelvewmatrxinverse*vec4(0.0, 0.0, 0.0, 1.0); vec3 vew = normalze(camera.xyz-gl_vertex.xyz); //object space vew and lght vector vec3 lght = normalze(gl_modelvewmatrxtranspose*l).xyz; } //TBNnv transforms vectors from object space to tangent space mat3 TBNnv(rm_Tangent, rm_btangent, gl_normal); l = TBNnv*lght; v = TBNnv*vew;

Lghtng wth the bump map Fragment Shader unform vec4 ambentcolor; unform vec4 dffusecolor; unform vec4 specularcolor; unform sampler2d dffusetex; unform sampler2d normaltex; unform float shnness; varyng vec3 v; varyng vec3 l; vod man(vod) { l = normalze(l); v = normalze(v); } vec3 n = 2.0*texture2D( normaltex, gl_texcoord[0].st ).xyz - 1.0; //tangent-space normal vec4 dffuseterm = texture2d( dffusetex, gl_texcoord[0].st)* dffusecolor *(max( 0.0, dot(n, l))); vec3 r = reflect(-l, n); //tangent-space reflecton vector vec4 specularterm = specularcolor*pow(max(0.0, dot(r, v)), shnness); gl_fragcolor = ambentcolor + dffuseterm + specularterm;

Tangent Space Normal Mappng

Tangent Space Normal Mappng Predomnantly blue: Why? No dsplacement means normal = n n tangent space n = [0 0 1] whch maps to RGB blue Dsplaced normals are relatvely close to ths Storage: Record 255*(n +1)/2 n normal map (to map to [0,255] range)