Setup Guide (Detailed)¶
Follow these detailed steps to prepare your scene for Pixit Mesh Painter.
ποΈ 1. Create MeshPainter Root GameObject¶
- Create an empty GameObject in your scene and name it MeshPainterRoot.
- Add the MeshPainter component to this GameObject.
- Also add the PaintInputHandler component to the same GameObject.
βοΈ 2. Configure MeshPainter Component¶
- Select the MeshPainterRoot GameObject.
- In the MeshPainter component, assign the following fields:
- Paint Camera: Assign the camera that will be used for painting (usually your main camera).
- Paint Layer: Set the layer that paintable objects belong to (e.g., a custom "Paintable" layer).
- Brush Blit Material: Assign the material used for brush rendering (usually provided in the package).
- Brush Settings: Assign a Brush Settings asset (see next step).
π¨ 3. Create and Assign Brush Settings Asset¶
- In the Unity Editor, go to Create β Pixit β MeshPainter β Brush Settings.
- This will create a new Brush Settings asset in your project.
- Configure brush properties such as size, hardness, and color in this asset as desired.
- Assign this Brush Settings asset to the Brush Settings field in your MeshPainter component.
ποΈ 4. Prepare Paintable Objects¶
- For each mesh object you want to paint on:
- Add the MeshPaintable component.
- Ensure the object has a Collider component (e.g., MeshCollider or BoxCollider).
- Assign a material that uses the Pixit/MeshPainter/PaintableLit_URP shader to the meshβs renderer.
πΎ 5. Optional: Add Save and Load Buttons¶
- Create UI buttons in your Canvas for saving and loading paint textures.
- For the Save button, add an OnClick event and assign the MeshPainterRoot GameObject, then select the SaveCurrentPaint() method.
- For the Load button, add an OnClick event and assign the MeshPainterRoot GameObject, then select the LoadCurrentPaint() method.
β Final Setup Checklist¶
| Component | Location/Notes |
|---|---|
| MeshPainterRoot | Empty GameObject with MeshPainter and PaintInputHandler components |
| Paint Camera | Assigned in MeshPainter component |
| Paint Layer | Custom layer assigned in MeshPainter |
| Brush Blit Material | Assigned in MeshPainter component |
| Brush Settings Asset | Created and assigned to MeshPainter |
| MeshPaintable | Added to every paintable mesh |
| Collider | Added to every paintable mesh |
| PaintableLit_URP Shader | Assigned to materials on paintable meshes |
| Save/Load Buttons | Optional UI buttons with OnClick methods linked |