0% found this document useful (0 votes)
26 views37 pages

3.3 Texture Mapping

Uploaded by

jeevith.k2053
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views37 pages

3.3 Texture Mapping

Uploaded by

jeevith.k2053
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 37

GAME PROGRAMMING

A. Avinash, Ph.D.,
Assistant Professor
School of Computer Science and Engineering(SCOPE)
Vellore Institute of Technology (VIT), Chennai
TEXTURE MAPPING
Texture mapping allows you to take a simple polygon
and give it the appearance of something much more
complex.
NON-PARAMETRIC TEXTURE MAPPING

With “non-parametric texture


mapping” : Texture size and orientation
are fixed They are unrelated to size and
orientation of polygon Gives cookie-
cutter effect
PARAMETRIC TEXTURE MAPPING

• With “parametric texture mapping,” texture size


and orientation are tied to the polygon.
• Idea:
1. Separate “texture space” and “screen space”
2. Texture the polygon as before, but in texture
space
3. Deform (render) the textured polygon into
screen space.
• A texture can modulate just about any
parameter – diffuse color, specular color,
IMPLEMENTING TEXTURE MAPPING
 A texture lives in it own abstract image
coordinates parameterized by (u,v) in the range
([0..1], [0..1]):

 It can be wrapped around many different


surfaces:

• Computing (u,v) texture coordinates in a ray tracer is fairly straightforward.


Note: if the surface moves/deforms, the texture goes with it.
MAPPING TO TEXTURE IMAGE
COORDS
 The texture is usually stored as an image.
Thus, we need to convert from abstract
texture coordinate: (u,v) in the range ([0..1],
[0..1]) to texture image coordinates:
(utex,vtex) in the range ([0.. wtex], [0.. htex])
TRANSFORMED TEXTURE
COORDINATES
 Interpolated over rasterized primitives
TEXTURE RESAMPLING
 We need to resample the texture:

 A common choice is bilinear interpolation:


SOURCE OF TEXTURE COORDINATES?

 Assigned ad-hoc by artist - Tedious!


 Computed based on XYZ position –

 Texture coordinate generation (“texgen”)

 Hard to map to “surface space”

 Function maps (x,y,z) to (s,t,r,q)

 From bi-variate parameterization of geometry

 Good when geometry is generated from


patches. So (u,v) of patch maps to (x,y,z) and
(s,t)
TEXTURE ARRAYS
Multiple skins packed in texture array
Motivation: binding to one multi-skin texture

array avoids texture bind per object


TEXTURED POLYGON MODELS
MULTIPLE TEXTURES
CAN DEFINE MATERIAL BY SCRIPT?
 A ‘surface shader’ computes the color of
each ray that hits the surface.
 Example: Checkerboard
surface checker(float Kd=.5, Ka=.1) {
float smod = mod(10*s, 1);
float tmod = mod(10*t, 1);
if (smod < 0.5) {
if (tmod < 0.5) Ci=Cs; else Ci=color(0,0,0);
} else {
if (tmod < 0.5) Ci=color(0,0,0); else Ci=Cs;
}
Oi = Os;
Ci = Oi*Ci*(
Ka*ambient() +
Kd*diffuse(faceforward(normalize(N),I)));
}
SPECIAL EFFECTS
 Blurring
 Particle Systems

 Weapon Effects
BLUR SPECIAL EFFECT
 The blur special effects change the pixels of an image to soften
them, smooth their edges, blend them, or create motion effects.
Types –
 Tune blur (Corel PHOTO-PAINT)
 Directional smooth
 Gaussian Blur
 Jaggy despeckle
 Low pass
 Motion blur
 Radial blur
 Bokeh blur (Corel PHOTO-PAINT)
 Smooth
 Soften
 Zoom
 Smart Blur (Corel PHOTO-PAINT)
TUNE BLUR
The Tune blur effect lets you apply any of four blurring
effects,
which are represented by thumbnails, to an image. You
can adjust the blur effect and preview the image with
softer or sharper focus while you are editing it. The Tune
blur filter lets you improve image quality or create
exciting visual effects.
DIRECTIONAL SMOOTH
The Directional smooth effect smooths the regions of gradual
chang
e in an image while preserving edge detail and texture.
You can use this filter to subtly blur the edges and surfaces of
images without distorting the focus.
GAUSSIAN BLUR
The Gaussian blur effect produces a hazy effect, blurring the focus of
an image according to Gaussian distribution, which spreads the pixel
information outward using bell-shaped curves. The effect can improve
the quality of bitmaps with sharp edges. Move the Radius slider to
adjust the intensity of the effect. The Gaussian Blur effect supports all
color modes except Paletted and Black-and-White.
JAGGY DESPECKLE
The Jaggy despeckle effect scatters colors in an image,
creating a soft, blurred effect with minimal distortion. It is most
effective for removing the jagged edges that can appear in line
art or high-contrast images. The Jaggy despeckle effect is also
a preset lens type.
LOW PASS

The Low pass effect removes sharp edges and detail from an image,
leaving smooth gradients and low-frequency areas.
The higher the settings you specify, the more image detail is erased.
MOTION BLUR
The Motion blur effect (Bitmaps Blur Motion blur) creates the illusion of
movement in an image. You can specify the direction of movement.
RADIAL BLUR

The Radial blur effect creates a blurring effect in an image that


