Role: Main Gameplay Programmer (Prototype to Finished Product)
Overview:
Color-a-Cube is a VR painting experience that allows players to paint 3D models interactively. I was the main gameplay programmer, contributing to the project from its inception as a prototype to its final release. The game’s development presented numerous challenges, especially in optimizing performance for VR hardware like the Meta Quest 2.
Gameplay:
Core Painting Mechanic:
Implemented a painting system that uses raycasting from the VR controller to determine intersections with the model.
Initial implementation was computationally expensive, particularly for detailed models. To address this, I leveraged compute shaders for optimization.
Further optimization was required for larger models. Transitioned to a Bounding Volume Hierarchy (BVH) structure, reducing painting computations to 0.2ms per frame.
Voxel Model Transition:
The game originally utilized traditional polygonal models for painting. However, corporate direction necessitated a shift to voxel-based models.
Designed a system to map triangles to their corresponding voxels. Initially used compute shaders to check if triangles near the selected one were inside a voxel.
The computational demands of the Quest 2’s GPU led to integrating the BVH structure for this process, significantly enhancing performance.
Texture Masking:
Integrated command buffers to generate a "mask texture" for each model. This texture is used by the shader to apply colors to painted areas, leaving non-painted sections rendered in a default color.
Tools:
Voxel Counter:
Developed a tool to calculate the size of voxel-based models by counting only surface voxels (excluding internal ones) from MagicaVoxel’s .point file.
This provided artists with accurate size metrics for their models before export.
Custom Assigner Tool:
Developed a system allowing artists to assign colors to models exported as FBX files efficiently.
Features included the ability to color specific triangles, quads, voxels, and UV islands.
Artists could also select a texture to sample and use it to assign colors directly or paint a custom texture using the tool.
Integrated undo/redo functionality using the Memento design pattern, ensuring flexibility and efficiency for artists. Created an advanced tool to streamline the process of assigning colors to models exported as FBX files.
Features included the ability to color specific triangles, quads, voxels, and UV islands.
Integrated undo/redo functionality using the Memento design pattern, ensuring flexibility and efficiency for artists.
Graphics:
Outline Shader:
Designed and implemented a custom outline shader using Unity’s Scriptable Render Pipeline (SRP).
The shader creates outlines by blurring culled silhouettes of the selected voxel and blending them into the final image. this only takes 3 passes.
Configurable by designers to adjust colors and blending, allowing for creative control over the visual style.
Technologies Used:
Compute Shaders: Optimized computationally heavy tasks like raycasting and voxelization.
Bounding Volume Hierarchy (BVH): Enhanced performance for complex models and voxel-based systems.
Command Buffers: Enabled efficient texture manipulation for the painting mechanic.
Memento Design Pattern: Provided robust undo/redo functionality for artist tools.
Scriptable Render Pipeline (SRP): Implemented custom graphics features like the outline shader.
Outcome:
The final product delivered a seamless and immersive painting experience in VR. By addressing both technical and artistic challenges, the project achieved high performance, adaptability for voxel models, and a visually striking presentation.