CG Unit 6 Notes
CG Unit 6 Notes
Unit – VI
Introduction to Animation and Gaming
1. Segment
1.1 Introduction
In computer graphics, segments help organize complex images by dividing them into
manageable parts, allowing for independent manipulation and display.
1. Composition of Display:
o Each item can be treated as a separate segment, making it easier to handle and
display each part individually.
o Each segment has specific attributes (size, color, position) and can be
transformed individually with scaling, rotation, or shearing.
3. Flexible Viewing:
2|Page © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
o The display file stores segment data and their transformation details, enhancing
organized access and control for viewing or modifying each component.
5. Benefits:
A segment table is a data structure used to manage and organize information about individual
segments within an image. Each segment has a unique entry in the table, allowing easy access,
visibility control, and manipulation of its properties.
1. Unique Identification:
o Each segment is assigned a unique name or ID, which allows the system to
identify and access specific segments independently.
2. Organized Information:
3|Page © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
o The segment table holds essential details for each segment, including:
Display file position: Where the segment’s data begins in the display file.
3. Visibility Control:
o The table includes a visibility setting for each segment. To make a segment
visible (e.g., segment 4), the corresponding entry in the table is set to “ON.”
o This visibility attribute allows the system to selectively display segments, which
is useful for showing only specific parts of a complex image.
o The display file interpreter uses the segment table to determine which
segments to render. It checks the starting position, size, and visibility attributes
and processes only those segments marked as visible.
Segment creation involves defining a new segment by allocating space for its graphical data
and specifying its attributes. It allows for modular organization of an image, where each
segment can be independently manipulated.
1. Check Uniqueness: Ensure the segment name is unique within the segment table.
2. Assign ID and Attributes: Define the segment’s name, size, position, and
transformation attributes (scaling, rotation, etc.).
3. Allocate Space: Reserve memory in the display file for the segment's graphical data.
4. Update Segment Table: Add an entry for the segment in the segment table, including
its name, size, position, and other attributes.
5. Store Graphical Data: Place the graphical content (shapes, text, etc.) of the segment
in the allocated space.
4|Page © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Step 1: Start.
Step 2.1: If it exists, display an error “Segment already exists.” and exit.
Step 4: Define the size, position (x, y), scaling, rotation, and visibility status for the segment.
Step 5: Allocate space in the display file for the segment’s data.
Step 6: Update Segment Table by adding an entry for the segment in the segment table with its
name, starting location, size, and attributes.
Step 7: Save the segment’s graphical data (e.g., shapes or lines) at the reserved location in the
display file.
Step 8: Stop.
Segment Closing in computer graphics refers to finalizing a segment after completing its
modifications and making it unavailable for further changes. When a segment is closed, it is
renamed to an unnamed segment (e.g., 0), and if any other unnamed segments exist, one is
deleted to avoid conflicts. The segment is then prepared for storage, and the next free area in
the display file is marked for the unnamed segment.
1. Check if Any Segment is Open: Ensure there is a segment currently open for closing.
2. Rename the Open Segment: Change the name of the currently open segment to an
unnamed segment (e.g., 0).
3. Handle Unnamed Segments: If another unnamed segment exists, delete it, and reset it
to initialize for future use.
4. Free Storage for Unnamed Segment: Mark the next free storage area in the display
file for the unnamed segment.
5|Page © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
5. Reset Segment Size: Set the size of the unnamed segment to 0, indicating it's ready for
future instructions.
Step 1: Start.
Step 2.1: If no segment is open, display the error message: "No segment is open now"
and exit.
Step 3: Rename the currently open segment to an unnamed segment (e.g., 0).
Step 4: If another unnamed segment already exists, delete it and initialize it with no
instructions.
Step 5: Allocate free storage area in the display file at the start of the unnamed segment.
Step 7: Stop.
Segment deletion refers to the process of removing a segment from both the display file and
the segment table. It ensures that any graphical data associated with the segment is freed, and
subsequent segments are properly adjusted to fill the gap.
1. Check Validity: Ensure the segment exists and is not open or in use.
2. Verify Size: If the segment size is invalid (less than 0), no action is taken.
3. Shift Following Segments: Move any segments that follow the deleted segment to fill
the freed space.
4. Recover Space: Reset the display file to mark the space of the deleted segment as
available.
5. Update Segment Table: Remove the segment entry from the table and adjust the
positions of the remaining segments.
6|Page © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Example: Suppose we have 4 segments: 1, 2, 3 and 4 where 2 is being deleted. After deleting
2, the position of 3 and 4 will be adjusted so that they fill the space left by 2. The segment table
is updated to remove 2, and the space previously occupied by 2 is reclaimed.
Step 1: Start.
Step 2.1: If the segment_name is not valid (does not exist in the segment table), display
the error message: "Segment name is not a valid name" and exit.
Step 3: If the segment is currently open (in use), display the error message:
"Can't delete an open segment" and exit.
Step 5: For each segment following the deleted segment, shift their position by the size of the
deleted segment.
Step 6: Reset the index of the next free instruction in the display file to recover the space that
was occupied by the deleted segment.
Step 7: Update the starting positions of the shifted segments by subtracting the size of the
deleted segment from their current positions.
Step 8: Stop.
Segment Renaming refers to changing the name of an existing segment in the segment table.
It involves updating the segment’s identifier while ensuring that all associated attributes,
graphical data, and references to the segment remain intact.
1. Check for Validity: Ensure that the new name is valid and does not already exist in the
segment table.
2. Update Segment Table: Modify the segment name in the segment table entry, ensuring
the new name reflects across all related structures.
3. Re-link Graphical Data: The graphical data associated with the segment remains
unchanged, but the new name must be used for future references.
4. Handle Dependencies: If other parts of the program depend on the segment's name,
those references must also be updated.
5. The idea of storing two images, one to show and other to create or alter, is called double
buffering.
o The segment retains its graphical data, size, position, and other attributes.
Step 1: Start.
Step 2.1: If both old and new segment names are invalid, display the error message:
"Segment names are not valid names" and stop.
Step 3: If either of the segments is open, display the error message: "Segments are still open"
and stop.
8|Page © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Step 4: If the new segment name already exists in the display list, display the error message:
"Segment name already exists" and stop.
Step 5: Copy the old segment's table entry (attributes, graphical data, etc.) to the new position.
Step 6: Remove the old segment from the segment table and free any allocated space.
Step 7: End
1.7 Visibility
Key Points:
Visibility control is managed through flags or attributes associated with the segment
in the segment table.
The display file interpreter checks these visibility flags before rendering the segment.
2. Animation
2.1 Introduction
Computer animation refers to the process of creating moving images using computers. It
involves generating a sequence of images or frames that simulate movement or change, which
are displayed rapidly to create the illusion of motion.
3D Animation: Uses three-dimensional models and spaces, allowing for more realistic
movements and depth.
2D Animation: Typically, hand-drawn on paper or using digital tools, with each frame
drawn separately.
Classic Films: Used in early animated films like Disney's Snow White and The Lion
King.
Storyboarding: Plan the sequence of scenes, framing, and actions. Sketch the key
scenes to outline the story visually.
Creating Key Frames: Draw the main frames that define the start and end points of
any action or movement. These key frames establish the animation's timing and overall
motion.
Inbetweens: Draw the intermediate frames between key frames to create smooth
transitions, making the movement appear fluid.
Clean-up: Refine the drawings by removing unnecessary lines and adding details to
make the animation look polished and consistent.
Coloring: Fill in the drawings with color, either by hand or digitally, ensuring
uniformity across all frames.
Backgrounds: Create or paint the backgrounds that will appear behind the characters
or objects during the animation.
Filming: Arrange the frames in sequence and photograph them frame by frame,
typically on transparent cels, to create the final animation.
Editing and Synchronizing: Edit the frames together and synchronize the animation
with audio, dialogue, and sound effects.
10 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Key Points:
3. Techniques:
Applications:
Video Games: Characters, environments, and actions are animated in real-time or pre-
rendered.
Concept and Storyboarding: Plan the animation’s storyline, scenes, and visual style
through rough sketches and frames.
Modeling (for 3D Animation): Create 3D models of characters, objects, or
environments using software like Blender or Maya.
Texturing: Apply textures and materials to the 3D models to give them realistic surface
details (colors, patterns, etc.).
Rigging (for 3D Animation): Create a digital skeleton (rig) for the models to define
how they move and deform during animation.
Animating: Define keyframes (main points of movement) and let the software
interpolate in-between frames to create fluid motion. For 3D, this also includes setting
up movements using the rig.
Lighting: Set up lighting in the scene to create realistic effects and highlight key
elements of the animation.
Rendering: Generate the final frames by processing all elements (models, animation,
lighting) into images or video.
Compositing: Combine different rendered layers, such as background, characters, and
special effects, into a cohesive scene.
Sound Design: Add audio, including voice acting, sound effects, and background
music, and sync it with the animation.
Editing and Final Output: Edit the animation, adjust timing, and output the final
version for distribution (film, video, game, etc.).
Storage and Access Physical storage required (cels, Digital files stored on computer or
films) cloud
Level of Detail & Limited by manual techniques High level of detail and realism
Realism possible with advanced tools
Reuse of Assets Limited, often redrawn Easy reuse of digital assets across
scenes and projects
Environment Difficult to simulate complex Physics engines simulate realistic
Interaction interactions interactions and dynamics
Examples Classic Disney films like Snow 3D animated films like Toy Story,
White and the Seven Dwarfs Frozen
Design of animation sequences refers to the process of planning and structuring the animation
in a way that communicates the desired motion, storytelling, or visual effect. It involves
organizing how the animation flows from one scene or action to another, considering factors
like timing, transitions, and visual continuity.
Key Elements:
1. Storyboarding: Creating rough sketches or panels to map out the sequence of events,
framing, and key actions in the animation.
2. Timing and Spacing: Deciding the timing of movements to ensure smooth, natural
motion. This includes determining the speed of actions and the number of frames
between key moments.
3. Keyframes: Defining the primary positions and poses in the animation that mark
significant changes in movement or emotion.
4. Inbetweens: Drawing intermediate frames that connect the keyframes to create smooth
transitions between movements.
5. Action and Emotion: Designing movements that convey the right emotion or purpose
of the scene (e.g., a quick, energetic movement for excitement or a slow, deliberate
action for seriousness).
13 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
6. Pacing: Ensuring that the sequence flows smoothly, with appropriate pauses or quick
transitions depending on the mood or narrative.
Each entry in the list represents a specific action or event that occurs at a particular
point in the animation, often including keyframe positions, timing, and transformations.
These are standard programming languages (e.g., C++, Java) extended with additional
commands or libraries specifically for animation.
Animators use these languages to write code that includes animation directives, such as
movement, timing, or object manipulation.
Example: Using JavaScript with HTML5's <canvas> or Python with libraries like
Pygame to create animations by embedding specific animation code within the
program's structure.
3. Graphical Languages:
These languages use a visual interface or flowchart-style blocks to design and control
animations, making it easier for non-programmers to animate.
Users manipulate graphical elements like icons, paths, and nodes to define the motion
and transformations of objects.
14 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Example: Tools like Scratch, where users drag and drop blocks to create animations
without writing code.
A keyframe is a specific frame in an animation sequence that marks the start or end of a
particular movement or transformation. Keyframes define the main points of action, and
intermediate frames (inbetweens) are automatically generated to create smooth transitions
between them.
Key Points:
Primary Poses: Keyframes capture the most important positions or poses in the
animation.
Defines Movement: They specify where and how an object should appear at certain
moments.
Use: Essential in both 2D and 3D animations for setting up actions, timing, and
character expressions.
Example:
Keyframe 1: Set at the ball's highest point at the beginning of the animation.
Keyframe 3: Set when the ball reaches its next highest point after bouncing.
The animation software fills in the frames between these keyframes, creating the appearance
of a smooth bounce. Keyframes are essential in simplifying the animation process by defining
only the critical points in motion.
2.8 Morphing
Morphing is an animation technique used to smoothly transform one image or shape into
another over time. It creates a gradual transition, blending the start and end images or shapes
15 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
seamlessly. This technique is commonly used to show changes in facial expressions, shapes, or
objects in animations, films, and visual effects.
Key Points:
Keyframes: Starting and ending images are set as keyframes, with the software
generating in-between frames to create a smooth transition.
Applications: Used in movies, animations, and special effects (e.g., a person’s face
morphing into another or an object changing shape).
Example:
As the animation plays, the cat’s face gradually transforms into the lion’s, changing shape, size,
and features in a way that looks smooth and natural.
Applications of Morphing:
o Face and Body Morphing: In visual effects, morphing allows for the seamless
transformation of faces or bodies to depict aging, de-aging, or shape-shifting
characters.
3. Video Games:
16 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
4. Medical Visualization:
Motion specification is the process of defining how objects move in an animation. It includes
methods for setting object positions, paths, timing, and even physical interactions to create
realistic or stylized motion.
To create lifelike and precise animations, several methods are used to specify and control
movement, including techniques based on geometric, kinematic, and physical information, as
well as specialized animation languages.
Physical Information: This method uses physics principles, such as mass, force, and
gravity, to create realistic motion. By applying physics-based simulations, animators
can model complex, realistic interactions like collisions, falls, and fluid dynamics.
17 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
Example: Physics-based animation can simulate cloth movement, water flow, or a car’s
suspension in motion, making scenes more natural and responsive to environmental
forces.
3. Animation Languages
Example: Maya Embedded Language (MEL) is used in Autodesk Maya for scripting
animations, while JavaScript can animate elements in web-based applications.
3. Gaming
3.1 Introduction
Gaming refers to the act of playing interactive digital games on devices like computers,
consoles, and mobile phones. Games vary widely in genre, from action and adventure to puzzle
and simulation, and typically involve players engaging with a virtual environment to achieve
objectives, solve problems, or compete with others.
Example:
In a game like Minecraft, players can explore a blocky, 3D world, gather resources, and build
structures. The game allows creativity and problem-solving, as players interact with the
environment and sometimes other players in survival or creative modes. This example
illustrates how gaming combines interactive storytelling, strategy, and user engagement in a
virtual setting.
NVIDIA is a leading company in the field of graphics processing units (GPUs) and has
established itself as a prominent player in the gaming industry. Through its powerful hardware
and advanced software technologies, NVIDIA provides the necessary tools for immersive
gaming experiences, whether on PCs, consoles, or cloud gaming platforms. Its gaming
18 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
NVIDIA’s gaming platform is driven by its GPUs (e.g., the GeForce RTX series), which are
known for delivering high-quality graphics, fast rendering, and smooth gameplay. NVIDIA
also offers software solutions like GeForce Experience and NVIDIA GameWorks, which
enhance the gaming experience with additional features such as game optimization and visual
effects.
o NVIDIA’s GeForce RTX graphics cards are designed for gamers who demand high-
quality visuals, including real-time ray tracing and AI-enhanced features.
2. Ray Tracing:
o NVIDIA’s RTX GPUs are equipped with real-time ray tracing, a rendering
technique that simulates realistic lighting, shadows, and reflections. This creates more
immersive and lifelike visuals in supported games.
4. NVIDIA Reflex:
5. NVIDIA G-SYNC:
o G-SYNC is a technology that synchronizes the refresh rate of the monitor with the
GPU’s frame output, eliminating screen tearing and stuttering for a smoother gaming
experience.
19 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
6. GeForce Experience:
o This software provides an easy way for gamers to optimize game settings, capture
gameplay, stream, and update drivers. It includes features like automatic game
optimization and ShadowPlay for recording and streaming.
7. NVIDIA GameWorks:
o NVIDIA’s GPUs are designed to support Virtual Reality (VR) gaming with high
frame rates and low latency. They also support 4K gaming, delivering high-resolution
graphics for an enhanced gaming experience.
o These are the fundamental processing units of an NVIDIA GPU. Each SM contains
multiple SIMD units (or Stream Processors, SPs), which are responsible for
executing multiple data points in parallel (SIMD/SIMT).
o SIMD is a type of parallel computing where multiple processing units perform the
same operation on multiple pieces of data simultaneously. In the case of NVIDIA
GPUs, the SIMT (Single Instruction, Multiple Threads) model is used, which is
similar to SIMD but allows more flexibility in handling threads, ensuring efficient
use of the large number of floating-point units (FP) for tasks like graphics
rendering, simulations, and computations.
o The SIMD/SIMT execution paradigm ensures that the GPU can process large
amounts of data efficiently by executing the same operation on multiple data streams
concurrently.
3. Multithreading:
o This parallelism is essential in GPU design because it helps minimize idle times due
to waiting for memory access, enabling continuous processing of tasks.
The Intel i860 (also known as the 80860) was a RISC (Reduced Instruction Set Computing)
microprocessor introduced by Intel in 1989. It was a powerful and innovative processor for its
time, particularly in high-performance computing, graphics, and scientific applications. Below
is an explanation of the architecture of the i860:
Key Components
1. Memory Block:
o It is responsible for storing and fetching instructions and data required by the processor.
2. Cache Instruction:
22 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
o Acts as an instruction cache, holding frequently used instructions for faster execution.
3. Cache Data:
o Receives instructions from the memory block and performs fast, basic operations on
integers.
o Communicates with the bus control block and interacts with the adder block and
multiplier block.
o Manages data flow between the processor and external components via the 64-bit data
bus.
7. Graphics Block:
8. Adder Block:
o Inputs can come from various blocks, such as the graphics block or the multiplier
block.
9. Multiplier Block:
o Handles multiplication operations, often for both integer and floating-point numbers.
o Represent real (kr) and imaginary (ki) components, potentially used for complex
number calculations.
o Feed into the multiplier block, enabling operations involving complex numbers.
11. T Block:
o Possibly acts as a temporary register or buffer for intermediate results before sending
them to the adder block.
1. Dual Pipelines:
o The i860 supports both integer and floating-point pipelines, allowing it to handle
operations simultaneously and improve performance.
2. Graphics Capabilities:
o Dedicated hardware for graphics makes the i860 suitable for high-performance
graphical applications like rendering or scientific simulations.
o Enables high-speed data transfers, crucial for graphics and computational workloads.
4. Parallel Processing:
o The architecture allows multiple components (like integer and floating-point units) to
operate in parallel, increasing throughput.
5. RISC Principles:
24 | P a g e © Haris Chaus | ALL RIGHTS ARE RESERVED as per copyright act.
o Ray Tracing: Real-time ray tracing has become a key feature in modern gaming,
simulating realistic lighting, shadows, and reflections for more lifelike visuals.
o VR Gaming: Virtual Reality headsets, such as Oculus Rift, HTC Vive, and
PlayStation VR, offer an immersive experience, allowing players to feel as though
they are physically inside the game world.
o AR Gaming: Augmented Reality, as seen in games like Pokémon Go, integrates real-
world environments with virtual content, offering a unique, interactive experience.
4. Cloud Gaming:
o Game Streaming: Platforms like Google Stadia, NVIDIA GeForce Now, and Xbox
Cloud Gaming allow players to stream games over the internet, eliminating the need
for high-end gaming hardware.
o 60 FPS and Beyond: Advances in GPUs and CPUs now allow for higher frame
rates, with many games targeting 60 FPS, 120 FPS, or even 240 FPS for smoother,
more responsive gameplay, especially in competitive gaming.
o Social Features: Games now integrate social features such as voice chat, live-
streaming (e.g., Twitch), and in-game social hubs for a more connected gaming
experience.
o Unreal Engine 5: Game engines like Unreal Engine 5 offer incredible graphics
rendering, including photorealistic environments, improved lighting, and faster
development workflows.
1. Rendering Graphics:
o The GPU is responsible for rendering the complex graphics seen in games, including
textures, lighting, shading, and 3D models. It performs tasks like rasterization, ray
tracing, and vertex transformations that create the visuals players see on the screen.
o Unlike the CPU, which is optimized for sequential tasks, the GPU is designed to
handle parallel processing. This makes it much more efficient at processing the
thousands of tasks involved in gaming, such as processing the effects of multiple light
sources, simulating physics, or handling AI behaviors in the game.
o Modern GPUs support ray tracing, which simulates realistic lighting, reflections,
and shadows. This enhances the visual fidelity of games, making environments look
more lifelike by accurately simulating how light interacts with objects in a 3D space.
o A powerful GPU ensures high frame rates (frames per second, or FPS), making the
gameplay smoother and more responsive. This is crucial for providing an enjoyable
experience, especially in fast-paced games.
o GPUs are also integral in supporting immersive virtual reality (VR) experiences and
4K gaming, where extremely high resolution and low latency are required for smooth
performance.
o The RTX 4090 is one of the latest high-end graphics cards from NVIDIA, offering
exceptional performance in gaming, supporting real-time ray tracing and AI-
enhanced graphics via DLSS (Deep Learning Super Sampling).
o The RTX 3080 offers excellent performance for 4K gaming, providing high frame
rates and enhanced ray tracing capabilities, ideal for gamers looking for powerful
performance at a more accessible price point.
o The GTX 1660 Ti is a more affordable GPU offering from NVIDIA, capable of
providing excellent performance in 1080p gaming with smooth frame rates for a wide
range of games.