Scene Graph Hierarchy
<!--
Work info
-->
Topic:
3D Graphics
Year:
2025
Project Overview
This project is an interactive 3D scene editor built in Unity that demonstrates how hierarchical transforms and pivoted rotations work. The scene contains a recognizable multi-part figure built as a scene graph, where each node holds a transform and a set of primitives, and children inherit the transforms of their parents. The user can select any node from a menu, manipulate its translation, rotation, and scale, and see the entire connected structure respond. Instead of relying on Unity’s built-in shaders, every primitive is drawn with a custom shader that takes a model matrix computed explicitly in code, so the full transform pipeline is handled by hand.
Implementation Details
Scene Hierarchy
The main hierarchy is at least four generations deep, such as a torso, upper arm, arm, and hand, with sibling branches like a left and right arm. Each node contains at least two primitives, including a sphere placed at the joint, which keeps limbs visually connected when they rotate or scale. The structure is designed to look like something a person can recognize, so the effect of a transform on any node matches intuition.
Node Selection and Transform Control
A dropdown menu lets the user select any node in the hierarchy, and a transform control panel edits that node’s translation, rotation, and scale. Changes propagate down to every descendant, so moving an upper arm carries the arm and hand along with it.
Axis Frame
The selected node can display an axis frame at its pivot position, and the frame rotates along with the node to show its current orientation. Only the selected node shows its frame. Initialization order is handled carefully so the frame is switched off for every node except the one selected at startup.
Reusable Sub-Hierarchy
To show that the hierarchy definition is reusable, one sub-part (an arm with at least three generations) is duplicated and attached to the base of the main figure, with its pivot moved to a new location. The duplicate is selectable and transformable in the same way as the original.
Pivoted Primitive Rotation
Three primitives continuously rotate back and forth, each around a different kind of pivot: a sphere around an axis tangent to its surface, a cube around an axis along its surface, and a capsule around its long-side tip. They belong to nodes at different levels of the hierarchy and stay in contact with the structure throughout their motion.
Custom Shading and Reset
Every primitive uses a shader that receives its model transformation matrix directly from the scene node code. A reset button returns the whole scene to its initial pose. Because the shader moves vertices on its own, Unity’s frustum culling treats the objects as sitting at the origin, which required care in how the scene is viewed.
Features
Scene graph with at least four generations and sibling branches
Joint spheres that keep nodes visually connected under any transform
Menu-based node selection with live translation, rotation, and scale editing
Axis frame display at the selected node’s pivot, following its rotation
Duplicated sub-hierarchy attached to the main figure
Continuous pivoted rotation of a sphere, cube, and capsule at different hierarchy levels
Custom shader driven by explicitly computed model matrices
One-click scene reset
What I Learned
This project taught me how scene graphs work, including how a node’s transform composes with its parent’s to produce the final position of every primitive. I gained a practical understanding of pivoted transforms, such as building a rotation around an arbitrary point by translating to the pivot, rotating, and translating back, as well as how to compute and upload model matrices to a custom shader. It also showed me how to design reusable hierarchy definitions and how much careful initialization order matters in a system with many interdependent components.


