from turing machine to global illumination chun-fa chang national taiwan normal university

35
From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Upload: oscar-wheeler

Post on 17-Jan-2018

217 views

Category:

Documents


0 download

DESCRIPTION

Calculator vs. Computer  What is the difference between a calculator and a computer?  Doesn ’ t a compute-r just “ compute ” ?  The Casio fx3600p calculated can be programmed (38 steps allowed).

TRANSCRIPT

Page 1: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

From Turing Machine to Global Illumination

Chun-Fa ChangNational Taiwan Normal University

Page 2: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Outline My first computer (CASIO fx3600) Turning machine and von Neumann

architecture GPU pipeline Local and global illumination Shadow and reflection through texture Programmable GPUs

Page 3: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Calculator vs. Computer What is the difference between

a calculator and a computer? Doesn’t a compute-r just

“compute”? The Casio fx3600p calculated

can be programmed (38 steps allowed).

Page 4: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Turing Machine Can be adapted to simulates the logic of any

computer that could possibly be constructed. von Neumann architecture implements a

universal Turing machine. Look them up at Wikipedia!

Page 5: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Outline My first computer (CASIO fx3600) Turning machine and von Neumann

architecture GPU pipeline Local and global illumination Shadow and reflection through texture Programmable GPUs

Page 6: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University
Page 7: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University
Page 8: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Simplified View

The Data Flow:3D Polygons (+Colors, Lights, Normals, Texture

Coordinates…etc.) 2D Polygons 2D Pixels (I.e., Output Images)

Transform(& Lighting)

Rasterization

Page 9: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Outline My first computer (CASIO fx3600) Turning machine and von Neumann

architecture GPU pipeline Local and global illumination Shadow and reflection through texture Programmable GPUs

Page 10: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Global Effects

translucent surface

shadow

multiple reflection

Page 11: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Local vs. Global

Page 12: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

How Does GPU Draw This?

Page 13: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Quiz Q1: A straightforward GPU pipeline give us

local illumination only. Why?

Q2: What typical effects are missing?

Hint: How is an object drawn? Do they consider the relationship with other objects?

Shadow, reflection, and refraction…

Page 14: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Wait but I’ve seen shadow and reflection in games before…

With Shadows Without Shadows

Page 15: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Outline My first computer (CASIO fx3600) Turning machine and von Neumann

architecture GPU pipeline Local and global illumination Shadow and reflection through texture Programmable GPUs

Page 16: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Adding “Memory” to the GPU Computation Modern GPUs allow:

The usage of multiple textures. Rendering algorithms that use multiple passes.

Transform(& Lighting)

Rasterization

Textures

Page 17: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Faked Global Illumination Shadow, Reflection, BRDF…etc. In theory, real global illumination is not

possible in current graphics pipeline: Conceptually a loop of individual polygons. No interaction between polygons.

Can this be changed by multi-pass rendering?

Page 18: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Case Study: Shadow Map Using two textures: color and depth Relatively straightforward design using pixel

(fragment) shaders on GPUs.

Page 19: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Image Source: Cass Everitt et al., “Hardware Shadow Mapping” NVIDIA SDK White Paper

Eye’s View Light’s View Depth/Shadow Map

Page 20: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Basic Steps of Shadow Maps Render the scene from the light’s point of

view, Use the light’s depth buffer as a texture

(shadow map), Projectively texture the shadow map onto the

scene, Use “texture color” (comparison result) in

fragment shading.

Page 21: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Outline My first computer (CASIO fx3600) Turning machine and von Neumann

architecture GPU pipeline Local and global illumination Shadow and reflection through texture Programmable GPUs

Page 22: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

PC Graphics Architecture Two buses on PC: System Bus (CPU-

Memory) and Peripheral I/O Bus. Before AGP: narrow path (I/O Bus) between

main memory and graphics memory (for frame buffer, Z buffer, texture, vertex data…etc.)

AGP and PCI-e speed up the link between host PC and graphics processor (GPU)

Page 23: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Source: http://www.karbosguide.com/hardware/module2d03a.htm

Page 24: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

New Chips Are Coming Intel Broadwell

CPU and GPU on the same die (silicon chip) Bandwidth no longer limited by chipsets.

Processors for Phones & Tablets: Qualcomm Snapdragon & Adreno Apple A8, A9, and beyond Mediatek, NVIDIA, Intel ATOM…etc.

Page 25: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

NVIDIA Geforce 6800

Page 26: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

NVIDIA Geforce 8800

Page 27: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

NVIDIA Fermi (Geforce 400 and 500 Series)

From NVIDIA Fermi Architecture Whitepaperhttp://www.nvidia.com/content/PDF/fermi_white_papers/NVIDIA_Fermi_Compute_Architecture_Whitepaper.pdf

Page 28: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

How to Program a GPU? Writing a 3D graphics application program

Typically in DirectX or OpenGL Still CPU programming in C/C++ The APIs and drivers do the dirty work for you.

Writing GPU shaders Typically in GLSL or Cg Still drawing 3D objects Working like plug-in’s to the 3D rendering

pipeline

Page 29: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

GPGPU General-purpose GPU computing

No longer restricted to graphics applications. To utilize the abundant “GFLOPs” in GPU.

Could be implemented in GPU shaders By clever transformation of problem domains. Textures to store the data structures However, shaders could not perform memory writes

with calculated addresses (a.k.a. scatter operations)

Page 30: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

GPU as a Parallel Computing Platform Treating GPUs as parallel machinery

Not quite the same as shared-memory multi-processor.

A special kind of memory hierarchy. NVIDIA CUDA

Widely adopted in real-world applications OpenCL

For non-NV GPUs and multi-core CPUs

Page 31: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Branch Divergence on GPUWarp

½ performance for each branch!

…if x1 – x0 > y1 – y0:

xMajorIteration()

yMajorIteration()else:

Page 32: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Examples

Page 33: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

GPU Shading Effects Reflection and refraction Relief on surface Ambient occlusion and lighting

Page 34: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Real-Time Rendering of Splashing Water Particle system simulation for

real-time interaction with terrains and dynamic objects.

Reconstruction of the splash surface with 2D metaballs

Page 35: From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University

Ray Tracing on GPU Using OpenCL or NVIDIA CUDA Or use NVIDIA OptiX