Khoa CNTT - ĐHBK Hà nội Email: hunglt@it-hut.edu.vn Tel: 0913030731

Tổng quan về kỹ thuật đồ hoạ

Lesson 1: Kỹ thuật đồ họa và Hiện thực ảo Computer Graphics And Virtual Reality

(cid:137) Các khái niệm tổng quan của kỹ thuật đồ hoạ máy

tính

(cid:137) Các kỹ thuật đồ hoạ

(cid:137) Phân loại các lĩnh vực của kỹ thuật đồ hoạ

(cid:137) Hệ đồ họa tương tác (interactive)

(cid:132) Kỹ Thuật đồ họa cơ sở (cid:132) Kỹ Thuật đồ họa tiên tiến (cid:132) Hiện thực ảo - VRML

(cid:137) Phần cứng đồ hoạ (Graphics Hardware)

Le Tan Hung hunglt@it-hut.edu.vn

(c) SE/FIT/HUT 2002

(c) SE/FIT/HUT 2003

2

A Brief History of Computer Graphics

A Brief History of Computer Graphics

1926 – J.L. Baird invents the television.

30 line vertical, black and red scan.

1885 - CRT (Cathode Ray Tube) 1887 - Edison patents motion picture camera 1888 - Edison and Dickson record motion picture photos on a wax cylinder

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

3 4

A Brief History of Computer Graphics

A Brief History of Computer Graphics

1966 (cid:132) Ralph Baer creates the 1st comsumer CG product:

Odyssey Pinball

1963 (cid:132) IBM creates the 360 models (cid:132) One of the First General Purpose Mainframes (cid:132) SRI develops the mouse.

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

1

5 6

Khoa CNTT - ĐHBK Hà nội Email: hunglt@it-hut.edu.vn Tel: 0913030731

A Brief History of Computer Graphics

A Brief History of Computer Graphics 1968 (cid:132) John Whitney: Permutations

1967 (cid:132) GE introduces first full colour real time flight

simulator for NASA

In "Permutations," (1968) he delineates a marvellous and exciting new world. One senses a choreographer. The movements are reminiscent of traditional ballet. The shapes follow the dictates of formal geometry more than those of abstract painting. Movement is three- dimensional and the ambition for a more polished three-dimensional shaded space is apparent.

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

7 8

A Brief History of Computer Graphics 1973 (cid:132) Michael Crichton’s

A Brief History of Computer Graphics 1974 (cid:132) Intel develop the 8080 processor.

“Westworld” uses 2D graphics (cid:132) First time computer is used for image

manipulation.

(cid:132) Featured scenes that showed

1975 (cid:132) Mandelbrot plots fractals

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.

(cid:132) Bill Gates starts Microsoft

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

9 10

A Brief History of Computer Graphics 1977

A Brief History of Computer Graphics 1976 (cid:132) Steve Jobs and Steve Wozniak start

Apple.

(cid:132) Star Wars wins oscar for special effects.

1977 (cid:132) Academy of Motion Pictures Art and Sciences introduces Visual Effects category for Oscars.

1978 •Superman wins oscar for special effects.

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

2

11 12

Khoa CNTT - ĐHBK Hà nội Email: hunglt@it-hut.edu.vn Tel: 0913030731

A Brief History of Computer Graphics 1979

(cid:132) Alien wins oscar for visual effects.

A Brief History of Computer Graphics 1980 (cid:132) Disney’s TRON is the first live action film with over 20 mins of computer animations.

(cid:132) Seagate Technology

releases the HDD for PCs

1980 •The Empire Strikes Back wins oscar for visual effects.

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

13 14

A Brief History of Computer Graphics

1981 IBM introduces the first IBM PC (16 bit

8088 chip)

A Brief History of Computer Graphics 1982 (cid:132) The Genesis Effect (ILM) for Startrek II is the first all computer animated visual effects shot for film.

• Raiders of the Lost Ark wins an oscar for visual effects.

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

