Simple Polygonal Modeling Editor
<!--
Work info
-->
Topic:
3D Graphics
Year:
2025
Project Overview
This project is a simple interactive modeling editor built in Unity that lets a user sculpt polygonal objects directly in the scene. Starting from a planar mesh or a rotational-sweep “general cylinder,” the user can change the mesh resolution, grab individual vertices with a translation manipulator, and adjust how a texture is placed across the surface using translation, rotation, and scale controls. The editor is built around an MVC architecture and runs entirely on indexed triangle meshes. All texture transforms are computed on the CPU with a 3x3 matrix library rather than Unity’s built-in texture tiling and offset. The result is a small but complete modeling tool that combines mesh generation, direct manipulation, texture mapping, and camera control in one program.
Implementation Details
Mesh Rendering
The planar object is an NxN grid built from indexed triangles, with a slider that adjusts resolution from 2 to 20 and rebuilds the mesh immediately. Normal vectors are computed and drawn at each vertex so the mesh’s shading and surface orientation are always verifiable, even as the user edits it. The mesh uses a no-cull shader so both sides of the surface stay visible while modeling.
Vertex Manipulation
Pressing the left control key reveals a selectable sphere at every vertex along with its normal direction. Control plus a left click selects a vertex, which turns the sphere a unique color and spawns a three-axis translation manipulator at that position. Dragging an axis moves the vertex along it, and the axis being edited turns yellow as feedback. The manipulator works as a small MVC unit: the vertex’s local position is the model, the three colored cylinders are the view, and the individual axis cylinders act as controllers. Care is taken to convert between the mesh’s local space and world space so the manipulator lines up with the selected vertex.
Texture Placement
A GUI lets the user specify translation, rotation, and scale for the UV space, and the mesh updates live as values change. Each vertex’s UV coordinates are transformed on the CPU by composing a TRS matrix with a 3x3 matrix library. This makes rotation possible, which Unity’s default tiling and offset fields do not support.
General Cylinder
A second editing mode generates a surface by sweeping a control profile around an axis, with sliders for resolution (4 to 20) and sweep angle (10 to 360 degrees). The user can switch between the planar object and the cylinder at any time. The profile’s vertices can be selected and moved with the same manipulator workflow used on the plane, and the surface regenerates as they are edited. The cylinder is initialized up front so changing its settings never leaves the object in a broken state.
Camera Controls
The scene displays a look-at point, and the camera supports tumble, track, and dolly using Left-Alt plus the left mouse button. When Alt and Control are held together, the camera controls take priority and the vertex manipulator ignores mouse input, so the two interaction modes never conflict.
Features
Adjustable NxN planar mesh built from indexed triangles
Per-vertex normal visualization
Selectable vertex spheres with a color-coded translation manipulator
Interactive UV texture translation, rotation, and scaling computed on the CPU
Switchable general cylinder (rotational sweep) with adjustable resolution and sweep angle
Direct vertex editing on both the plane and the cylinder profile
Tumble, track, and dolly camera controls with input conflict handling
What I Learned
This project taught me how indexed triangle meshes and vertex normals work in practice, and how to structure an interactive tool with MVC so that models, views, and controllers stay cleanly separated. On the math side, I gained hands-on experience composing translation, rotation, and scale matrices, converting between local and world space, and applying 3x3 transforms to UV coordinates. It also showed me how much careful organization and frequent versioning matter once several interacting systems have to work together.


