virtual reality: history curs 5 real-time rendering – randare în timp real

38
Virtual Reality: Histo Curs 5 Curs 5 Real-time rendering – randare în timp real

Upload: brian-ballard

Post on 26-Mar-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Curs 5Curs 5

Real-time rendering – randare în timp real

Page 2: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Real-time requirements: - Load poligonal scăzut pe pipeline-ul grafic

Metode conservative si neconservative– Culling (conservativ)– Simplificare (neconservativ)– IBR - Image Based Rendering (hibrid)

Real Time renderingReal Time rendering

Page 3: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Culling

Page 4: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Principiu culling:Poligoanele care nu sunt vizibile de către utilizator nu trebuie randate:– Ascunse de alte poligoane ale aceluiași obiect

(Backface culling)

– Înafara volumului de vedere (Viewfrustum culling)

– Ascunse de alte obiecte (Occlusion culling)

CullingCulling

Page 5: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

BackFace Culling

Page 6: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Fiecare poligon este asociat cu o normală care îi determină orientarea

Poligoanele sunt astfel:– Frontfacing, când normala

intersectează planul utilizatorului– Backfacing, în caz contrar

În cazul obiectelor convexe, poligoanele backfacing sunt ascunse de cele frontfacing

V = VizibilI = Invizibil

Backface cullingBackface culling

Page 7: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

De la un viewpoint specific, doar câteva poligoane sunt vizibile (statistic 50 %)

Ignorând aceste poligoane, teoretic, performanțele ar trebui să crească mult (de 2 ori).

De fapt, acest lucru nu are loc din cauza calculului orientării care este realizat în pipeline-ul grafic, după transformările geometice

Backface cullingBackface culling

Page 8: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Backface culling hardwareBackface culling hardware

Plăcile grafice au implementate un HW backface test, care elimină poligoanele BF polygons înainte de etapa de iluminare

BF test este reprezentat de produsul scalar dintre normala la poligon (Np) și direcția de privire (D):

B = Np D B<0 frontfacing

B>0 backfacing

Np

Page 9: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Backface culling softwareBackface culling software

Ar fi bine să găsim poligoanele BF polys înainte de accesul la pipeline-ul grafic

Există tehnici SW Sunt eficiente dacă sunt folosite structuri ierarhice NORMAL MASKS (Zhang e Hoff, 1997)

– preprocessing (normal masks preparation)– run-time (test)http://www.cs.unc.edu/~zhangh/backface.html

Page 10: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

ViewFrustum Culling

Page 11: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Poligoanele care nu sunt incluse în volumul de vedere nu sunt vizibile

Acestea trebuie identificate pentru a nu fi trimise la pipeline

Viewfrustum cullingViewfrustum culling

Page 12: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Viewfrustum cullingViewfrustum culling

CLIPPINGCLIPPINGRemoval of triangles (or portions)Removal of triangles (or portions)not falling inside the view volume not falling inside the view volume

Efficient HW techniqueEfficient HW technique Takes place later in the pipelineTakes place later in the pipeline Does not affect the polygonal load onDoes not affect the polygonal load on

thee pipelinethee pipeline

Page 13: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Viewfrustum cullingViewfrustum culling

VF culling is an anticipated clipping Geometry is divided in:

– Inside Viewfrustum (visible) RENDERED– Outside Viewfrustum (invisible) CULLED

Simple VF Culling:– Each polygon is tested– Ineffective for many polygons– Scene Graph needed

osservatore

Page 14: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Viewfrustum cullingViewfrustum culling Hierarchical VF Culling:

– Nodes are tested(Bounding Volumes or SG node)

– If the node is completely outside the VF, so do also all the contained polys CULLED

– If the node is completely insideso do also all the contained polys RENDERED

– If the node is PARTIALLY inside: Lower level nodes are tested If the node is a leaf:

– Test on all polygons (uneffective)– All the polygons are RENDERED

Page 15: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Frame to Frame Coherence:Objects not visible at time t, will be probably not visible also at t+t

Coherence test for traslation (d) and rotation () of the viewpoint:

BS dBS

d < distance → Still outsided > distance→ Check direction, then possibly check VF

against VF → Still outsidetowards VF → Check VF

Viewfrustum cullingViewfrustum culling

Page 16: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

An object is outside the VF if it is behind at least one of its planes:Considering planes normals oriented towards the VR inside:– For a point:

distance from plane < 0– For a sphere:

distance center from plane < - r– For a box:

distance of its vertices < 0 (all 8 checks needed?)

Calculations are relatively simple, however the planes equations may be tricky

VF Culling testVF Culling test

BS

BSBS

BB

BB

BB

Page 17: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

The projection transforms the VR into a cube of vertices (±1,±1, ±1) (clip space)

Planes in Clip Space are easy to determine:– Eq. generic: ax+by+cz+d = 0– In this case: x = 1, x = -1, etc.

With the projection matrix the points tobe checked can be trasformed quickly andtests can take place in the clip space

Frustum in Clip SpaceFrustum in Clip Space

Page 18: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Occlusion Culling

Page 19: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Occlusion cullingOcclusion culling

