0% found this document useful (0 votes)
34 views13 pages

(Group 5) Scene Graph & Graphics Pipeline - 20241212 - 161749 - 0000

Uploaded by

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

(Group 5) Scene Graph & Graphics Pipeline - 20241212 - 161749 - 0000

Uploaded by

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

Scene Graph

&
Graphics Pipeline
Scene Graph
A scene-graph is a data structure commonly used by 3D
rendering applications. The scene graph is the core data
structure around which a graphics engine is built.
The scene-graph is structure that arranges the logical
and spatial representation of a graphical scene. There is
not an accepted formal definition of what exactly can
and can't be contained in a scene graph, as
implementers often adapt the basic principles of scene
graphs for a particular situation.
Scene Graph
Scene-graphs are a collection of nodes in a graph or tree structure,
normally a directed acyclic graph (DAG).
The effect of a parent is apparent to all its child nodes - An operation
applied to a group automatically propagates its effect to all of its
members.
In many programs, associating a geometrical transformation matrix at
each group level and concatenating such matrices together is an efficient
and natural way to process such operations. A common feature, for
instance, is the ability to group related shapes/objects into a compound
object which can then be moved, transformed, selected, etc. as easily as a
single object.
Example

Consider a bicycle, made up of a frame and two


wheels, this situation could be represented as
follows (We are assuming that we have some
rendering code for the frame and wheels;

This image isn't quite right. Most objects and


elements of models are drawn at the origin. In order
to move the wheels to their correct position, we
need to add transformation nodes to the scene;
Example

A scene graph can contain animation nodes,


which apply a transformation depending on the
time, these can be used to animate elements of
the scene;
The action of any node is applied to all of its
children, so, if we insert a node which implements
path following, we can cause the whole model to
move along a specified path. Like all computer
animation, this movement is an illusion, the scene
is drawn with slightly different positional
parameters each frame.
Example
Finally (for this example), a scene graph
may reuse a common component (sub
tree). In this example, we assume that
both wheels will always be rotating at
identical speeds.
Node implementation
Nodes are ideally implemented as a set of inherited classes. One function which must be
present for all the classes is Render(). This function causes the execution of the 'intent' of the
node. Render() usually works by making calls to the Graphics API (OpenGL, Direct3D, etc).
Another function normally present in all nodes, is Update(), which requests a node to
incrementally update its position or state since the previous frame, based on the game rules
The Graph is executed in a recursive depth-first fashion.

Group Nodes
Group nodes typically change the state of the rendering engine, by setting the viewing matrix or
turning on a light, or maybe changing the current colour. The effect of a group node only applies to the
children of the group node. The following pseudo code illustrates the Render() action of a group node;
Save current state -> For each child node -> child->Render() ->Restore saved
state
Types of Node
SimpleGeometry (Leaf node) AnimateKeyFrame (Group Node)
A simple leaf node represents a trivial Most models are composed of a number of key
drawing primitive, line, polygon, sphere, frames, defining intermediate poses in a set
cylinder etc. piece movement (e.g. walking) . This node will
interpolate the model between the keyframes.
ComplexGeometry(Leaf node) Switch (Group Node)
A group node, containing a number of subtrees, but only one
Represents a complex object, typically loaded
subtree is rendered. Used to represent an object with
from a file. A scene graph must implement different states, e.g. a character in a FPS game could be;
instancing, allowing a single model to be reused Waking
a number of time throughout the scene. A Crouching
Crawling
complex leaf normally encapsulates code to Jumping
load and store data from a file. Hanging
Graphics PipeLine
The computer graphics pipeline, also known as the rendering pipeline, or graphics
pipeline, is a framework within computer graphics that outlines the necessary
procedures for transforming a three-dimensional (3D) scene into a two-dimensional
(2D) representation on a screen.

The model of the graphics pipeline is usually used in real-time rendering. Often, most
of the pipeline steps are implemented in hardware, which allows for special
optimizations. The term "pipeline" is used in a similar sense for the pipeline in
processors: the individual steps of the pipeline run in parallel as long as any given step
has what it needs.
Concept Of Graphics Pipeline

The 3D pipeline usually refers to the most common form of computer 3-


Dimensional rendering called 3D polygon rendering[citation needed], distinct from
Raytracing and Raycasting. In Raycasting, a ray originates at the point where the
camera resides, and if that ray hits a surface, the color and lighting of the point on
the surface where the ray hit is calculated. In 3D polygon rendering the reverse
happens- the area that is given the camera is calculated and then rays are
created from every part of every surface given the camera and traced back to the
camera.
Structure of Graphics Pipeline
A graphics pipeline can be divided into three main parts: Application, Geometry, and Rasterization.

Application
The application step is executed by the
software on the main processor (CPU).
During the application step, changes are
made to the scene as required, for
Application Geometry Rasterization Screen
example, by user interaction using input
devicesor during an animation. The new
scene with all its primitives, usually
triangles, lines, and points, is then passed
on to the next step in the pipeline.
Geometry
Window-
Model & Camera Projection Clipping
Lighting Viewport
transformation
transformation

Object coordinates Camera coordinates Clipping coordinates Device coordinates

The geometry step (with Geometry pipeline), which is


responsible for the majority of the operations with polygons
and their vertices (with Vertex pipeline), can be divided into
the following five tasks. It depends on the particular
implementation of how these tasks are organized as actual
parallel pipeline steps.
Rasterization
The rasterization step is the final step before the fragment
shader pipeline that all primitives are rasterized with. In the
rasterization step, discrete fragments are created from
continuous primitives.
In this stage of the graphics pipeline, the grid points are also
called fragments, for the sake of greater distinctiveness. Each
fragment corresponds to one pixel in the frame buffer and this
corresponds to one pixel of the screen. These can be colored
(and possibly illuminated)

You might also like