Presentation is loading. Please wait.

Presentation is loading. Please wait.

Real-time rendering – randare în timp real

Similar presentations

Presentation on theme: "Real-time rendering – randare în timp real"— Presentation transcript:

1 Real-time rendering – randare în timp real
Curs 5 Real-time rendering – randare în timp real

2 Real-time requirements: - Load poligonal scăzut pe pipeline-ul grafic
Real Time rendering Real-time requirements: - Load poligonal scăzut pe pipeline-ul grafic Metode conservative si neconservative Culling (conservativ) Simplificare (neconservativ) IBR - Image Based Rendering (hibrid)

3 Culling

4 Culling 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)

5 BackFace Culling

6 Fiecare poligon este asociat cu o normală care îi determină orientarea
Backface culling 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 = Vizibil I = Invizibil

7 Backface culling 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

8 Backface 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

9 Backface 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)

10 ViewFrustum Culling

11 Viewfrustum culling Poligoanele care nu sunt incluse în volumul de vedere nu sunt vizibile Acestea trebuie identificate pentru a nu fi trimise la pipeline

12 Viewfrustum culling CLIPPING Removal of triangles (or portions) not falling inside the view volume Efficient HW technique Takes place later in the pipeline Does not affect the polygonal load on thee pipeline

13 Viewfrustum 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

14 Viewfrustum 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 inside so 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

15 Dq against VF → Still outside Dq towards VF → Check VF
Viewfrustum culling Frame to Frame Coherence: Objects not visible at time t, will be probably not visible also at t+Dt Coherence test for traslation (Dd) and rotation (Dq) of the viewpoint: BS BS Dd Dq Dd < distance → Still outside Dd > distance→ Check direction, then possibly check VF Dq against VF → Still outside Dq towards VF → Check VF

16 Considering planes normals oriented towards the VR inside:
VF Culling test 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 BB BS BS BB BB BS

17 Frustum in Clip Space 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 to be checked can be trasformed quickly and tests can take place in the clip space

18 Occlusion Culling

19 Occlusion 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

20 Occlusion 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

21 Occlusion culling: HOM
Which depth test is made? Minimal depth-test: a plane behind the occluder is tested: if the object is behind this plane is a good candidate to be culled

22 Occlusion 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 (starting with 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)

23 Occlusion culling: HOM

24 Portal Culling

25 Potentially 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

26 Potentially 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)

27 Simplification techniques

28 Simplification 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

29 Level 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

30 Level 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

31 Image Based Rendering

32 Image 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)

33 Billboards 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

34 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)

35 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

36 Impostors 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

37 Impostors 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 Ds lateral or forward, the error becomes too big. After a certain threshold a new impostor must be created

38 Impostors: errors Objects are not anymore 3D
This leads to errors in intersecting objects Possible solution: layered impostors

Download ppt "Real-time rendering – randare în timp real"

Similar presentations

Ads by Google