15 16

A Brief History of Computer Graphics

A Brief History of Computer Graphics

(cid:132) 1984 PIXAR Opens

1983 (cid:132) First Coke Polar Bears

1985 (cid:132) The Last Starfighter is the

Commercial

first live action feature film with realistic computer animation of highly detailed models.

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

3

17 18

Khoa CNTT - ĐHBK Hà nội Email: hunglt@it-hut.edu.vn Tel: 0913030731

A Brief History of Computer Graphics 1989 (cid:132) The Abyss is the first movie to include convincing 3D character animation.

A Brief History of Computer Graphics 1990 (cid:132) Windows 3.0 ships 1993 (cid:132) Myst 1994 (cid:132) Playstation and N64 released

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

19 20

A Brief History of Computer Graphics 1995 (cid:132) Quake Released by

A Brief History of Computer Graphics 1996 (cid:132) Independence Day

Id Software

wins oscar for visual effects.

(cid:132) Toy Story becomes the first fully 3D computer animation feature film.

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

21 22

A Brief History of Computer Graphics 1997 (cid:132) Titanic wins oscar for visual effects.

(cid:132) PIXAR wins oscar for best short film: Geri’s Game.

A Brief History of Computer Graphics 1998 (cid:132) Armageddon (cid:132) Mouse Hunt (cid:132) Bugs Life 1999 (cid:132) The Matrix (cid:132) Star Wars: The Phantom Menace (cid:132) Disney’s Tarzan

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

4

23 24

Khoa CNTT - ĐHBK Hà nội Email: hunglt@it-hut.edu.vn Tel: 0913030731

A Brief History of Computer Graphics

Kỹ thuật đồ họa vi tính.

2002 Microsoft’s XBOX

(cid:132) Definition (ISO) (cid:132) Computer Graphics (Kỹ thuật đồ hoạ máy tính) (cid:132) Computer graphics deals with all aspects of

2000 (cid:132) Sony Playstation II (cid:132) Walking with Dinosaurs (cid:132) Disney’s Shrek

creating images with a computer

model – Interactive Computer Graphics:

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

Pascal / C program

25 26

Bitmap Bitmap

Kỹ thuật đồ hoạ điểm (Sample based-Graphics)

SRGP library

(cid:132) 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)

positions

graphics algorithms colour

lines,areas,...

(cid:132) Đặc điểm: (cid:132) Phương pháp để tạo ra các pixel

X Window System

Graphics hardware

Image

image formats, compression, transfer

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

27

Kỹ thuật đồ hoạ vector

Ví dụ về hình ảnh đồ hoạ Vector

(cid:132) Vector = geometrical model + rendering

Graphical Model

Rendering Parameters

Rendering

Output Device

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

5

29 30

Khoa CNTT - ĐHBK Hà nội Email: hunglt@it-hut.edu.vn Tel: 0913030731

Raster and Vector Graphics (cid:132) Raster

(cid:132) 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

Wireframe Model

Skeletal Model

Muscle Model

(cid:132) 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.

(cid:132) Copy được các pixel từ một hình ảnh này sang hình ảnh khác.

(cid:132) Vector

trình tô trát và hiển thị lại.

(cid:132) Không thay đổi thuộc tính của từng điểm trực tiếp (cid:132) 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á

độ khác nhau bằng cách thay đổi điểm nhìn và góc nhìn.

(cid:132) Quan sát hình ảnh và mô hình của hình ảnh và sự vật ở nhiều góc

© Walt Disney and TSL

Hair

Render and Touch up

Skin

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

31 32

Phân loại theo hệ toạ độ

Phân loại các lĩnh vực của Computer Graphics

Kü thuËt ®å ho¹ 2 chiÒu

CAD/CAM System

Kü thuËt ®å ho¹

§å ho¹ minh ho¹

KiÕn t¹o ®å ho¹

Kü thuËt ®å ho¹ ba chiÒu

