This is a work-in-progress project exploring NPR (Non-Photorealistic Rendering) techniques in Unity. It currently consists of a renderer for Blender's Grease Pencil data and a system for real-time silhouette edge detection.
- Data Structure:
GreasePencilSOScriptableObjects are used to hold Grease Pencil data, including layers, frames, strokes, and materials.- Note: The importer script to bring data from Blender into Unity is not currently included in this repository.
- Rendering: The
GreasePencilRenderercomponent handles the rendering of the stored stroke data using procedural geometry and Compute Buffers. - Animation: Basic support for frame-by-frame animation playback.
- Edge Detection: The
SilhouetteEdgeCalculatorcomponent detects silhouette edges on 3D meshes in real-time. - Compute Shaders: Uses Compute Shaders for finding edges, calculating adjacency, and linking edges into strokes.
- Stroke Rendering: The
SilhouetteRendererrenders the detected edges as strokes, utilizing the same rendering logic as the Grease Pencil system.
- Create or obtain a
GreasePencilDataasset (requires external data). - Create a GameObject and add the
GreasePencilRenderercomponent. - Assign the
GreasePencilDataasset to the renderer. - Configure material settings.
- Create a GameObject with a MeshFilter and MeshRenderer.
- Add the
SilhouetteEdgeCalculatorcomponent. - Add the
SilhouetteRenderercomponent. - Assign a material.