300 likes | 552 Views
Kai Hormann · Marco Tarini. A Quadrilateral Rendering Pri mitive. A Quadrilateral Rendering Primitive. Visual Computing Group · CNR · Pisa. Motivation. our method. diagonal split. quadrilaterals. triangles. modelling primitive. rendering primitive. How to render a quad ?.
E N D
Kai Hormann · Marco Tarini A Quadrilateral Rendering Primitive A QuadrilateralRendering Primitive 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) • diagonal split • two triangles • linear in each triangle 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 • two-fold linear • linear along edges • linear along horizontal spans 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 • projective map • unique mapping from unit square to quad 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 • bilinear interpolation • unique mapping from unit square to quad A Quadrilateral Rendering Primitive
How to render a quad ? bilinear interpolation two-fold linear diagonal split 1 projective map new method diagonal split 0 A Quadrilateral Rendering Primitive
General concept vertex process rasterizer fragment process final pixels 2D screen quad fragments 3D vertices A Quadrilateral Rendering Primitive
General concept vertex process rasterizer fragment process final pixels 2D screen quad fragments 3D vertices • remains the same • project vertices • define vertex attributes • etc A Quadrilateral Rendering Primitive
General concept vertex process rasterizer fragment process final pixels 2D screen quad fragments 3D vertices • remains the same • depth test shading texture accesses etc. • remains the same • depth test • shading • texture accesses • etc. A Quadrilateral Rendering Primitive
General concept vertex process rasterizer fragment process final pixels 2D screen quad fragments 3D vertices • 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 • rasterization • general scan-line algorithm • via edge-functions convex concave (v-shape) self-intersecting (cross-shape) A Quadrilateral Rendering Primitive
General concept vertex process rasterizer fragment process final pixels 2D screen quad fragments 3D vertices • a new quad rasterizer • determine fragments to be covered • interpolate attributes per fragment A Quadrilateral Rendering Primitive
Interpolating vertex attributes 2 Σ A(v, vi+1,vi+2) a(v)= λi(v)ai λi(v)= i=0 A(v0, v1,v2) • triangles • barycentric coordinates • weights for linear interpolation v1 v v2 v0 A Quadrilateral Rendering Primitive
Generalized barycentric coordinates αi 2 tan + tan μi(v)= αi-1 ri 2 μi vi+1 λi(v)= v 3 αi Σ μj αi-1 j=0 ri vi-1 vi • Quadrilaterals • Mean value coordinates (Floater 2003) A Quadrilateral Rendering Primitive
Generalized barycentric coordinates v vi+1 αi αi-1 ri vi-1 vi • properties • 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 A Quadrilateral Rendering Primitive
Example • interpolating texture coordinates texture A Quadrilateral Rendering Primitive
Perspective correction 3 3 3 / Σ 1 a(v)= λi(v)ai Σ Σ a(v)= λi(v) λi(v) ai wi i=0 i=0 i=0 wi without 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 • it also works for exterior quads all vertices in front some vertices behind A Quadrilateral Rendering Primitive
Points behind the eye 4. 1. 5. 2. 6. 3. 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 • edge functions for membership test • 5 instead of 3 • fewer and larger primitives • 1 quad instead of 2 triangles 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
Why don’t we just use more triangles? a lot of triangles more quads few quads few triangles quality complexity A Quadrilateral Rendering Primitive