Lesson 1: Kỹ thuật đồ họa và Hiện thực ảo Computer Graphics And Virtual Reality z Kỹ Thuật đồ họa cơ sở z Kỹ Thuật đồ họa tiêntiến z Hiện thực ảo - VRML Le Tan Hung hunglt@it-hut.edu.vn
Trang 1Lesson 1:
Kỹ thuật đồ họa và Hiện thực ảo
Computer Graphics And Virtual Reality
z Kỹ Thuật đồ họa cơ sở
z Kỹ Thuật đồ họa tiêntiến
z Hiện thực ảo - VRML
Le Tan Hung hunglt@it-hut.edu.vn
2
A Brief History of Computer Graphics
1885 - CRT (Cathode Ray Tube)
1887 - Edison patents motion picture camera
1888 - Edison and Dickson record motion picture photos
on a wax cylinder
3
A Brief History of Computer
Graphics
1926 – J.L Baird invents the television.
30 line vertical,
black and red scan.
4
Computer Graphics:
1960-1970
z 1960 William Fetter (Thuật ngữ kỹ thuật
đồ hoạ máy tính (Computer Graphics)
z 1960 - SAGE (Semi-Automatic Ground Environment System) Bút sáng
z 1960-1963 Dự án Sketchpad tại MIT
z 1963 Ivan shutherland (hội nghị Fall Joint Computer - lần đầu tiên khả năng tạo mới, hiển thị và thay đổi được thực hiện trong thời gian thực trên màn CRT)
z Wireframe graphics
z Display Processors
z Storage tube
z Ivan Sutherland’s PhD thesis at MIT
– Vấn đề tương tác người máy
– Loop
zDisplay something
zUser moves light pen
zComputer generates new display
– Sutherland tạo ra rất nhiều thuật toán cho CG
5
A Brief History of Computer
Graphics
1963
z IBM creates the 360 models
– One of the First General Purpose
Mainframes
z SRI develops the mouse.
6
A Brief History of Computer Graphics
z 1966 Ralph Baer creates the 1stcomsumer CG product:
– Odyssey Pinball
z 1967
– GE introduces first full colour real time flight simulator for NASA
Trang 2Lịch sử phát triển
1970-1980
z CG:1970-1980
z Raster Graphics
z Beginning of graphics
standards
– IFIPS
zGKS: European effort
–Becomes ISO 2D standard
zCore: North American effort
– 3D but fails to become ISO
standard
8
A Brief History of Computer Graphics
1973
z Michael Crichton’s “Westworld”
uses 2D graphics
z First time computer is used for image manipulation
z Featured scenes that showed audiences the world viewed by the eye circuitry of a synthetic human (played by a very real Yul Brenner) in
a future Western theme park This effect was achieved with 2D computer graphics tools mostly derived from image processing techniques
9
A Brief History of Computer
Graphics
1974
z Intel develop the 8080 processor
1975
z Mandelbrot plots fractals
z Bill Gates starts Microsoft
1976
z Steve Jobs and Steve Wozniak start Apple
1977
z Academy of Motion Pictures Art and Sciences
introduces Visual Effects category for Oscars
10
A Brief History of Computer Graphics
z 1977 Star Wars wins oscar for special effects.
z 1978 Superman wins oscar for special effects
z 1979 Alien wins oscar for visual effects.
z 1980 The Empire Strikes Back wins oscar for visual effects.
11
80-90
z CG: 1980-1990
– Special purpose hardware
zSilicon Graphics geometry engine
–VLSI implementation of graphics pipeline
– Industry-based standards
zPHIGS
zRenderMan
– Networked graphics: X Window System
– Human-Computer Interface (HCI)
12
A Brief History of Computer Graphics
1981 IBM introduces the first IBM PC (16 bit 8088 chip)
• Raiders of the Lost Ark wins
an oscar for visual effects.
Trang 3A Brief History of Computer
Graphics
1982
z The Genesis Effect (ILM)
for Startrek II is the first all
computer animated visual
effects shot for film.
14
A Brief History of Computer Graphics
1983
z First Coke Polar Bears Commercial
15
A Brief History of Computer
Graphics
1985
z The Last Starfighter is the first live
action feature film with realistic
computer animation of highly detailed
models
1989
z The Abyss is the first movie to include
convincing 3D character animation
16
Lịch sử phát triển 90-00
z CGraphics: 1990-2000
z OpenGL API
z Tạo ra bộ phim hoạt hình hoàn chỉnh đầu tiên (Toy Story)
z Khả năng mới của phần
cứng – Texture mapping – Blending – Accumulation, stencil buffer
z CGraphics: 2000-03
z Photorealism
z Graphics cards for PCs dominate market – Nvidia, ATI, 3DLabs
z Game boxes and game players push the market
z CGraphics trở thành công cụ cho công nghiệp sản xuất phim: Maya, Lightwave
17
A Brief History of Computer
Graphics
1995
Id Software
z Toy Story becomes
the first fully 3D
computer animation
feature film.
18
A Brief History of Computer Graphics
1996
z Independence Day wins oscar for visual effects.
1997
z Titanic wins oscar for visual effects.
z PIXAR wins oscar for best short film: Geri’s Game.
Trang 4A Brief History of Computer
Graphics
1998
z Armageddon
z Mouse Hunt
z Bugs Life
1999
z The Matrix
z Star Wars: The Phantom
Menace
z Disney’s Tarzan
20
A Brief History of Computer Graphics
2000
z Sony Playstation II
z Walking with Dinosaurs
z Disney’s Shrek
2002 Microsoft’s XBOX
21
Kỹ thuật đồ họa vi tính.
z Definition (ISO)
– Method and Technologies for converting data to and from a
graphics devices via a computer
z Computer Graphics (Kỹ thuật đồ hoạ máy tính) là một lĩnh
vực của Công nghệ thông tin mà ở đó nghiên cứu, xây
dựng và tập hợp các công cụ (mô hình lý thuyết và phần
mềm) khác nhau để:
zkiến tạo, lưu trữ, xử lý Các mô hình (model) và hình ảnh
(image) của đối tượng
z Computer graphics deals with all aspects of creating
images with a computer
Interactive Computer Graphics: - user controls contents, structure, and
appearance of objects and their displayed images via rapid visual feedback
22
Kỹ thuật đồ hoạ điểm (Sample based-Graphics)
z Các mô hình, hình ảnh của các đối tượng được hiển thị thông qua từng pixel (từng mẫu rời rạc)
z Đặc điểm:
– Có thể thay đổi thuộc tính – Xoá đi từng pixel của mô hình và hình ảnh các đối tượng
– Các mô hình hình ảnh được hiển thị như một lưới điểm (grid) các pixel rời rạc,
– Từng pixel đều có vị trí xác định, được hiển thị với một giá trị rời rạc (số nguyên) các thông số hiển thị (màu sắc hoặc độ sáng) – Tập hợp tất cả các pixel của grid cho chúng ta mô hình, hình ảnh đối tượng mà chúng ta muốn hiển thị
23
Bitmap
lines,areas,
SRGP library
Pascal / C program
X Window
Image
image formats, compression, transfer
graphics algorithms colour
positions
24
Graphical Model
Rendering
Output Device
Rendering Parameters
Kỹ thuật đồ hoạ vector
z Mô hình hình học (geometrical model) cho mô hình hoặc hình ảnh của đối tượng
z Xác định các thuộc tính của mô hình hình học này,
z Quá trình tô trát (rendering) để hiển thị từng điểm của mô hình, hình ảnh thực của đối tượng
z Vector = geometrical model + rendering
Trang 5Vớ dụ về hỡnh ảnh đồ hoạ Vector
26
Muscle Model Wireframe Model Skeletal Model
â Walt Disney and TSL
27
Raster and Vector Graphics
z Raster
– Hỡnh ảnh và mụ hỡnh của cỏc vật thể được biểu diễn bởi tập hợp cỏc
điểm của grid
– Thay đổi thuộc tớnh của cỏc pixel => thay đổi từng phần và từng vựng
của hỡnh ảnh
– Copy được cỏc pixel từ một hỡnh ảnh này sang hỡnh ảnh khỏc
z Vector
– Khụng thay đổi thuộc tớnh của từng điểm trực tiếp
– Xử lý với từng thành phần hỡnh học cơ sở của nú và thực hiện quỏ
trỡnh tụ trỏt và hiển thị lại
– Quan sỏt hỡnh ảnh và mụ hỡnh của hỡnh ảnh và sự vật ở nhiều gúc
độ khỏc nhau bằng cỏch thay đổi điểm nhỡn và gúc nhỡn
28
Phõn loại cỏc lĩnh vực của Computer Graphics
Kỹ thuật phân tích và tạo ảnh
Đồ hoạ hoạt hình và
nghệ thuật
Kỹ thuật nhận dạng
Xử lý ảnh
Đồ hoạ minh hoạ CAD/CAM System
Kỹ thuật đồ hoạ
Kiến tạo đồ hoạ
Xử lý đồ hoạ
29
Phõn loại theo hệ toạ độ
Kỹ thuật đồ hoạ hai chiều:là kỹ thuật đồ hoạ mỏy tớnh sử dụng hệ
toạ độ hai chiều (hệ toạ độ phẳng), sử dụng rất nhiều trong kỹ
thuật xử lý bản đồ, đồ thị
Kỹ thuật đồ hoạ ba chiều: là kỹ thuật đồ hoạ mỏy tớnh sử dụng hệ
toạ độ ba chiều, đũi hỏi rất nhiều tớnh toỏn và phức tạp hơn nhiều
so với kỹ thuật đồ hoạ hai chiều
Kỹ thuật đồ hoạ
Kỹ thuật đồ hoạ 2 chiều
Kỹ thuật đồ hoạ ba chiều
30
Phõn loại theo chức năng
z Kỹ thuật nhận dạng (Computer Vision techniques
attempt to provide meaning to computer) images.
z Kỹ thuật tổng hợp ảnh (Computer Graphics)
z Geometry modelling
Trang 6Các ứng dụng tiêu biểu của kỹ thuật đồ
họa
z Xây dựng giao diện người dùng (User Interface)
z Tạo các biểu đồ trong thương mại, khoa học, kỹ thuật,
minh họa
z Tự động hoá văn phòng và chế bản điện tử
z Thiết kế với sự trợ giúp của máy tính (CAD_CAM)
z Lĩnh vực giải trí, nghệ thuật và mô phỏng
z Điều khiển các quá trình sản xuất (Process Control)
z Lĩnh vực bản đồ (Cartography) GIS
32
Pixar: Monster’s Inc.
Square: Final Fantasy
35
Computer Aided Design (CAD)
36
CAD-CAM application
Trang 737 38
Mô hình Hệ đồ họa
Mô hình hệ thống
Mô hình chức năng
Các chuẩn của hệ đồ hoạ
39
Application program Graphics system
Graphics hardware
Input and output devices
Core,
GKS, GKS-3D
CGI (device interface)
CGM (metafile)
PHIGS (3D and realtime)
X-window
PHIGS+ (PEX)
IGES
OpenGL
DirectX
Metafiles
Operating system
40
Hệ thống đồ hoạ
( Graphics System)
z Interface between application software and graphics hardware system
z Consists of input subroutines and output subroutines accepting input data or commands from a user and converting internal representations into external pictures on screen, respectively
z Phần mềm đồ hoạ hệ thống:
– Là tập hợp các lệnh đồ hoạ của hệ thống (graphics output commands),
– Thực hiện công việc hiển thị cái gì (what object) và chúng sẽ được hiển thị như thế nào (how)
– Phần mềm đồ hoạ hệ thống là phần mềm xây dựng trên cơ sở một thể loại phần cứng nhất định và phụ thuộc vào phần cứng
z Phần cứng đồ hoạ:
– Là tập hợp các thiết bị điện tử (CPU, bộ nhớ màn hình) giúp cho việc thực hiện các phần mềm đồ hoạ
41
concerned with:
- hardware
- how to display (rasterization)
concerned with:
- modeling
- modeling transf
- color models
- material property
- lighting property
G U I
MODELING RENDERING DISPLAYING
what is
a table, a car, •
• •
( to describe)
to the computer
Geometric Engine
(to capture)
the description create 2D image from 2D / 3D models
Rendering Engine
generate image on screen
(to show)
the image
Raster & Display Engine
concerned with :
- viewing & projection
- drawing & clipping primitives
- local illumination &
shading
- texture mapping
kỹ thuật đồ hoạ
42
3D Graphics Over World Wide Web
SRGP library
Pascal / C program
X Window
Image
image formats, compression, transfer
graphics algorithms colour
Drawing packages transformation
of objects
3D Graphics projections lighting,shading
lines,areas,
positions
Video WWW
Animation
WWW VRML
Trang 8Các chuẩn giao di ện của hệ đồ hoạ
z GKS (Graphics Kernel System):chuẩn xác định các hàm đồ hoạ chuẩn, được
thiết kế như một tập hợp các công cụ đồ hoạ hai chiều và ba chiều
– GKS Functional Description, ANSI X3.124 - 1985.
– GKS - 3D Functional Description, ISO Doc #8805:1988.
z CGI (Computer Graphics Interface System):hệ chuẩn cho các phương pháp
giao tiếp với các thiết bị ngoại vi
z CGM (Computer Graphics Metafile):xác định các chuẩn cho việc lưu trữ và
chuyển đổi hình ảnh
z VRML (Virtual Reality Modeling Language):ngôn ngữ thực tại ảo, một hướng
phát triển trong công nghệ hiển thị được đề xuất bởi hãng Silicon Graphics,
sau đó đã được chuẩn hóa như một chuẩn công nghiệp
z PHIGS (Programmers Hierarchical InteractiveGraphics Standard): xác định
các phương pháp chuẩn cho các mô hình thời gian thực và lập trình hướng
đối tượng
– PHIGS Functional Description, ANSI X3.144 - 1985.
– PHIGS+ Functional Description, 1988, 1992.
44
Non-official industry standards
Các chuẩn của hệ đồ hoạ
z OPENGL thư viện đồ họa của hãng Silicon Graphics, được xây dựng theo đúng chuẩn của một
hệ đồ họa.
– SGI’s OpenGL 1993
z DIRECTX thư viện đồ hoạ của hãng Microsoft
– Direct X/Direct3D 1997
45
OpenGL
z Software interface to graphics
hardware
z Client-server model
z 250 distinct commands
z Object specification + image
generation
z Simple primitives: points, lines,
polygons (pixels, images, bitmaps)
z 3D rendering
z Commands interpreted using client-server model – Client (Application) issues commands
– Server (OpenGL) interprets and processes commands – Frame buffer configuration done by the window system
46
z Window tasks
z User input
z Complicated shapes
– OpenGL Utility Library (GLU) – Window system support libraries
zGLX / WGL / PGL
– OpenGL Utility Toolkit (GLUT) – OpenInventor
For portability, there are
no commands for these.
OpenGL-related Libraries
47
z Direct control of graphics hardware
z Direct control of input/output devices, and sound
Application program
Windows system
Direct sound Direct draw Direct 3D
Direct input
Windows API
……
DirectX
48
OpenGL Design Goals
z SGI’s design goals for OpenGL:
– High-performance (hardware-accelerated) graphics API – Some hardware independence
– Natural, terse API with some built-in extensibility
z OpenGL has become a standard (competing with DirectX) because:
– It doesn’t try to do too much
zOnly renders the image, doesn’t manage windows, etc
zNo high-level animation, modeling, sound (!), etc
– It does enough
zUseful rendering effects + high performance – Open source and promoted by SGI (& Microsoft, half-heartedly)
Trang 9Màn hình CRT
Raster Displays (early 70s)
like television, scan all pixels in regular pattern
use frame buffer (video RAM) to eliminate sync
problems RAM
¼ MB (256 KB) cost $2 million in 1971
50
Màn hình CRT
SONY Trinitron CRT
NEC Hybrid Mask Hitachi EDP Standard Dot-trio
51
Display Technology:
Raster CRTs
z Raster CRT pros:
– Allows solids, not just wireframes
– Leverages low-cost CRT technology (i.e., TVs)
– Bright! Display emitslight
– Requires screen-size memory array
– Discreet sampling (pixels)
– Practical limit on size (call it 40 inches)
– Bulky
– Finicky (convergence, warp, etc)
52
Các thiết bị hiển thị dạng điểm
53
CRT Displays
Advantages
z Fast repsonse (high resolution
possible)
z Full color (large modulation
depth of E-beam)
z Saturated and natural colors
z Inexpensive, matured
technology
z Wide angle, high contrast and
brightness
Disadvantages
z Large and heavy (typ 70x70 cm,
15 kg)
z High power consumption (typ
140W)
z Harmful DC and AC electric and magnetic fields
z Flickering at 50-80 Hz (no memory effect)
z Geometrical errors at edges
54
LCD-Liquid Crystal Display
z A transmissive technology
z Works by letting varying amounts
of a fixed-intensity white backlight through an active filter
z Organnic crystals that lign themselves together
z When external force is applied they realign themselves
z This is used to change polarisation and filter light
Trang 10Display Technology: LCDs
z Transmissive & reflective
LCDs:
– LCDs act as light valves, not
light emitters, and thus rely on
an external light source
– Laptop screen: backlit,
transmissive display
– Palm Pilot/Game Boy:
reflective display
56
LCD Displays Advantages
z Small footprint (approx 1/6 of CRT)
z Light weight (typ 1/5 of CRT)
z Low power consumption (typ 1/4 of CRT)
z Completely flat screen - no geometrical errors
z Crisp pictures - digital and uniform colors
z No electromagnetic emission
z Fully digital signal processing possible
z Large screens (>20 inch) on desktops
Disadvantages
z High price (presently 3x CRT)
z Poor viewing angle (typ +/- 50 degrees)
z Low contrast and luminance (typ
1:100)
z Low luminance (typ 200 cd/m2)
57
Màn hình Plasma
z Plasma display panels
–Similar in principle to
fluorescent light tubes
–Small gas-filled capsules
are excited by electric field,
emits UV light
–UV excites phosphor
–Phosphor relaxes, emits
some other color
58
Display Technology
z Plasma Display Panel Pros
– Large viewing angle – Good for large-format displays
– Fairly bright
z Cons
– Expensive – Large pixels (~1 mm versus
~0.2 mm) – Phosphors gradually deplete
– Less bright than CRTs, using more power
59
Display Technology: DMDs
z Digital Micromirror Devices (projectors)
– Microelectromechanical (MEM) devices, fabricated
with VLSI techniques
60
Display Technology: DMDs
z DMDs are truly digital pixels
z Vary grey levels by modulating pulse length
z Color: multiple chips, or color-wheel
z Great resolution
z Very bright
z Flicker problems