Folie 1 - Computer graphics (images)
Download
Report
Transcript Folie 1 - Computer graphics (images)
A AQuadrilateral
Quadrilateral
Rendering
Primitive
Rendering Primitive
Kai Hormann · Marco Tarini
Visual Computing Group · CNR · Pisa
Motivation
our method
diagonal split
quadrilaterals
triangles
modelling primitive
rendering primitive
A Quadrilateral Rendering Primitive
How to render a quad ?
diagonal split
two triangles
linear in each triangle
diagonal visible (C0)
A Quadrilateral Rendering Primitive
How to render a quad ?
diagonal split
two triangles
linear in each triangle
diagonal visible (C0)
A Quadrilateral Rendering Primitive
How to render a quad ?
two-fold linear
linear along edges
linear along horizontal
spans
two horizontal lines
visible (C0)
strongly view dependent
A Quadrilateral Rendering Primitive
How to render a quad ?
projective map
unique mapping from
unit square to quad
false depth-impression
not linear along edges
convex quads only
A Quadrilateral Rendering Primitive
How to render a quad ?
bilinear interpolation
unique mapping from
unit square to quad
costly geometry
refinement required
fold-overs for flat and
non-convex shapes
A Quadrilateral Rendering Primitive
How to render a quad ?
A Quadrilateral Rendering Primitive
General concept
3D
vertices
vertex
process
fragment final
process pixels
rasterizer
2D screen
quad
fragments
A Quadrilateral Rendering Primitive
General concept
3D
vertices
vertex
process
fragment final
process pixels
rasterizer
2D screen
quad
fragments
remains the same
project
vertices
define vertex attributes
etc
A Quadrilateral Rendering Primitive
General concept
3D
vertices
vertex
process
fragment final
process pixels
rasterizer
2D screen
quad
fragments
remains the same
depthtest
test
depth
shading
shading
textureaccesses
accesses
texture
etc.
etc.
A Quadrilateral Rendering Primitive
General concept
3D
vertices
vertex
process
fragment final
process pixels
rasterizer
2D screen
quad
fragments
a new quad rasterizer
determine
fragments to be covered
interpolate attributes per fragment
A Quadrilateral Rendering Primitive
Determine fragments to be covered
possible shapes of 2D screen quads
convex
concave
(v-shape)
self-intersecting
(cross-shape)
rasterization
general scan-line algorithm
via edge-functions
A Quadrilateral Rendering Primitive
General concept
3D
vertices
vertex
process
fragment final
process pixels
rasterizer
2D screen
quad
fragments
a new quad rasterizer
determine
fragments to be covered
interpolate attributes per fragment
A Quadrilateral Rendering Primitive
Interpolating vertex attributes
triangles
barycentric coordinates
A(v, vi+1,vi+2)
λi(v) =
A(v0, v1,v2)
v1
v
v2
weights for linear interpolation
v0
2
a(v) = Σ λi(v) ai
i=0
A Quadrilateral Rendering Primitive
Generalized barycentric coordinates
Quadrilaterals
Mean value coordinates
αi-1
αi
tan
+ tan
2
2
μi(v) =
ri
λi(v) =
v
μi
Σ j=0 μj
(Floater 2003)
vi+1
αi
αi-1
3
vi-1
ri
vi
A Quadrilateral Rendering Primitive
Generalized barycentric coordinates
properties
v
αi-1
Lagrange property
linear along edges
positive
work for all shapes
smooth (C∞ inside)
support front/back-facing
reproduce triangle coordinates
not too costly to compute
vi-1
vi+1
αi
ri
vi
A Quadrilateral Rendering Primitive
Example
interpolating texture coordinates
texture
A Quadrilateral Rendering Primitive
Perspective correction
3
a(v) = Σ λi(v) ai
i=0
without
ai
a(v) = Σ λi(v)
wi
i=0
3
/
3
1
λi(v)
Σ
wi
i=0
with
A Quadrilateral Rendering Primitive
Works in all cases
possible shapes of 2D screen quads
convex
concave
(v-shape)
self-intersecting
(cross-shape)
A Quadrilateral Rendering Primitive
Points behind the eye
all vertices in front
it also works for exterior quads
some vertices behind
A Quadrilateral Rendering Primitive
Points behind the eye
1.
4.
2.
5.
3.
6.
A Quadrilateral Rendering Primitive
Interpolating depth
A Quadrilateral Rendering Primitive
Discussion
blends well with current architecture
modifies the rasterizer only
vertex and fragment ops unchanged
properties of triangles carry over
depth calculation
behaviour along edges
allows mixed triangle/quad meshes
OpenGL and DirectX friendly
A Quadrilateral Rendering Primitive
Discussion
rasterization cost
generalized barycentric coordinates
for example, 19 ARB instructions
5 instead of 3
1 quad instead of 2 triangles
edge functions for membership test
fewer and larger primitives
A Quadrilateral Rendering Primitive
Discussion
increased quality
quad meshes look much better
almost identical to a refined mesh
view-dependency
A Quadrilateral Rendering Primitive
Future work
improving the method
extend to other primitives?
simplify formulas?
avoid view-dependency?
turn it into hardware
discuss feasibility with
graphics card developers
DirectX developers
OpenGL community
A Quadrilateral Rendering Primitive
Application front-end
OpenGL
quads are part of current syntax
our quads comply with the specs
reimplement GL_QUADS in the API
DirectX
need to add a new primitive type
A Quadrilateral Rendering Primitive
a lot of triangles
more quads
few quads
few
triangles
quality
Why don’t we just use more triangles?
complexity
A Quadrilateral Rendering Primitive