Some polygons, although front-facing within the VF, can be hidden by other objects Z-Buffering

– Occlusion tested at pixel level– For each (x,y,z) in WindowSpace, the z value is tested against the z-buffer one related to position

(x,y)– If z is smaller the point is occlubed– Also in this case:

It is made downstream the pipeline Hidden polygons/objects should be identified upstream

Note: occlusion culling algorithms are usually heavy, should be used with HUGE scenes

Page 20: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Occlusion culling: HOMOcclusion culling: HOM Hierarchical Occlusion Map (Zhang, Manocha, Hudson e Hoff 1997)

Preprocessing:– OCCLUDER identification (probable occluder)

Quite big, possibly not too many polys

– Creation of the OCCLUDER db Depending on size and distance from the VP, at run-time some occluder are extracted

For each object a depth test is performed to check if it is behind an occluder

Page 21: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Occlusion culling: HOMOcclusion culling: HOM

Minimal depth-test: a plane behind the occluder is tested: if the object is behind this plane is a good candidate to be culled

Which depth test is made?

Page 22: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Occlusion culling: HOMOcclusion culling: HOM

Smart run-time phase: First, only the occluders are drawn in white. A

grey scale hierarchical map is retrieved (cluster 2x2 -> 1 pixel with averaged color)

Objects BVs are tested against the map (startingwith the coarsest level):

If the BV falls inside a white zone the object MAY be occluded: the depth-test will take place

If the BV falls inside a zone with even ONE non-white pixel, the immediately finer level is checked

Aggressive (non conservative) culling: the depth-test takes place even after a certain grey threshold (this means that objects might be “almost” occluded)

Page 23: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Occlusion culling: HOMOcclusion culling: HOM

Page 24: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Portal Culling

Page 25: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Potentially Visible SetsPotentially Visible Sets

Hi-level technique for architectural VE Environment subdivided in:

– CELLS: portions of space (usually BOXes)– PORTALS: 2D area connecting two cells

In architectural VEs:– CELL = Room– PORTAL = Door, Window, Mirror

Two cells can see each other through a portal Potentially visible set:

– Set of cells “visible” from a certain view point

Page 26: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Potentially Visible SetsPotentially Visible Sets

Building the PVS:– Active cell (where the observer is) is in the PVS– The cells visible from the active cell are in the PVS– The cells not inside the PVS are culled

Inside the PVS standard visibility techniques might be used

Not suitable for all the VEs (with some modifications can be adapted to outdoor VEs)

Page 27: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Simplification techniques

Page 28: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

SimplificationSimplification

Operate on the model complexity The idea is that, in some circumstances, simplified models can

be used withouth modifying too much the final result Generally there is a loss of details: non-conservative

techniques Techniques:

Level of Detail Image Based Rendering

Page 29: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Level of DetailLevel of Detail

Objects far from the VP do not need too many details, as they are not visible

They can do simplified depending on distance and angulation from the observer

LODs are alternative versions of the same mesh with different levels of complexity

Page 30: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Level of DetailLevel of Detail

LOD can be created: Off-line (maximum control, pre fixed complexity) Run-time (variable complexity)

run-time: progressive meshes Dynamic lods Only Δs are stored Optimal for network distribution

Page 31: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Image Based Rendering

Page 32: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Image Based RenderingImage Based Rendering

Culling and LOD tecnhiques aim to reduce the polygonal budget IBR aims to substitute polygons with images Very effective if used together with the other techniques Methods:

Static (Database Approach, Sprites) Dynamic (Impostors)

Page 33: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

BillboardsBillboards

Textures allow to simulate complex visual details on simple shapes.

Even only one polygon! Billboards are textured quads that rotate so as to always face the

viewpoint Good approximation for symmetric objects Simmetry:

Cylindric: axial rotation = arccos(Vd•Bn) Spheric: two rotation axes

Page 34: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Database Approach

Basic idea:All the possible views of an object are rendered and, at run-time, the one corresponding to the current VP is chosen

Actually, only a limited set of VPs are used. At run-time: The image corresponding the the closest VP is renderd Images are interpolated (morphing)

Page 35: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

ImpostorsImpostors

IMPOSTORS:IMPOSTORS:the view of the object is grabbed during the run-time phase so as to exploit the frame-to-frame coherence: probably in the next frame the object will have (almost) the same appearance

Page 36: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

ImpostorsImpostors

Impostors are view-dependent: the grabbed image is a faithful representation of an object only in a certain viewpoint V

In a range R of viewpoints around V the impostor is still a good approximation, outside the image can be very different

Outside R either the object must be rendered again or a new impostor must be created

Page 37: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

An impostor is valid in the frame when it is created The impostor is valid if the observer performs only

ROTATIONAL movements (the projection on the viewplane is not affected)

For translational movements, the representation changes. Beyond a certain s lateral or forward, the error becomes too big. After a certain threshold a new impostor must be created

ImpostorsImpostors

Page 38: Virtual Reality: History Curs 5 Real-time rendering – randare în timp real

Virtual Reality: History

Impostors: errorsImpostors: errors

Objects are not anymore 3D This leads to errors in intersecting

objects Possible solution: layered impostors