Module 4: Modeling a Simple UI Component

Let's put your knowledge into practice! In this module, we will walk through the entire process of creating a 3D toggle switch—a common element in software interfaces.

Inspiration: Creating 3D Icons

This video demonstrates the style and process of creating beautiful 3D icons in Blender. We will use similar techniques for our toggle switch project.

Project: Modeling a 3D Toggle Switch 💡

Follow these steps to build the component from scratch.

Step 1: Create the Switch Housing

We'll start by creating the rounded base of the switch.

  1. Delete the default cube. Press Shift + A → Mesh → Cube to add a new one.
  2. Go to the Modifier Properties (blue wrench icon) and add a Bevel modifier.
  3. In the modifier settings, increase the Segments to 5 and adjust the Amount until the cube looks like a sphere. This creates a perfectly rounded shape.
  4. Press S then X to scale the object along the X-axis, creating a long, pill-like shape.
  5. Press S then Z to scale it down on the Z-axis, making it flatter. This is our housing.

Step 2: Create the Movable Switch

Now for the part that slides back and forth.

  1. Press Shift + A → Mesh → UV Sphere.
  2. Right-click on the sphere and select Shade Smooth to remove the faceted look.
  3. Press S to scale the sphere down so it fits nicely inside the housing.
  4. Use the move tool (or press G) to position the sphere on one side of the housing. You can press G then Z to move it slightly upwards so it rests on top.

Step 3: Apply Materials and Colors

Let's give our component some color to represent its "On" state.

  1. Select the housing (the pill shape). Go to the Material Properties and click + New.
  2. Set the Base Color to a medium grey and increase the Roughness to about 0.8 for a matte plastic look.
  3. Select the sphere. Create a + New material for it.
  4. Choose a vibrant Base Color like green or blue to indicate an "On" state. Set its Roughness to around 0.4 for a slightly shinier finish.

Step 4: Final Touches

Great work! You now have a complete UI component.

To present it, you can select both objects (hold Shift and click each one), then press Shift + D to duplicate them. Move the duplicate to the side. On the new one, you can move the sphere to the other side and change its material color to grey to show the "Off" state.