§å ho¹ ho¹t h×nh vµ nghÖ thuËt

Kü thuËt ®å ho¹

Xö lý ¶nh

Kü thuËt nhËn d¹ng

Xö lý ®å ho¹

Kü thuËt ph©n tÝch vµ t¹o ¶nh

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

33 34

Các ứng dụng tiêu biểu của kỹ thuật đồ họa

Phân loại theo chức năng

(cid:132) Kỹ thuật xử lý ảnh (COMPUTER IMAGING)

(cid:132) Kỹ thuật nhận dạng (Computer Vision techniques

attempt to provide meaning to computer) images.

(cid:132) Kỹ thuật tổng hợp ảnh (Computer Graphics)

(cid:132) Geometry modelling

(cid:132) Xây dựng giao diện người dùng (User Interface) (cid:132) Tạo các biểu đồ trong thương mại, khoa học, kỹ thuật (cid:132) Tự động hoá văn phòng và chế bản điện tử (cid:132) Thiết kế với sự trợ giúp của máy tính (CAD_CAM) (cid:132) Lĩnh vực giải trí, nghệ thuật và mô phỏng (cid:132) Điều khiển các quá trình sản xuất (Process Control) (cid:132) Lĩnh vực bản đồ (Cartography)

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

6

35 36

Khoa CNTT - ĐHBK Hà nội Email: hunglt@it-hut.edu.vn Tel: 0913030731

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

37 38

CAD-CAM application

Hệ đồ họa tương tác

(cid:131) Mô hình hệ đồ hoạ tương tác (cid:131) Các thành phần của hệ đồ hoạ tương tác

(cid:131) Bộ xử lý tương tác với người sử dụng (cid:131) Các chuẩn của hệ đồ hoạ

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

CCáácc ththàànhnh phphầầnn ccủủaa hhệệ đđồồ hohoạạ tương

tương ttáácc

39 40

Thành phần trong chức năng của kỹ thuật đồ hoạ

G U I

MODELING RENDERING DISPLAYING

( to describe) to the computer

(to show) the image

Application Program

Graphics System

Application Data Structure

generate image on

what is a table, a car, • • •

(to capture) the description create 2D image from 2D / 3D models

screen

Geometric Engine

Rendering Engine

Raster & Display Engine

Computer

Graphics Devices

concerned with: - hardware - how to display (rasterization)

concerned with : - viewing & projection - drawing & clipping primitives - local illumination & shading - texture mapping - global rendering

concerned with: - modeling - modeling transf. - color models - material property - lighting property

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

7

41 42

Khoa CNTT - ĐHBK Hà nội Email: hunglt@it-hut.edu.vn Tel: 0913030731

Model of RGP

3D Graphics Over World Wide 3D Graphics Over World Wide Web Web

Animation

VRML

output pipeline

3D Graphics

WWW

Drawing packages

Pascal / C program

output primitives

output attributes

projections lighting,shading

transformation of objects

Canvascontrol

SRGP library

SRGP

Application model

Application program

copyPixel

Input device control

lines,areas,...

positions

graphics algorithms colour

Display Hardware

Input device measures

X Window System

Graphics hardware

input pipeline

Image

WWW

(c) SE/FIT/HUT 2003

Video

43

(c) SE/FIT/HUT 2003 image formats, compression, transfer

Thành phần thư viện đồ hoạ

Bộ xử lý tương tác với người sử dụng

(cid:132) Các thực thể cơ sở

(cid:132) Hệ thống đồ hoạ thông thường phải chứa một tập hợp các thủ tục

(chương trình con) để xử lý với các thiết bị vào ra (I/O System).

(cid:131) Điểm (pixel) (cid:131) Đường thẳng (line) (cid:131) Đường tròn (circle)

(cid:132) hệ thống đồ hoạ sinh ra các thiết bị ngoại vi lôgic để tương tác

(cid:132) Đa giác (polygon) ..v..v.

giữa người sử dụng và thiết bị ngoại vi này.

