virtual reality: history curs 5 real-time rendering – randare în timp real
TRANSCRIPT
Virtual Reality: History
Curs 5Curs 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
Virtual Reality: History
Culling
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
Virtual Reality: History
BackFace Culling
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
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
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
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
Virtual Reality: History
ViewFrustum Culling
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
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
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
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
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
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
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
Virtual Reality: History
Occlusion Culling
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
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
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?
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)
Virtual Reality: History
Occlusion culling: HOMOcclusion culling: HOM
Virtual Reality: History
Portal Culling
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
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)
Virtual Reality: History
Simplification techniques
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
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
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
Virtual Reality: History
Image Based Rendering
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)
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
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)
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
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
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
Virtual Reality: History
Impostors: errorsImpostors: errors
Objects are not anymore 3D This leads to errors in intersecting
objects Possible solution: layered impostors