1 / 23

09 July 2013 update

Trigons, Normals, and Quadragons Vector-based Solutions to the Classic Problems of Computer Graphics. 09 July 2013 update. Notes / Options: Slideshow animated (F5) See also slide footnotes. J. Philip Barnes. Overview. Display a 3D-math-modeled shape on a 2D screen. Presentation Contents

saddam
Télécharger la présentation

09 July 2013 update

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Trigons, Normals, and Quadragons Vector-based Solutions to the Classic Problems of Computer Graphics 09 July 2013 update Notes / Options: Slideshow animated (F5) See also slide footnotes J. Philip Barnes

  2. Overview Display a 3D-math-modeled shape on a 2D screen • Presentation Contents • “Flexible-cylinder” geometry grid • Geometry math modeling tools • Vectors ~ history & key operations • Fast world-to-pyramid transformation • Review & Renew: Rotation matrices • Review & Renew: Z-buffer & Ray-casting • Vector solution : “Point-in-polygon” • Vector solution: Inter-vertex interpolation • Vector solution: Constant-curvature Tesselation • “Pyranometer” ambient lighting model • Apply ~ "Render Raptor" & “TrigonoSoar” Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  3. “Flexible Cylinder” Geometry Grid y q l q z l x Vertex Normal Vertex Quadragon Computer graphics classic problem 1: Generate and manage 3D geometry Arrays and Subscripts Object (n), Row (i), Col (j), Vertex (k), Quadragon (m) Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  4. Geometry Math-model Building Blocks 1.0 1.0 Pseudo-Cosine 0.8 0.8 0.6 0.6 e = sin(hm p) 0.4 0.4 Pseudo-Sine 0.2 0.2 h 0.0 0.0 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 1.0 1.0 Exponential Varabola 0.8 0.8 e =e-5hm e = hm 0.6 0.6 0.4 0.4 0.2 0.2 h 0.0 0.0 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 m = 2.0 1.0 0.5 e y / ymax = cos m (hp/2) h x / xmax Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  5. Review, Renew, Theory, & History* of the Casteljau-Bézier Curve • P. De Casteljau first conceived (1963) today’s “Bézier Curve” • His notes & algorithm remained proprietary at Citroën for years • Set (Np) Control points for control polygon near, not on, curve • (Np-1, Np-2,...) interpolation series on polygon-sides for x(t), y(t) • De Casteljau’s Algorithm is represented by the Bernstein Basis • as discovered by A.R. Forrest ~ Geometric construct → math • S. Bernstein’s polynomial (B) derivative (dB/dt) is introduced herein • P. Bézier independently conceived (1966) the control polygon • Weight factors not widely used (differ from Casteljau/Bernstein) • Bézier’s work at Rénault is the foundation of UNISURF & CATIA p2 1/3 y p3 1/3 x,y 1/3 p1 pNp t = 1/3 x Animated graphic (shift F5) * R.T. Farouki, The Bernstein polynomial basis: a centennial retrospective, UC Davis, 03 Mar 2012 * G. Farin, A History of Curves and Surfaces in CAGD, Arizona State University, 2007 Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  6. Demo: Casteljau-Bézier 2D Curve Example x = S Bi Xpi 4 3 N=Vxk V y = S Bi Ypi t 5 6 1 2 V = (dx/dt) i + (dy/dt) j dx/dt = S (dB/dt)iXpi dy/dt = S (dB/dt)iYpi Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  7. “TrigonoSoar” Math-modeled 3D Surface Aero axes z y x Chord, thickness, twist, etc. parametric along the spar from centerline to winglet tip Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  8. Math-modeled Aircraft Algebratross Wandering Albatross RegenoSoar Regenerative-soarer Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  9. “RenderRaptor” ~ Wireframe & Flat-Shade Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  10. Vectors ~ Origin and Key Operations Unit vectors a  A / |A| b  B / |B| c  C / |C| cosg = a b sin g = |axb| y C B j g Oliver Heaviside J. Willard Gibbs A c k i z x Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  11. Vector Cross Product ~ Elegant Visual Derivation y C=AxB B j A k i z x y, j Ay By Az Ax Bz Bx z, k x,i Add cross products, each axis Important ~ Retain order A:B Cx = AyBz - Az By Cy= AzBx - AxBz Cz= Homework ! To obtain the cross product AxB above, simply add the orthogonal cross product components as shown at upper right Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  12. yp xp e k xs, zs z-ze Fast World-to-Pyramid Transform & 90oExclusionCriteria Graphics classic problem 2: Efficiently project any vertex (v) in 3D onto 2D screen, given: eye point (e) and focus point (f) Approach: Twice rotate the world about axes through (e), operating on coordinate differences (x-xe etc.) First test a new "90-deg exclusion" criterion. Skip transformations for any quadragon which, after transformation, would have all vertices (v) at least 90o from the line of sight, based on the angle included by the vectors ev& ef using only the dot-product sign. This adds 3 multiplications (xv-xe)(xf -xe) + (yv-ye)(yf -ye) + (zv-ze)(zf -ze) for all vertex coordinates, but avoids at least 9 to transform excluded vertices & unit-normals. After world rotations y-ye ef e View Pyramid n Focus point Eye point ef f e v ev ef cosn Before world rotations n 1. cosn = |zf - ze| / ef ; sinn= -(yf - ye) / ef 2. sine = (xf - xe) / (ef cosn) ; cose = (zf - ze) / (ef cosn) 3. Rotate (e) about y-ye axis through point (e) 4. Rotate (n) about x-xe axis through point (e) 5. Optionally rotate (k) for “cockpit-roll” effect 6. Project to screen (perspective transformation) x-xe Animated graphic (shift F5) Chart origin: JPB, 2007 Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  13. Rotation Matrix Concatenation ~ Review and Renew Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  14. Demo: object-maneuver and world-pyramid rotations Stationary object, moving observer Fixed observer, maneuvering object Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  15. Polygon Pipeline Overview (incl. inner surfaces when applicable) Polygon Pipeline Filter J. Philip Barnes, 2013 Initialize: No q'gons-in-pyramid ("QiP"=0) ~ partly/fully Init: “raybox” corners to screen center (if ray-casting) For each quadragon of each polyhedron: Get/set vertex model coords., normals, & in/out colors Model-to-World transform q'gon vertex coords.only Check: all q'gon vertices pass the 90o exclusion test OK, World-pyramid & perspective x'form vertex coords. Test: q'gon at least partially overlaps the screen ; OK, Model-world and world-pyramid x'form vertex normals Get 4 corners of q'gon bounding box and 2 of pixel-box Update raybox top-left, low-right corners (if ray-casting) Get q'gon centroid (zc) ; assess in(out)-facing Add q’gon as member of “quadragons in pyramid” (QiP) Screen Plane Raybox y Screen z pixel box x quadragon bounding box pixel (p) Z-buffer(E. Catmull / W. Straber, 1974) Suggested Implementation J. Philip Barnes, 2013 Sort QiPs by in(out)-facing and (zc) Initialize: For each pixel (i,j), zref = -  For each in(out)-facing QiP (q'gon-in-pyramid) Get pixel box upper-left/lower-right pixel indices For each pixel (i,j) of the pixel box Get pixel screen coordinates (xp,yp) Test: (p) inside q'gon projection ; OK, interp. (zp) Test at pixel (i,j): zp > zref ; OK, zref = zp Interp. normals at (p) ; shade pixel if it is visible Ray-casting(Arthur Appel, 1968) Projection-Ray / Z-bufferHybrid, J. Philip Barnes, 2013 Sort QiPs by (zc) ; Initialize: “hit_index” = -1 For each “screen-raybox” pixel (p); zref = -  Get pixel sceen x-y ; Cast eye-to-pixel ray For each QiP, test: 2D overlap box includes (p) OK, test: point (p) is inside QiP projection OK, interpolate (zp) on QiP ; Test: zp > zref OK, hit_index = QiP_index ; zref = zp At hit, interp. normals ; shade pixel if it is visible Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  16. Vector determination of "point-in-polygon" y 3 E2 E3 P 2 E1 P1 P 1 x Computer graphics classic problem 3: Given 2D coordinates of vertices and point (P), determine if (P) resides inside Define: EiEdge vector, vertex(i)-to-next(i+1) PiPoint vector, vertex(i)-to-point (P) zUnit vector out of the page Observe: (P) inside: E1 x P1 points out of the page (P) outside: E1 x P1 points into the page Therefore: Point (P) is outside if, for any vertex (i), ( Ei x Pi ) ● k < 0 Postulate: Applies to any convex polygon Chart origin: JPB, 2007 Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  17. Inter-vertex Interpolation ~ Vector Solution 4 Computer graphics classic problem 4: Given coords. & properties at vertices 1-2-3, interpolate the properties at point (p) y 3 Classic method: “scan line” (comp. intensive) Contemporary method: Barycentric Coords. Complementary Alternative : Vectors 2 p Apply vector tip-to-tail addition & scaling Solve for & store two “position parameters” Ro4 = Ro1 + R14 = Ro1 + aR1p = Ro2 + R24 = Ro2 + bR23 1 x o Equate Ro4 (Dx) & (Dy) to get a, b Finally, interpolate at (p): zp = z1 + [z2 + b (z3-z2) -z1] / a Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  18. Constant-curvature Tesselation Computer graphics classic problem 5: Tesselation of curved polygon Cartesian coordinates Apply: Breakup curved polygon to avoid edge-rendering artifacts Whenever at least one vertex is not visible Task: Get Cartesian coordinates of curved-polygon edge midpoint Problem: Barycentric coordinates assume a planar trigon surface But the trigon plane typically models a sphere, bowl, cylinder, or saddle surface Solution: Assume each trigon edge has constant curvature Method is exact for spherical surfaces, and perhaps so for cylindrical surfaces Unit-normal dot product (ua●ub) gets cos (q) ; solve for local curve radius (r) Vector cross product then gets from (m) to (e), [convex / concave automatic] c e b f Tesselate abc toefg m a Side view of trigon edge ab, midpoint (m), true surface point (e), & unit normals g b r e a q Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  19. “Pyranometer Model” of Ambient Lighting Sun shade pyranometer disk sees only the sky "dome" Computer graphics classic problem 6: Model ambient light before illumination • Classic lighting model: Uniform ambient • Then add illumination • Problem: • “Grey silhouette” until lights are added • Poor foundation of total reflection model • Idea: • Vary ambient reflection with orientation • ~ good foundation before illumination • Implementation: • pyranometer measures "skydome" light • - Rotated on it side ~ half the intensity • - Inverted ~ zero intensity (@ albedo=0) • Define: • pyranometer tilt angle (t) • Ground albedo (a) • Ambient Reflectance • r = 1 - t/p + a t/p Chart origin: JPB, 2007 Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  20. Pyranometer Vs. Uniform Ambient Model (cloudy day) Ground Albedo = 0.0 “Pyranometer” Ambient Ground Albedo = 0.5 “Uniform” ambient “Pyranometer” Ambient Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  21. "Render Raptor" ~ Math-modeled Aircraft Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  22. Summary ~ Trigons, Normals, and Quadragons • New Solutions: computer graphics classic problems • Complementary, faster, or better, with added insight • Graphical derivation of vector cross product • Fast world-to-pyramid transform ~ just two rotations • Rotation concatenation ~ Review and Renew • 90o exclusion criterion for world-to-pyramid transform • Polygon Pipeline Overview ~ Z-buffer & Ray Casting • Point-in-polygon ~ vector-based determination • Interpolation at point (p) ~ vector-based alternative • Constant-curvature Tesselation • “Pyranometer” ambient-lighting model foundation Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

  23. About the Author Phil Barnes has a Bachelor’s Degree in Mechanical Engineering from the University of Arizona and a Master’s Degree in Aerospace Engineering from Cal Poly Pomona. He has 32-years of experience in performance analysis and computer modeling of aerospace vehicles, engines, and subsystems, primarily at Northrop Grumman. He has authored SAE technical papers on aerodynamics, dynamic soaring, and regenerative soaring. This latest presentation brings together Phil’s knowledge and passions for computer graphics, and geometry math modeling. Trigons, Normals, and Quadragons J. Philip Barnes 09 July 2013 www.HowFliesTheAlbatross.com

More Related