Computer Graphics Imp1
Computer Graphics Imp1
Computer Graphics Imp1
Gouraud shading
Steps:
1) Determine the average unit normal vector at each polygon vertex.
2) Apply an illumination model to each vertex to calculate the vertex intensity.
3) Linearly interpolate the vertex intensities over the surface of the polygon.
Calculation:
vertex position V, we obtain the unit vertex normal with the calculation.
Advantages:
Drawback:
1) Requires considerably more calculation.
Additional geometric information stored in data table include slop for each
edge and the coordinate extent s for each polygon.
Equation of a plane surface can be expressed in form
(x,y,z) is any point on the plane and coefficient A,B,C,D are constants
describing the spatial properties of the plane.
(A/D)xk+(B/D)yk+(C/D)zk=-1,k=1,2,3
Solution for this set of equation can be obtained using Cramers Rule.
Plane equation are used to identify the position of spatial points relative to
the plane surface of an object for any points(x,y,z) not on a plane with
parameters A,B,C,D we have
Polygon Meshes:
One type of polygon mesh is the triangle strip. This function produces
n- 2 connected triangles, .as shown in Figure given the coordinates
for nvertices.
Another similar function is the quadrilaferalmesh,which
generates a mesh of (n- I) by (m - 1) quadrilaterals, given the
coordinates for an nby m array of vertices. 20 vertices forming a
mesh of 12 quadrilaterals.
1. Sorting
Facilitate depth comparisons
Ordering the surfaces according to their distance from the view
plane
2. Coherence
Take advantage of regularity in a scene.
Back-Face Detection
Fast and simple object space method
Identifies back faces of polyhedron by
A point (x, y, z) is inside a surface with plane parameters A, B, C, and
D if
Ax By Cz D 0
When inside point is along the line of sight ,then polygon must be back
surface
V N 0
vector N
In right handed system viewing system along the negative
position axis, then the polygon is back face if c<=0
Algorithm
1. Initialize the depth buffer and refresh buffer
depth(x, y) = 0,
refresh(x, y) = Ibackgnd
Depth values for a surface position (x, y) are calculated from the plane
equation for each surface:
z=-Ax-By-D/C
Depth of next position(x+1,y)
z=-A(x+1)-By-D/C
z=z-(A/C) , (A/C):constant for each surface
Requires no sorting.
Drawbacks: can only find 1 visible surface at each pixel position that
is ,it cant accumulate intensity value for more than 1 surface.
A-Buffer Method
Scan-Line Method
Edge table
Similarly, between EH and FG, only the flag for S 2 is on.no other
position along scanline1,intersect surface,so the intensity value in
other areas are set to the background intensity.
For scan line 2
Edges: AD, EH, BC, and FG
Between AD and EH, only the flag for S 1 is on
Between EH and BC, the flags for both surfaces are on
Depth calculation is needed using plane coefficient.
If depth S1 < S2 Intensities for S1 are loaded into the refresh
buffer until BC
After that S1 intensity of surface S2 is stored until FG
Take advantage of coherence
Pass from one scan line to next
Scan line 3 has the same active list as scan line 2
Unnecessary to make depth calculations between EH and BC
Fractal Dimension
The detail variation in a fractal object can be described
with a number D,
which is a measure of the roughness, or
fragmentation, of the object.
More jagged-looking objects have larger fractal
dimensions.
the fractal dimension D for self-similar objects can be obtained from
For a self-similar fractal constructed with different scaling factors for the
different parts, the fractal similarity dimension is obtained from the implicit
relationship
With s = 1 /2, the unit line segment is divided into two equal-length subparts.
Similarly, the square is divided into four equal-area subparts, and the cube is
divided into eight
Fractal Generation Procedures
For some boundary between those points that move toward infinity
and those that tend toward a finite limit is a fractal. The boundary of
the fractal object is called the julia set
we can calculate the statistical properties of the line path over any
random in the time interval t
animation frames, TV animation, Terrains, Natural phenomena.
random midpoint displacement method
Fractional Brownian-motion calculations are time-consuming, because
the elevation coordinates of the terrain above a ground plane are
calculated with Fourier series, which are sums of cosine and sine
terms.
Fast Fourier transform (FFT) methods are typically used, but it is still a
slow process to generate fractal-mountain scenes.
discr=1-4z/
Self inverse
geometric inversion transformations can be used to create
fractal shapes.
Parallel
Orthographic
Oblique
One-point
Two-point
Top
(Plan)
Cabinet
Three-point
Front
elevation
Cavalier
Side
elevation
Other
Isometric
Other
Parallel projection:
Preserves relative proportion
Used in drafting to produce scale drawing of 3 D object
Produces accurate views of the various sides of an object
Does not give a realistic representation of the appearance of a to the
view plane, we have an 3D object
Specified with a projection vector that defines the direction for the
projection lines.
When the projection is perpendicular to the view plane ,we have an
orthographic parallel projection .otherwise, oblique parallel projection.
If the view plane is placed at position Zvp along the Zv axis,then any
point(x,y,z) in the viewing coordinates is transformed to projection
coordinates as:
Xp=x ,Yp=y, z coordinate value is preserved for depth information.
Isometric:
oblique projection
is obtained by projecting points along parallel lines that are not
perpendicular to the projection plane.
Cavalier: Direction of projection makes a 45 angle with the
projection plane
Cabinet: Direction of projection makes a 63.4 angle with the
projection plane
Perceptive projection
Produces realistic view.
Donot preserve relative proportions
Transform point along projection lines that meet at the projection
reference point.
One-point:
One principle axis cut by projection plane
Any set of parallel lines in the object that are not a parallel to the plane
are projected onto converging lines.
Instead of merely looking for the visible surface for each pixel ,we
continue to bounce the ray around the scene collecting intensity
contributing.
Provides simple and powerful rendering techniques
Provides for visible surface detecting, shadow effects ,transparency
and multiple light source illumination.
Highly realistic.
Requires considerable computation time.