spins around or radiates outward from a center point that you
specify.
BOKEH BLUR
The Bokeh blur effect lets you control the amount of blur applied to the
outside of an editable area and adjust the transition between the area in
focus and the blurred area.
SMOOTH
The Smooth effect mutes the differences between adjacent pixels to smooth
an image without losing detail. It is especially useful for removing
the dithering that is created when you convert an image from
the paletted mode to the RGB mode. The Smooth effect produces a more
pronounced effect than the Soften effect. The Smooth effect is also a preset
lens type.
SOFTEN
The Soften effect smooths and tones down the harsh edges in an image without losing
important image detail. The difference between the Smooth and Soften effects is
subtle but is often apparent when images are viewed at high resolution.
The Soften effect is also a preset lens type.
ZOOM
The Zoom effect blurs image pixels outward from a center
point. The pixels closest to the center point are the least
blurry.
SMART BLUR
The Smart blur effect blurs an image but retains the edge detail. This effect is
useful if you want to retain the sharp lines and edges, such as the ones that
form the letters in text, when you export an image to a file format that would
normally reduce the amount of detail. This effect is ideal for removing noise and
artifacts from JPEG images.
PARTICLE SYSTEM
 The term particle system is loosely defined in
computer graphics.
 It has been used to describe modeling

techniques, rendering techniques, and even


types of animation.
 In fact, the definition of a particle system

seems to depend on the application that it is


being used for.
 The criteria that hold true for all particle

systems are the following:


 Collection of particles

 Stochastically defined attributes


PARTICLE SYSTEM (CONTD)
 Collection of Particles - A particle system is
composed of one or more individual particles.
Each of these particles has attributes that
directly or indirectly effect the behavior of
the particle or ultimately how and where the
particle is rendered. Often, particles are
graphical primitives such as points or lines,
but they are not limited to this. Particle
systems have also been used to represent
complex group dynamics such as flocking
birds.
PARTICLE SYSTEM (CONTD)
 Stochastically defined attributes - The
other common characteristic of all particle
systems is the introduction of some type of
random element. This random element can
be used to control the particle attributes such
as position, velocity and color. Usually the
random element is controlled by some type
of predefined stochastic limits, such as
bounds, variance, or type of distribution.
USING PARTICLE SYSTEMS TO MODEL
FIRE AND EXPLOSIONS (USING A
CASE STUDY)
 Reeves initially used the term "particle system" to
describe a method he used to create a sequence of
images for the move Star Trek II: The Wrath of Khan.
 The effect he was trying to create was that of a bomb

exploding on the surface of a planet and fire spreading


out from the point of impact to eventually engulf the
planet.
 Each particle in this system was a single point in space.

The fire was represented by thousands of these


individual points.
 Typical polygonal rendering methods create objects with

straight edges, but representing the fire by thousands of


points gives the fire a "fuzzy" shape. Reeves calls an
object made up of particles a fuzzy object.
PARTICLE DETAILS
Each object in Reeves particle system had the
following attributes:
Position

Velocity (speed and direction)

Color

Lifetime

Age

Shape

Size

Transparency
PARTICLE LIFE CYCLE
 Each particle goes through three distinct phases in the particle
system: generation, dynamics, and death.
 Generation - Particles in the system are generated randomly
within a predetermined location of the fuzzy object.
 Particle Dynamics - The attributes of each of the particles may
vary over time. For example, the color of a particle in an explosion
may get darker as it gets further from the center of the explosion,
indicating that it is cooling off.
 Extinction - Each particle has two attributes dealing with length
of existence: age and lifetime. Age is the time that the particle has
been alive (measured in frames), this value is always initialized to
0 when the particle is created. Lifetime is the maximum amount of
time that the particle can live (measured in frames). When the
particle age matches it's lifetime it is destroyed. In addition there
may be other criteria for terminating a particle prematurely:
 Running out of bounds
 Hitting the ground
 Some attribute reaches a threshold - For example, if the particle color is
so close to black
EXAMPLES - PARTICLES

Particles are laid out in a circular disc structure and


given an initial upwards velocity. When the particle's
lifetime is expired it is removed. If the particle
collides with the ground it remains stationary.

Similar to Example 1, but particles are initially


clustered near a single point.

Similar to Example 1, but particles are initially


laid out in a square structure.

In this example the particles are initially clustered in


a point similar to Example 2, but particles are
constantly being regenerated at the start point. The
effect looks very much like a fire or torch burning.
WEAPON EFFECTS
 Weapon effects are an important element in
any game that uses weapons. Creating these
effects has both an artistic and technical
element to them.
 To create the desired effect, technical

difficulties can hinder the artist to create to


their full potential.
TYPES OF WEAPON EFFECTS
 Muzzle Flash: When a gun is fired, a bright,
momentary flash at the barrel gives a sense
of realism and power. This can be done using
a combination of particle systems for sparks
and a light source for the flash effect.
 Bullet Trails: For projectiles like lasers or

bullets, creating trails that follow the path of


the bullet adds realism. This is often done
using line renderers or particles that
generate a streak along the bullet's
trajectory.
TYPES OF WEAPON EFFECTS
 Impact Effects: When a bullet or weapon hits a
surface, there’s typically a flash, debris, and dust.
Particle systems simulate these impacts, while
decals (textures applied to the surface) simulate
damage marks.
 Laser Beams: For futuristic or magic-based
weapons, laser beams are often used. These are
typically rendered as stretched sprites or
cylinders, with glow and lighting effects to
simulate the intensity of the beam.
 Explosion Effects: When weapons cause
explosions, a combination of particle systems
(smoke, fire, debris) and screen shake effects are
often used to simulate the power of the blast.

You might also like