(cid:132) Một chu trình điển hình của các chương trình ứng dụng quản lý

các thiết bị ngoại vi được gọi là vòng lặp sự kiện từ thiết bị

(cid:132) Các thuộc tính (cid:131) Màu sắc (color) (cid:131) Kiểu đường vẽ (line style) (cid:131) Kiểu văn bản (text style)

(event-driven loop )

(cid:132) Mẫu tô (pattern).

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

45 46

Giao diện hệ thống đồhọa Interface of Graphics System

Hệ thống đồ hoạ (Graphics System)

Application program

(cid:132) Interface between application software and graphics hardware system (cid:132) 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

Graphics system

(cid:132) Là tập hợp các lệnh đồ hoạ của hệ thống (graphics output commands), (cid:132) 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).

Operating system

(cid:132) 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.

Core, GKS, GKS-3D CGI (device interface) CGM (metafile) PHIGS (3D and realtime) X-window PHIGS+ (PEX) IGES OpenGL DirectX

(cid:132) Phần mềm đồ hoạ hệ thống:

Metafiles

(cid:132) 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

Input and output devices

Graphics hardware

các phần mềm đồ hoạ.

(cid:132) Phần cứng đồ hoạ:

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

8

47 48

Khoa CNTT - ĐHBK Hà nội Email: hunglt@it-hut.edu.vn Tel: 0913030731

Các chuẩn giao diện của hệ đồ hoạ

Non-official industry standards Các chuẩn của hệ đồ hoạ

(cid:132) GKS (Graphics Kernel System):

(cid:132) OPENGL SGI’s OpenGL 1993 (cid:132) DIRECTX Direct X/Direct3D 1997

(cid:132) GKS Functional Description, ANSI X3.124 - 1985. (cid:132) GKS - 3D Functional Description, ISO Doc #8805:1988.

