Download presentation
Presentation is loading. Please wait.
Published byFrank Golden Modified over 9 years ago
1
Introduction to Computer Graphics Object representations
EEL Introduction to Computer Graphics Object representations Nagalaxmi Yenuganti
2
Polygonal Modeling In 3D computer graphics, polygonal modeling is an approach for modeling or approximating their surfaces using polygons. Polygonal modeling is well suited to scanline rendering and is therefore the method of choice for real-time computer graphics. Terminology: Polygon soup: a general set of unstructured polygons used to define a scene. Polygonal mesh: a set of connected polygons that together form a surface.
3
Polygonal Modeling Methods of creating polygonal meshes:
Build mesh by hand: Tessellate a theoretical smooth surface: Tessellation is the process of creating a polygonal approximation from a smooth surface.
4
Polygonal Modeling Extrude a 2D polygon, curve, etc. : Extrusion is the process of moving a 2D cross-section through space to create a 3D solid. Revolve/sweep a 2D polygon or curve: Revolution is the process of rotating a 2D cross-section about an axis to create a 3D solid.
5
Polygonal Modeling Polygonal mesh operations:
1. Creations - Create new geometry from some other mathematical object. 2. Binary Creations - Create a new mesh from a binary operation of two other meshes. 3. Deformations - Move only the vertices of a mesh. 4. Manipulations - Modify the geometry of the mesh, but not necessarily topology. 5. Measurements - Compute some value of the mesh.
6
Polygonal Modeling Polygon Simplification Algorithms:
The decimation algorithm, designed to reduce iso-surfaces containing millions of polygons, is quite fast. It’s also topology tolerant, accepting models with no manifold vertices but not attempting to simplify around those vertices. Problems with polygonal models: They approximate smoothly curving surfaces. Tradeoff between realism and efficiency. Lots of polygons: good approximation, slow to process vs Few polygons: fast processing, poor approximation.
7
Quadric Surfaces Surfaces represented by second- degree polynomials are quadratics. Sphere, ellipsoid, torus and cone come under general quadrics. Quadratic surfaces, particularly spheres and ellipsoids are common elements of graphic scenes. Sphere Ellipsoid Torus Cone 7
8
(𝑟−𝑠𝑞𝑟𝑡( 𝑥 2 𝑟 𝑥 2 + 𝑦 2 𝑟 𝑦 2 )) 2 + 𝑥 2 𝑟 𝑧 2 =1
Quadric Surfaces Surface Equation Parametric Form Sphere 𝑥 2 + 𝑦 𝑧 2 = 𝑟 2 𝑥=𝑟 cos ∅ cos 𝜃 𝑦=𝑟 cos ∅ sin 𝜃 𝑧=𝑟 sin ∅ Ellipsoid 𝑥 2 𝑟 𝑥 𝑦 2 𝑟 𝑦 𝑧 2 𝑟 𝑧 2 = 1 𝑥= 𝑟 𝑥 cos ∅ cos 𝜃 𝑦= 𝑟 𝑦 cos ∅ sin 𝜃 𝑧= 𝑟 𝑧 sin ∅ Torus (𝑟−𝑠𝑞𝑟𝑡( 𝑥 2 𝑟 𝑥 𝑦 2 𝑟 𝑦 2 )) 𝑥 2 𝑟 𝑧 2 =1 𝑥= 𝑟 𝑥 (r+cos ∅) cos 𝜃 𝑦= 𝑟 𝑦 (𝑟+cos ∅) sin 𝜃 There are some limitations to the general quadrics, which can be over come by “super quadrics”. 8
9
Super Quadrics (Super ellipse, Super ellipsoid)
Formed by incorporating additional parameters into the quadratic equations. Increased flexibility for adjusting object shapes. Super Ellipse Ellipse equation can represent super ellipse by allowing the exponent on the x and y terms to be variable. Super Ellipsoid Ellipsoid equation can represent super ellipsoid by incorporating two exponent parameters. Super ellipses plotted with diff values for parameters s and with radius equal on both the axes. Super ellipsoids plotted with diff values for parameters s1 and s2, radius on all the axes are equal 9
10
Blobby Objects Some objects change their surface characteristics in certain motions and do not maintain a fixed shape, and are named by blobby objects. Examples: molecular structures, water droplets and other liquid effects, melting objects, and muscle shapes in the human body. These objects change their molecular shapes very easily, so they cannot be described simply with spheres or elliptical shapes. Need to model surface shapes so that the total volume remains constant. Several models have been developed to handle these kind of objects.
11
Gaussian bumps One way to represent blobby objects is to model them as a combination of Gaussian density functions, or bumps.
12
Meta-balls Other methods for generating blobby objects use density functions that fall off to 0 in a finite interval, rather than exponentially. The ”meta-ball” model describes composite objects as combinations of quadratic density functions of the form “Soft object” model uses the function
13
Meta-balls Figure shows a user interface for a blobby object modeler using meta-balls.
14
Bezier Representations
Bezier surface patch is defined by its 4 x 4 Bezier geometry matrix GB, which specifies the control points of the surface. The corner points of GB specify actual points on the edge of the interpolated surface, while the “inner” are intermediate points which indirectly specify the tangent vectors to the surface. The x, y, and z directions of the surface are calculated independently; thus, for a 3D surface patch, there will actually be separate geometry matrices GBx, GBy, andGBz, one for each direction. The geometry matrix GBk is given by: where pi,j are coordinates in the k direction.
15
Bezier Representations
Without loss of generality, u controls the variation along from top to bottom along the patch (i.e. from P0X to P3X), and v from left to right (i.e. from PX0 to PX3) as specified above. When either u or v is 0 or 1, the point being described lies precisely on the boundary of the surface. Thus, u = v = 0 at control point P00, and u = v = 1 at control point P33.
16
B-spline Representations
B-spline curve C(u) of degree p is defined by n + 1 control points and a knot vector U = { u0, u1, ...., um } has the following properties: B-spline curve C(u) is a piecewise curve with each component a curve of degree p. This property allows us to design complex shapes with lower degree. Variation Diminishing Property : If the curve is in a plane (resp., space), this means no straight line (resp., plane) intersects a B-spline curve more times than it intersects the curve's control polyline.
17
B-spline Representations
Local Modification Scheme: changing the position of control point Pi only affects the curve C(u) on interval [ui , ui+p+1]. Bezier Curves Are Special Cases of B-spline Curves. The affine invariance property – Applying geometric or even affine transformation to a B-spline curve, then the transformation can be applied to control points. Therefore, we do not have to transform the curve.
18
B-spline Representations
NURBS (Non-Uniform Rational B-splines) is one of the important geometric entity incorporated in Computer graphics for generating and representing curves and surfaces. It is commonly used in computer-aided design (CAD), manufacturing (CAM), and engineering (CAE) and are part of numerous industry wide standards, such as IGES, STEP, ACIS, and PHIGS. Three-dimensional NURBS surfaces can have complex, organic shapes. Control points influence the directions the surface takes.
19
Constructive Solid Geometry
Constructive solid geometry (CSG) (formerly called computational binary solid geometry) is a technique used in solid modeling. CSG is a modeling technique that uses Boolean operations to combine 3D solids. The Boolean operators used by CSG are: Union, Intersection, Difference or Minus. An object is stored as a tree with operators at the internal nodes and simple primitives at the leaves. 3D solid complex object represented by Boolean operators
20
Constructive Solid Geometry
CSG Tree representing a shape as a combination of binary Boolean operators
21
Constructive Solid Geometry
APPLICATIONS OF CSG Used in game engines like Quake engine, Unreal engine, Hammer and Torque game engine. Used in almost all engineering CAD packages. Used in ray tracing and particle transport. Used for some manufacturing or engineering computation applications. Few generic modelling languages and software are also supported by CSG.
22
First three levels of a quad tree
Quadtrees Quadtrees are the data structures for storing pictures by employing Divide and Conquer mechanism. The picture area is divided into 4 sections. Those 4 sections are then further divided into 4 subsections. Continue this process, repeatedly dividing a square region by 4. Then impose a limit to the levels of division otherwise we could go on dividing the picture forever. A pixel is the smallest subsection of the quad tree. First three levels of a quad tree
23
Quadtrees Below image is stored in the form of quadtree as shown.
Recursive pictures like in the figure can easily implemented using quadtrees.
24
Octrees An octree is a tree-structured representation that can be used to describe a set of binary valued volumetric data enclosed by a bounding cube. The octree is constructed by recursively subdividing each cube into eight sub-cubes, starting at the root node (a single large cube). Each cube in an octree can be one of three colors. A black node indicates that the cube is totally occupied (all of its data = 1), and a white node indicates that it is totally empty (all of its data = 0). Both black cubes and white cubes are leaf nodes in the tree. A gray cube lies on the boundary of the object and is only partially filled. It is an interior node of the tree and has eight equally sized children of different colors.
25
A simple two-level octree and its tree representation
Octrees A simple two-level octree and its tree representation The octree branches very rapidly and it doesn’t take very many levels to generate lots of nodes. What tends to be difficult is managing the geometry needed to divide the cubes and store the details at each node. As in the case of the quadtree the octree is often built up dynamically as data become available. In this case dynamic construction often results in an unbalanced tree with areas of space being covered more finely than others.
26
Fractals Synthetic objects: regular, known dimension
Natural objects: recursive (self repeating), the higher the precision, the higher the details you get. Example: tree branches, terrains, textures. Classification: Self-similar: same scaling parameter s is used in all dimensions, scaled-down shape is similar to original Self-affine: self similar with different scaling parameters and transformations. Statistical when random parameters are involved. Fractal dimension: Amount of variation of a self similar object. Denoted as D. Fragmentation, roughness of the object. The fractal dimension of a self-similar fractal with a single scaling factor s is obtained using ideas from subdivision of a Euclidean object.
27
Fractal Dimension The relationship between the number of subparts and the scaling factor is where DE is the Euclidean dimension. We can define the fractal dimension similarly with number of subparts n and a given scaling factor s.
28
Fractals Koch curve It is a closed fractal curve of infinite length within a finite region of space, enclosing a finite area. Initiator: Generator:
29
Fractals The fractal dimension of the Koch curve
30
Fractal generation with disjoint sets
Fractals Fractal generation with disjoint sets The Fatou set S(P) of P is the set of all points z ∈ U such that the family of iterates {P n} n≥1 is normal at z. The Julia set is closed, the Fatou set is open. The Julia and Fatou sets are disjoint. The Fatou components The Fatou set S(P) of a non constant holomorphic map P : U → U is open. Connected components of this set are called the Fatou components of P. • For any Fatou component D of P, the image P(D) is also a Fatou component of P. • For any Fatou component D of a rational function P there exist integers k ≥ 0 and n ≥ 1 such that the Fatou component P k (D) is invariant under P n . • Some transcendental functions P admit a Fatou component D that is a wandering domain, i.e., D, P(D), P 2 (D), are disjoint sets.
31
Fractal generation with disjoint sets
Fractals Fractal generation with disjoint sets There are 5 types of invariant Fatou components for a holomorphic map P : U → U: Immediate basin of attraction attracting petal Siegel disc Herman ring Baker domain
32
Fern and leaf generation
Fractals Fern and leaf generation Self-similar structured leaves found in ferns and herbs are simple, single shaped leaves were subjected to different methods of calculating fractal dimension, the box-counting and the perimeter methods. Box-counting method: In order to create “square” boxes, the image was resized to a square dimension such that the length, measured in number of pixels, was of a power of 2. The image is scanned and converted to grayscale and the natural log of black points are plotted which helps in finding the fractal dimension of the leaf.
33
Fern and leaf generation
Fractals Fern and leaf generation Perimeter Method : In order to determine the perimeter of a leaf, the outline of the leaf needed to be identified. After the image was converted into a binary image, an edge detector and boundary will be used to create an image that is completely black with a pixel wide white outline of the leaf.
34
Fractal via random midpoint displacement
Fractals Fractal via random midpoint displacement The easiest way to generate fractal-like behavior is to use midpoint displacement. Midpoint displacement takes a straight line and turns it into a ragged line that can look like the outline of a mountain range. The resulting fractal has a dimension between one and two. Start with a straight line between points A and B. Create the midpoint, M, half way between A and B. Then displace the midpoint up or down by a random value. This creates two new lines joined at the midpoint. Repeat this displacement algorithm recursively for each new line segment. At each step, we also adjust the amplitude of the displacement by some method. One usually reduces it by an exponential function.
35
Fractal via random midpoint displacement
Fractals Fractal via random midpoint displacement The result of this process resembles jagged terrain. However it is fairly homogenous and isotropic. It tends to look fake to the eye. Midpoint displacement can be done in higher dimensions as well, but the process gets more and more complex. For 2D terrain, which is useful for RL terrain generation, we need to displace the midpoint of a square and partition the square into four smaller ones, which are then recursively displaced. The algorithm is know as Diamond-Square, referring to the two steps of displacement then partitioning.
36
Generating trees and other objects of nature
Fractals Generating trees and other objects of nature Hungarian botanist Aristid Lindenmayer developed a grammar-based system to model the growth patterns of plants. L systems can be used to generate all of the recursive fractal patterns, they are incredibly useful because they provide a mechanism for keeping track of fractal structures that require complex and multi-faceted production rules. An L-system involves three main components: Alphabet. An L-system’s alphabet is comprised of the valid characters that can be included. Axiom. The axiom is a sentence (made up with characters from the alphabet) that describes the initial state of the system. Rules. The rules of an L-system are applied to the axiom and then applied recursively, generating new sentences over and over again.
37
Fractals Generating trees and other objects of nature
Alphabet: A B Axiom: A Rules: (A → AB) (B → A) By performing the above steps recursively one can generate the tree shown in the below figure
38
Fractals Julia Sets Julia set fractals are normally generated by initializing a complex number z = x + yi where i2 = -1 and x and y are image pixel coordinates in the range of about -2 to 2. Then, z is repeatedly updated using: z = z2 + c where c is another complex number that gives a specific Julia set. After numerous iterations, if the magnitude of z is less than 2 we say that pixel is in the Julia set and color it accordingly. Performing this calculation for a whole grid of pixels gives a fractal image. For each transformation, the shape is duplicated into each half of the resulting shape, so it gets twice the amount of detail or number of lumps in the shape.
39
Fractals Some areas of the shape can shrink and rotate slightly to generate spirals, while other areas shift to make repeating fractal copies. For Julia sets, c is the same complex number for all pixels, and there are many different Julia sets based on different values of c. By smoothly changing c we can transform from one Julia set to another over time, creating animated fractal shapes.
40
Fractals Mandelbrot set
For the Mandelbrot set, c instead differs for each pixel and is x + yi, where x and y are the image coordinates (as was also used for the initial z value). The Mandelbrot set can be considered a map of all Julia sets because it uses a different c at each location, as if transforming from one Julia set to another across space. A specific Julia set can be defined by a point in the Mandelbrot set matching its constant c value, and the look of an entire Julia set is usually similar in style to the Mandelbrot set at that corresponding location. Points near the edges of the Mandelbrot set typically give the most interesting Julia sets.
41
Fractals Here are six Julia sets and their corresponding locations in the Mandelbrot set:
42
3-D fractals via quaternions
Fractal exists not only in complex plane but also in higher dimensional space. To realize the 3D fractal, the quaternion as the iteration variable is applied to create the 4D Julia set. Quaternion Julia fractals are created by the same principle as the more traditional Julia set except that it uses 4 dimensional complex numbers instead of 2 dimensional complex numbers. A 2D complex number is written as z = r + a i where i2 = -1. A quaternion has two more complex components and might be written as q = r + a i + b j + c k where r, a, b, and c are real numbers.
43
3-D fractals via quaternions
Dimension Reduction - Since it is rather hard to draw 4 dimensional objects one needs a way of rendering 4D quaternion fractals on a 2D screen. The approach used here is to intersect the 4D solid with a plane, in essence this makes one of the quaternion components dependent on the other three. To get a feel for the true nature of the quaternion fractal one needs create a whole series of slices along an axis perpendicular to the slice plane. The following shows 6 slices moving the cutting plane along one of the quaternion axes from the origin in steps of 0.1, c = (-0.08,0.0,-0.8,-0.03)
44
Procedural methods to generate natural and artificial shapes
Shape Grammars Procedural methods to generate natural and artificial shapes Shape grammars in computation are a specific class of production systems that generate geometric shapes. A shape grammar consists of shape rules and a generation engine that selects and processes rules. A shape grammar minimally consists of three shape rules: a start rule, at least one transformation rule, and a termination rule. The generation engine checks the existing geometry, often referred to as Current Working Shape (CWS), for conditions that match the LHS of the shape rules. In the alternative scenario, the engine first chooses one of the grammar rules and then tries to find all matches of the LHS of this rule in the CWS.
45
Procedural methods to generate natural and artificial shapes
Shape Grammars Procedural methods to generate natural and artificial shapes Shape grammars are most useful when confined to a small, well-defined generation problem such as housing layouts and structure refinement. Because shape rules typically are defined on small shapes, a shape grammar can quickly contain a lot of rules. The Palladian villas shape grammar presented by William Mitchell for example contains 69 rules, that are applied throughout eight stages. Parametric shape grammars are an extension of shape grammars. The new shape in the RHS of the shape rule is defined by parameters so that it can take into account more of the context of the already existing shapes. Despite their popularity and applicability in academic circles, shape grammars have not found widespread use in generic Computer Aided Design applications.
46
Particle Systems More flexible compared to triangle meshes when it comes to handling highly complex or dynamically changing shapes. A point-based geometry representation can be considered a sampling of a continuous surface, resulting in 3D positions pi. Instead of a completely unorganized point cloud, they use a set of depth images that are orthogonally sampled from a given input geometry. Similar to image-based approaches, this representation is also constructed from several views of an input object. Differs in that each pixel is a surface sample containing geometric position and (view independent) surface color.
47
Particle Systems Point-sampling of a circle with different quantization levels (left: 5 bit, right: 10 bit) and different sampling densities (top: 2 π/32, bottom: 2 π/1024). In the top row the approximation error between the continuous circle and the discrete point sets is dominated by the distance between samples while in the bottom row the error is dominated by the quantization. Top left and bottom right are good samples since quantization error and sampling density are of the same order thus minimizing redundancy.
48
Physically based Modeling
Modeling based on energy minimization Active contour model, also called snakes, is an energy minimizing, deformable spline influenced by image forces that pull it towards object contours and internal forces that resist deformation. Snakes may be understood as a special case of the general technique of matching a deformable model to an image by means of energy minimization. In computer vision, contour models describe the boundaries of shapes in an image. Snakes in particular are designed to solve problems where the approximate shape of the boundary is known. By being a deformable model, snakes can adapt to differences and noise in stereo matching and motion tracking. Additionally, the method can find Illusory contours in the image by ignoring missing boundary information.
49
Physically based Modeling
Modeling based on energy minimization They depend on mechanisms such as interaction with a user, interaction with some higher level image understanding process, or information from image data adjacent in time or space. Here we compute the internal and external energies to control the deformations made to the snake and fitting of the contour onto the image. Snakes active deformable models
50
References https://en.wikipedia.org/wiki/Constructive_solid_geometry
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.