• Non ci sono risultati.

Rendering Algorithms Paradigms

N/A
N/A
Protected

Academic year: 2021

Condividi "Rendering Algorithms Paradigms"

Copied!
12
0
0

Testo completo

(1)

PART 2: the other main approach

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

image

plane eye

pos

Rendering Algorithms Paradigms

For each pixel p:

make a ray r

for each primitive o in scene:

if intersect(r,o) then find color for o

color p with it

For each primitive o:

find where o falls on screen rasterize 2D shape

for each produced pixel p : find color for o

color p with it

R AS TE R IZ AT IO N BA SE D : R AY -T R AC IN G

LIGHTING

PROJECTION

3D 2D

(aka TRANSFORM)

(2)

to “Rasterize”:

• convert a 2D shape

– e.g.: text, polygons, curves, …

into pixels

– in a raster image

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

Jim Blinn, C.G. pioneer.

(OLD photo)

One hobby: colleting algorithms to rasterize circles

Rasterization based : Primitive di rendering Q: quali primitive di rendering per rasterization based?

A: qualunque cosa io sappia:

1) proiettare da 3D a 2D 2) rasterizzare* in 2D

* convertire in pixel

Primitive comuni:

– SEGMENTI – PUNTI

– ma soprattutto TRIANGOLI

(3)

detto anche “T&L”: Transform & Lighting...

• Transform :

– trasformazioni geometriche

– scopo: portare le primitive sul piano immagine

– (… ma anche comporre le primitive per formare la scena)

– come: un argomento delle prossime lez

• Lighting :

– computo illuminazione

– scopo: calcolare il colore finale di ogni parte della scena

• risultante da

– le sue caratteristiche ottiche – l'ambiente di illuminazione – la geometria (forma degli oggetti) – come: un argomento delle prossime lez

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

Rasterization-based HW-supported rendering

• also known as

Transform and Lighting (T&L)

Scena 3D rendering screen buffer

composta da primitive di pochissimi tipi:

• punti

• linee

MA SOPRATUTTO

• triangoli

primitive

di rendering

(4)

Rasterization-based HW-supported rendering

• decompose entire scene with 3D TRIANGLES

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

x

y z

v 0 =( x 0 , y 0 , z 0 )

v 1 =( x 1 , y 1 , z 1 ) v 2 =( x 2 , y 2 , z 2 )

... Rasterization-Based Rendering

vertici 3D

fragment

process pixels finali

"frammenti"

(fragments) transform

z x

v

0

v

1

v

2

rasterize y

triangolo 2D a schermo

(2D screen triangle) v

0

v

1

v

2

(5)

Rasterization-based pipeline

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

Rasterization-based rendering

• Input: set of vertices and its associated attributes

• Algorithm goes through several phases:

1. Per-vertex transformations and attributes setup 2. Primitive processing

3. Rasterization

4. Per-fragment computation

(6)

THE GREAT DEBATE

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

RASTERIZATION RAY-TRACING

Rendering Algorithms Paradigms

for each pixel

for each primitive

R AS TE R IZ AT IO N BA SE D : R AY -T R AC IN G

for each primitive

for each pixel

(7)

Advantages of ray tracing

• Conceptually simple algorithm

• Takes into account GLOBAL effects

• More realistic rendering of lighting effects

• More freedom of primitives

(intersect easier than project+rasterize)

• Potentially great scalability with scene complexity

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

Ray-tracing :

semplicità ed eleganza?

un intero raytracer su una buseness card :-P !

(by Paul Heckbert)

(8)

Advantages of rasterization

• More easily parallelizable?

• More controllable complexity

• Better-suited for graphics cards (for now)

• Easier with dynamic scenes?

• Better treatment of anti-aliasing (more later on)

• Better scalability with image resolution

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

Historic View

• Ray-tracing

– algorithm of choice for OFF LINE rendering – used for MOVIES (and CGI static images)

– Pixar, Dreamworks, etc. favourite

– well known ray-tracers: POV-ray, renderman, YafaRay…

• Rasterization

– algorithm of choice for REAL TIME rendering – used for GAMES (and previews, and 3D on web…)

– Nvidia, ATI, etc. favourite

– First to get specialized HW

(9)

Paradigmi di rendering

(classi di algoritmi di rendering)

• Ray-Tracing

• Rasterization based

• Image based (per es. light field)

• Radiosity

• Point-splatting

• Photon mapping

• ...

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

“Real Time Ray-Tracing: The End of

Rasterization?” (Jeff Howard )

(10)

A fairer comparison

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

The commonplaces

• Raytracing:

– good for complex visual effects

• shadows, specular reflections, refractions...

– SW-based (CPU)

– therefore: off-line, hi-quality renderings!

• Rasterization:

– fast!

• for each primitive, process only a few pixels (instead of: for each pixel, process all primitives)

– HW-based (GPU)

– therefore: real-time, compromise-quality renderings!

(11)

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

Reality : Ray-Tracing

Scene: 5 alberi (milionate di triangoli) 28mila girasoli (11 tipi), 35K triangoli ciascuno.

OpenRT Project

inTrace Realtime Ray Tracing Technologies GmbH MPI Informatik, Saarbrueken - Ingo Wald 2004

not necessarily SLOW!

• algorithm and data structures for efficient “spatial queries”

• even sub-linear with number of primitive!

not necessarily SW:

• Specialized HW?

• GP-GPU?

Reality: Rasterization based

• not necessarily without

complex visual effect

(they just require some approx and

a few advanced algorithms)

(12)

The reality

M a r c o T a r i n i ‧ C o m p u t e r G r a p h i c s ‧ 2 0 1 6 / 2 0 1 7 ‧ U n i v e r s i t à d e l l ’ I n s u b r i a

Rasterization is fast, but needs cleverness

to support complex visual effects.

Ray tracing supports complex visual effects, but needs cleverness

to be fast.

David Luebke (NVIDIA)

Riferimenti

Documenti correlati

Step 1: If the government chooses a debt level higher than λθ L both in the economy with and without credit protection we have that consumption in period 0 and in the high state

6 shows the Impulse Response (not integrated) in the octave band of 1 kHz obtained in receiver # 19 with the Ray Tracing program and with Ramsete at various number of pyramids,

inTrace Realtime Ray Tracing Technologies GmbH MPI Informatik, Saarbrueken - Ingo Wald 2004. not

inTrace Realtime Ray Tracing Technologies GmbH MPI Informatik, Saarbrueken - Ingo Wald 2004 HW specializzato.. per

inTrace Realtime Ray Tracing Technologies GmbH MPI Informatik, Saarbrueken - Ingo Wald 2004 HW specializzato.. per

inTrace Realtime Ray Tracing Technologies GmbH MPI Informatik, Saarbrueken - Ingo Wald 2004 (parallelizzare).. Implementazione del tutto differente dal nostro pipeline

•  Definizione della trasformazione di proiezione (il modo di mappare informazioni 3D su un piano immagine 2D);.. •  Definizione dei parametri di vista (punto di vista, direzione di

Nella proiezione prospettica, ogni insieme di linee parallele (ma non parallele al piano di proiezione) converge in un punto detto punto di fuga;. Se l’insieme di linee è parallelo