1. Trang chủ
  2. » Công Nghệ Thông Tin

Giáo trình thực tại ảo BKHN lession 2 graphics system

39 310 1

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 39
Dung lượng 1,67 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

4 Hệ thống đồ hoạ Graphics System  Interface between application software and graphics hardware system  Consists of input subroutines and output subroutines accepting input data or co

Trang 1

Lession 2 - Graphics System

Lê Tấn Hùng Hanoi University of Technology hunglt@it-hut.edu.vn

Trang 3

Application program

Graphics system

Graphics hardware

Input and output devices

Trang 4

4

Hệ thống đồ hoạ

(Graphics System)

 Interface between application software and graphics hardware system

 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

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

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ạ

Trang 5

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

Th ành phần trong chức năng của

kỹ thuật đồ hoạ

Trang 6

6

3D Graphics Over World Wide Web

SRGP library

Pascal / C program

X Window System Graphics hardware

Image

image formats, compression, transfer

graphics algorithms colour

lines,areas,

positions

Video WWW

Animation

WWW VRML

Trang 7

Các chuẩn giao tiếp của hệ đồ hoạ

 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

 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

 CGM (Computer Graphics Metafile): xác định các chuẩn cho việc lưu trữ và chuyển đổi hình ảnh

 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

 PHIGS (Programmers Hierarchical Interactive Graphics 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

Trang 8

8

Non-official industry standards

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

 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

 DIRECTX thư viện đồ hoạ của hãng Microsoft

Direct X/Direct3D 1997

Trang 9

 Simple primitives: points, lines,

polygons (pixels, images, bitmaps)

Trang 10

10

– OpenGL Utility Library (GLU)

– Window system support libraries

 GLX / WGL / PGL

– OpenGL Utility Toolkit (GLUT)

– OpenInventor

For portability, there are

no commands for these

OpenGL-related Libraries

Trang 11

 Direct control of graphics hardware

 Direct control of input/output devices, and sound

Application program

Windows system

Direct sound

Direct draw Direct 3D

Trang 12

12

OpenGL Design Goals

 SGI’s design goals for OpenGL:

– High-performance (hardware-accelerated) graphics API

– Some hardware independence

– Natural, terse API with some built-in extensibility

 OpenGL has become a standard (competing with DirectX) because:

– It doesn’t try to do too much

 Only renders the image, doesn’t manage windows, etc

 No high-level animation, modeling, sound (!), etc

– It does enough

 Useful rendering effects + high performance

– Open source and promoted by SGI (& Microsoft, half-heartedly)

Trang 14

Graphics Hardware

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

Trang 15

Chức năng nhiệm vụ

 CPU: thực hiện các chương trình ứng dụng

Bộ xử lý hiển thị (Display Processor): thực hiện công việc hiển thị dữ liệu đồ hoạ

 Bộ nhớ hệ thống (System Memory): chứa các chương trình và dữ liệu đang thực hiện

 Gói phần mềm đồ hoạ (Graphics Package): cung cấp các hàm đồ hoạ cho chương trình ứng dụng

 Phần mềm ứng dụng (Application Program): phần mềm đồ hoạ ứng dụng

 Bộ đệm ( Frame buffer): có nhiệm vụ chứa các hình ảnh hiển thị

 Bộ điều khiển màn hình (Video Controller): điều khiển màn hình, chuyển dữ liệu dạng số ở frame buffer thành các điểm sáng trên màn hình

Trang 16

Vi xử lý đồ họa - Graphics Pro Unit

July 01 Jan 02 July 02 Jan 03 July 03 Jan 04

multiplies per second

Trang 17

Đặc điểm của GPU

 Ưu điểm

 Modern GPUs có khả năng lập trình

– Lập trình trên pixel, vertex, video engines – Hỗ trợ lập trình với các ngôn ngũ bậc cao

 Modern GPUs hỗ trợ độ chính xác cao

– Hỗ trợ 32 bit floating point trên pipeline

 Kiến trúc mức thấp:

– Thường song song

– Phát triển liên tục

Trang 18

Mô hình GPU cơ bản

The Graphics Pipeline

– Luồng luôn thay đổi độ và chuyển đổi dũ liệu giữa

các phần nhiều

– Nhiều caches, FIFOs, và nhiều vấn đề khác

GPU CPU

Application Transform Rasterizer Shade Video

Memory (Textures)

Vertices (3D) Xformed, Lit Vertices

(2D)

Fragments (pre-pixels)

Final pixels (Color, Depth )

Graphics State

Render-to-texture

Trang 19

Video Memory (Textures)

Vertices (3D)

Xformed, Lit Vertices (2D)

Fragments (pre-pixels)

Final pixels (Color, Depth) Graphics State

Render-to-texture

Vertex Processor Processor Fragment

Trang 20

GPU Pipeline:

Transform

– Transform from “world space” to “image space”

– Compute per-vertex lighting

Trang 21

GPU Pipeline:

Rasterizer

– Chuyển đổi các đối tượng hình học (vertex) thành các biểu diễn ảnh (fragment)

 Fragment = image fragment

– Pixel + associated data: color, depth, stencil, etc

– Chấp nhận nội suy tạo các điểm ảnh

Trang 22

GPU Pipeline: Tạo bóng - Shade

– Compute a color for each pixel

– Optionally read colors from textures (images)

Trang 23

Song song dữ liệu trong xử lý

 GPU: Each vertex / fragment is independent

– Temporary registers are zeroed

– No static data

– No read-modify-write buffers

 Data parallel processing

– Best for ALU-heavy architectures: GPUs

 Multiple vertex & pixel pipelines

– Hide memory latency (with more computation)

 Arithmetic Intensity

– GPGPU demands high arithmetic intensity for peak performance

– Ex: solving systems of linear equations

– Physically-based simulation on lattices

Trang 24

Data Streams & Kernels

– Collection of records requiring similar computation

 Vertex positions, Voxels, FEM cells, etc

– Provide data parallelism

– Functions applied to each element in stream

 Transforms, PDE, …

– No dependencies between stream elements

 Encourage high arithmetic intensity

Trang 25

Ví dụ trong bài toán - Simulation Grid

– Textures represent computational grids = streams

Trang 26

Stream Computation

– Made up of steps

– Each step updates entire grid

– Must complete before next step can begin

– Kernel applied to each stream element

Trang 27

Computational Resources Inventory

– Vertex & Fragment pipelines

Trang 28

Fragment Processor

– No random access memory writes

– Output address fixed to a specific pixel

– More fragment pipelines than vertex pipelines

– RAM read

– Direct output

Trang 29

CPU-GPU Analogies

– GPU programming is graphics-centric

Trang 30

CPU-GPU Analogies

Trang 31

CPU-GPU Analogies

Loop body / kernel / algorithm step = Fragment Program

Trang 32

Feedback

results of previous steps

results of the previous time step

Trang 34

GPU Simulation Overview

– Algorithm steps are fragment programs

 Computational “kernels”

– Current state variables stored in textures

– Feedback via render to texture

computation?

Trang 35

Invoking Computation

– Just draw geometry!

– Most common GPGPU invocation is a full-screen quad

Trang 36

Typical “Grid” Computation

– Setup input textures, fragment program

– Draw a full-screen quad (1x1)

Trang 37

Branching Techniques

– No true fragment branching on NV3X & R3X0

– Replace with math

– Occlusion Query

– Domain decomposition

– Z-cull

– Pre-computation

Trang 38

High-level Shading Languages

– Cg:

 http://www.nvidia.com/cg – HLSL:

 us/directx9_c/directx/graphics/reference/highlevellanguageshaders.a

http://msdn.microsoft.com/library/default.asp?url=/library/en-sp – GLSlang:

Trang 39

GPGPU Languages

 Why do we want them?

– Make programming GPUs easier!

 Don’t need to know OpenGL, DirectX, or ATI/NV extensions

 Simplify common operations

 Focus on the algorithm, not on the implementation

Ngày đăng: 24/10/2014, 01:37

TỪ KHÓA LIÊN QUAN