1 Pelican Aero Group J. Philip Barnes 07 Sept 2012 update Trigons, Normals, and Quadragons...
-
Upload
bernadette-george -
Category
Documents
-
view
219 -
download
0
Transcript of 1 Pelican Aero Group J. Philip Barnes 07 Sept 2012 update Trigons, Normals, and Quadragons...
1 Pelican Aero Group
J. Philip Barnes
07 Sept 2012 update
Trigons, Normals, and QuadragonsVector-based Solutions to the Classic
Problems of Computer Graphics
Notes / Options:Point-by-point slideshow F5 keyDon't miss the slide footnotes
2 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
Overview
Presentation Contents • “Flexible-cylinder” geometry grid • Geometry math modeling tools• Vectors ~ history & key operations • Fast world-to-screen transformation• Review/Renew: Z-buffer & Ray-casting • Vector solution : “Point-in-polygon” • Vector solution: Inter-vertex interpolation• Vector solution: Tesselate Cartesian coords.• “Pyranometer” ambient lighting model• Apply ~ "Render Raptor" & “TrigonoSoar”
Display a 3D-math-modeled shape on a 2D screen
3 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
“Flexible Cylinder” Geometry Grid
Computer graphics classic problem 1:Generate and manage 3D geometry
Arrays and SubscriptsObject (n), Row (i), Col (j),Vertex (k), Quadragon (m)
l
ql
q
z
x
y
Quadragon
VertexNormal
Vertex
4 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
Geometry Math-model Building Blocks
Pseudo-Cosine
0.0 0.2 0.4 0.6 0.8 1.00.0
0.2
0.4
0.6
0.8
1.0
e y / ymax
= cos m (hp/2)
h x / xmax
m = 2.0 1.0 0.5
Exponential
0.0 0.2 0.4 0.6 0.8 1.00.0
0.2
0.4
0.6
0.8
1.0
e = e-5h m
Pseudo-Sine
0.0 0.2 0.4 0.6 0.8 1.00.0
0.2
0.4
0.6
0.8
1.0
e = sin (hm p)
h
Varabola
0.0 0.2 0.4 0.6 0.8 1.00.0
0.2
0.4
0.6
0.8
1.0
e = h m
h
5 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
“TrigonoSoar” Math-modeled 3D Surface
Chord, thickness, twist, etc. parametric along the spar from centerline to winglet tip
x
z
y
6 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
Math-modeled Aircraft
AlgebratrossWandering Albatross
RegenoSoarRegenerative-soarer
7 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
“RenderRaptor” ~ Wireframe & Flat-Shade
8 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
z
x
yB
A
g
C
c
ik
j
Unit vectorsa A / |A|b B / |B|c C / |C|
cos g = a bsin g = |axb|
Vectors ~ Origin and Key Operations
J. Willard Gibbs Oliver Heaviside
9 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
zx
y
B
A
C=AxB
ik
j
Vector Cross Product ~ Elegant Visual Derivation
Add cross products, each axisImportant ~ Retain order A:B
Cx = Ay Bz - Az By
Cy = Az Bx - Ax Bz
Cz = Homework !
z, k x,i
y, j
Ax
Bx
ByAy
Az
Bz
AyBxAzBy
To obtain the cross product AxB above, simply add the orthogonal
cross product components as shown at upper right
10 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
Fast World-to-screen Transform & Screen-cone Criterion
f
y
y
y-ye
z
z-ze
1. cosc = (ze-zf) / Ref ; sin y = (xf -xe) / (Ref cosc) 2. Rotate (y) about y-ye axis through point (e)3. Rotate (c) about x-xe axis through point (e)4. Optionally rotate (z) for “cockpit-roll” effect5. Project to screen (perspective transformation)
v
fw
e
xs, zs
xp
yp
c
c
x-xe
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).First test new "Screen-cone" criterion. Skip projection for any quadragon with all vertices (v) which after transform would remain outside the screen cone defined by the corner angle (s). Implement exclusion via the dot product of the
eye-to-vertex vector (ev) and focus vector (ef),
testing all four vertices of each quadragon:
ev ef / { | ev || ef | } < cos s
vw
Screencone
s FocuspointEye
point
vertex
Ref
After transform,model-to-world
Projected toscreen plane
modelaxes
After world
rotations
vm
11 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
Screen Plane
Polygon Pipeline Optimization (incl. inner surfaces when applicable)
Z-buffer (E. Catmull / W. Straber, 1974) Optimized Implementation by P. Barnes, 2011Sort 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 boxGet 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
boundingbox
Ray-casting (Arthur Appel, 1968) Projection-Ray / Z-buffer Hybrid, P. Barnes, 2011Sort 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 projectionOK, interpolate (zp) on QiP ; Test: zp > zref OK, hit_index = QiP_index ; zref = zp
At hit, interp. normals ; shade pixel if it is visible
pixel box
pixel (p)
x
y
Polygon Pipeline Filter P. Barnes, 2011
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 colorsModel-World (M-W) x'form q'gon vertex coords. onlyTest: Will any of 4 vertices project in the screen cone?OK, World-rotate & screen-project q'gon vertex coords. Test: q'gon at least partially overlaps the screen ; OK, M-W transform & World-rotate q'gon vertex normalsGet 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)
Raybox
Screen Cone
Screen
quadragon
z
12 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
x
y
2
3
1
P
PE1P1
E2
E3
Define:Ei Edge vector, vertex(i)-to-next(i+1)Pi Point vector, vertex(i)-to-point (P)z Unit 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
Vector determination of "point-in-polygon"
Computer graphics classic problem 3:Given 2D coordinates of vertices and point (P), determine if (P) resides inside
13 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
Inter-vertex Interpolation ~ Vector Solution
Computer graphics classic problem 4:Given coords. & properties at vertices 1-2-3, interpolate the properties at point (p)
x
y
p
o
2
3
1
4
Ro4 = Ro1 + R14 = Ro1 + a R1p = Ro2 + R24 = Ro2 + b R23
Finally, interpolate at (p):
zp = z1 + [z2 + b (z3-z2) -z1] / a
Equate Ro4 (Dx) & (Dy) to get a,
b
Apply vector tip-to-tail addition & scalingSolve for & store two “position parameters”
/xxyyyyxx
/xxyyyyxx
xxyyyyxx
pp
pp
121121
32123212
321321
Classic method: “scan line” (comp. intensive)Contemporary method: Barycentric Coords.Complementary Alternative : Vectors
14 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
Accurate Tesselation of 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• 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]
Computer graphics classic problem 5:Accurate tesselation of curved polygon Cartesian coordinates
a
b
e
cf
ga
be
m
q
r
Tesselateabc to efg Side view of trigon
edge ab, midpoint (m),true surface point (e),
& unit normals
15 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
“Pyranometer Model” of Ambient Lighting
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)
Computer graphics classic problem 6:Model ambient light before illumination
pyranometer disk seesonly the sky "dome"
Sun shade
Define:pyranometer tilt angle (t)Ground albedo (a)
Ambient Reflectance r = 1 - /t p + /a t p
16 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
TrigonoSoar ~ All Methods Herein Applied
Uniform Ambient
“pyranometer”Ambient Model
GroundAlbedo = 0.5
GroundAlbedo = 0.0
17 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
"Render Raptor" ~ Math-modeled Aircraft
18 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
Summary ~ Trigons, Normals, and Quadragons
New Solutions: computer graphics classic problems
• Complementary, faster, or better, with added insight
• World-to-screen transformation ~ just two rotations
• "Screen-cone" world-to-screen exclusion criterion
• Point-in-polygon ~ vector-based alternative
• Interpolation at point (p) ~ vector-based alternative
• “Pyranometer” ambient-lighting model foundation
19 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
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.
About the Author
20 Pelican Aero Group
Trigons, Normals, and Quadragons J. Philip Barnes 27 May 2012 www.HowFliesTheAlbatross.com
Vector-based World-to-screen Transformation
f
y-ye
z
z-ze
v
E xp
yp
x-xe
FocuspointEye
point
After transform,model-to-worldmodel
axes
After world
rotations
e
Optional "cockpit-roll"
Ev
Ef
e
G
Screen vector:|G| = (ze-zs) tan exp=G ● i ; yp=G ● j
Where, for unitvectors, e≡E/|E|:cos e = ev
● ef
sin e = | ev x ef |
s
vertex