(cid:132) CGI (Computer Graphics Interface System): (cid:132) CGM (Computer Graphics Metafile): (cid:132) VRML (Virtual Reality Modeling Language): (cid:132) PHIGS (Programmers Hierarchical Interactive

(cid:132) IGES

(cid:132) PHIGS Functional Description, ANSI X3.144 - 1985. (cid:132) PHIGS+ Functional Description, 1988, 1992.

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

49 50

OpenGL

DirectX

(cid:132) Software interface to graphics

(cid:132) Commands interpreted

(cid:132) Direct control of graphics hardware (cid:132) Direct control of input/output devices, and sound

hardware

using client-server model

(cid:132) Client-server model

Application program Application program

commands

(cid:132) 250 distinct commands (cid:132) Object specification + image

(cid:132) Client (Application) issues

D

generation

Windows API Windows API

i r e c t

(cid:132) Server (OpenGL) interprets and processes commands

Direct sound Direct input Direct draw Direct 3D

X

(cid:132) Simple primitives: points, lines, polygons (pixels, images, bitmaps)

……..

(cid:132) 3D rendering

Windows system Windows system

(cid:132) Frame buffer configuration done by the window system

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

51 52

Phần cứng đồ hoạ (Graphics Phần cứng đồ hoạ (Graphics Hardware) Hardware)

Các thiết bị vào ra dữ liệu (cid:132) Máy in

(cid:132) Các thành phần phần cứng của hệ đồ hoạ tương

(cid:131) Dot size: đường kính của một điểm in bé nhất mà máy

tác

in có thể in được

(cid:131) Addressability: khả năng địa chỉ hoá các điểm in có thể

có trên một đơn vị độ dài (dot per inch) (cid:131) Số lượng màu có thể vẽ trên một điểm

(cid:132)

Dot size 8 - 20/ 100 inch (cid:132) InkJet (cid:132) Laser 5/1000 inch (cid:132) Máy vẽ 6 ÷ 15/1000 inch

Point per inch 200 ÷600 1500 1000 ÷ 2000

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

9

53 54

Khoa CNTT - ĐHBK Hà nội Email: hunglt@it-hut.edu.vn Tel: 0913030731

Màn hình CRT

Màn hình CRT

Standard Dot-trio

SONY Trinitron CRT

Hitachi EDP

NEC Hybrid Mask

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

55 56

Các thiết bị hiển thị dạng vector

Graphics Devices

(Display commands)

Interface to host computer

(interaction data)

(cid:132) MOVE 10,15 (cid:132) LINE 400,300 (cid:132) LINE 600,800 (cid:132) Refesh Buffer

Display processor

CRT

Stylus

B

A

DrawLine(A, B): Turn beam off, move to A. Turn beam on, move to B.

Refresh buffer memory

Alphanumeric keyboard

Data tablet

… … MOVE 10 15 LINE 100 25 CHAR LU CY LINE … … JMP

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

57 58

Các thiết bị hiển thị dạng điểm

Typical raster graphics display showing a house and a star

Interface to host computer

(Display commands)

(interaction data)

Keyboard

Display processor

Data input

CRT

00000000000000000000000001000000 00000000000000000000000001000000 00000000000000000000000111110000 00000000011000000001111111111111 00000000111100000000000111110000 00000011111111000000000001000000 00001111111111110000000001000000 00111111111111111100000000000000 00011111111111111000000000000000 00011111111111111000000000000000 00011111111111111000000000000000 00000000000000000000000000000000

Bitmap refresh buffer (the 1’s are accentuated for contrast)

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

10

59 60

Khoa CNTT - ĐHBK Hà nội Email: hunglt@it-hut.edu.vn Tel: 0913030731

LCD-Liquid Crystal Display

CRT Displays

(cid:132) A transmissive technology (cid:132) Works by letting varying

Disadvantages (cid:132) Large and heavy (typ. 70x70

Advantages (cid:132) Fast repsonse (high resolution possible)

cm, 15 kg)

(cid:132) Full color (large modulation

(cid:132) High power consumption (typ.

amounts of a fixed-intensity white backlight through an active filter

depth of E-beam)

140W)

(cid:132) Organnic crystals that lign

(cid:132) Harmful DC and AC electric

themselves together

and magnetic fields

(cid:132) Saturated and natural colors (cid:132) Inexpensive, matured

(cid:132) When external force is applied

technology

(cid:132) Flickering at 50-80 Hz (no

memory effect)

(cid:132) Wide angle, high contrast

they realign themselves (cid:132) This is used to change

and brightness

(cid:132) Geometrical errors at edges

polarisation and filter light

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

61 62

LCD Displays

Future Research Areas Hướng nghiên cứu

(cid:132) Rendering

Disadvantages (cid:132) High price (presently 3x CRT) (cid:132) Poor viewing angle (typ. +/- 50

Advantages (cid:132) Small footprint (approx 1/6 of CRT) (cid:132) Light weight (typ. 1/5 of CRT) (cid:132) Low power consumption (typ. 1/4 of

degrees)

CRT)

(cid:132) Graphics accelerators (cid:132) parallel processing (cid:132) Geometric modeling (cid:132) physically-based

(cid:132) Low contrast and luminance (typ.

(cid:132) Completely flat screen - no

1:100)

geometrical errors

(cid:132) photo-realism (cid:132) real-time (cid:132) image-based rendering (cid:132) non-photorealistic

(cid:132) Low luminance (typ. 200 cd/m2)

(cid:132) Crisp pictures - digital and uniform

rendering

modeling (cid:132) level of detail (cid:132) Motion control /

colors

(cid:132) No electromagnetic emission (cid:132) Fully digital signal processing

possible

(cid:132) Scientific visualization (cid:132) Geometric algorithms (cid:132) User interface

synthesis (cid:132) kinematics / dynamics (cid:132) motion capture/ modification

(cid:132) Large screens (>20 inch) on desktops

(c) SE/FIT/HUT 2003

(c) SE/FIT/HUT 2003

11

63 64