Advanced Tutorial: Use Grasshopper to Create a Light Guide Pattern

This Grasshopper definition produces a set of hemispherical extraction features across a NURBS surface. The tool is given an input surface and the input edge (along the U or V direction) can be specified. The number of extraction features are defined in the U & V directions, as are the minimum and maximum hemisphere radii. The extraction features grow in size as a function of the distance from the input edge. The growth rate is exponential, with a variable exponent. The surface thickness is also specified.

Skill Level




Light Guide in Grasshopper

1. Download and Open the Grasshopper File

Download and save the Grasshopper file listed above in the Downloads section.

Open an existing or new Rhino model.

To see an example model, open Photopia-Light-Guide-Surface-Example.3dm from the Downloads section above.

Choose Tools > Grasshopper and browse to the location where you saved the .gh file.

Open the file.

Tip : Save Location

We recommend saving all of your grasshopper files in an easy location to find later since you'll continue to add to your set of grasshopper files as you continue to use Photopia for Rhino.

It’s best to open the Grasshopper definition on a second screen if you have one. This will allow you to see it along with your Rhino CAD model. To move around the canvas showing the components in the definition, right click your mouse over the canvas area to pan. Scroll your mouse wheel to zoom in and out. The general flow of information and logic is from left to right. You can also click on the drop-down arrow of the "eye" icon (shown below) and click the options to zoom in on the input parameters or the component to “bake” (save the surface).

Zoom in Grasshopper
Revolved Reflector Grasshopper Overview

2. Associating Lightguide Surface

To get started, you can pre-select your light guide surface in Rhino and then right click on “Input Surface” and choose the option to “Set one Surface.”

This tool has been designed for surfaces bound by 4 edges, not revolved surfaces. The solid lightguide will be given a thickness offset from the base surface as part of this definition.

Rhino Light Guide Tutorial - Specify Input Surface

You will then see a preview of the extruded surface in your cad model. This red transparent surface is just a preview until you Bake it into the model in a future step.

Rhino Light Guide Tutorial - Surface Preview

3. Defining Input Parameters

Use the slider & toggle controls to define all input parameters. You can enter exact values by double clicking on the number in the slider bar. If you need to change the range of values allowed in the slider, then select the control with a single left click, then right click and choose “Edit…” from the pop-up menu.

  • Surface Offset Thickness - The base thickness of the light guide plate.
  • Input Edge - Specify if the input edge is along the U or V direction of the surface. To determine the u/v directions you can run the "dir" command on the surface.
  • Elements Along Input Edge - The number of hemispheres parallel to the input edge.
  • Elements Along Length - The number of hemispheres perpendicular to the input edge.
  • Elements Size Scale Power - The power scale to transition between the min and max sphere radius. This will control the extraction uniformity.
  • Min Sphere Radius - The starting sphere radius near the input edge.
  • Max Sphere Radius - The ending sphere radius near the far edge.
Rhino Light Guide Tutorial - Light Guide Options

4. Baking the Output Surface

To save the lightguide solid the definition has created to your Rhino CAD model, right click on the “B” output parameter of the “Join” component on the far right of the definition. You’ll have the choice of the layer on which it is created, but it will default to the current layer.

Rhino Light Guide Tutorial - Bake

You’ll have the choice of the layer on which it is created, but it will default to the current layer.

Rhino Light Guide Tutorial - Bake to Layer

The lightguide should import as a single polysurface, with the surface normals pointed outward, which is appropriate for a refractive part.

Rhino Light Guide Tutorial - Surface Orientation

You can turn off the red preview of the Grasshopper surface by clicking on the left most icon below in the upper right-hand corner of your Grasshopper screen.

Rhino Light Guide Tutorial - Preview Button

5. Design Usage Notes

This definition involves some computationally intensive geometry creation, so Grasshopper won’t immediately preview the extraction feature geometry as input parameters are changed when there are too many extraction feature elements. When you are getting started, we therefore recommend that you us a low density of features. You can further speed up the preview by disabling the “Surface Morph” component. This will limit the scope of the geometry creation to only show the extraction features across the rectangular UV grid. You can disable this component by right clicking over the “Surface Morph” label and clicking on the “Enabled” label. Re-enable this definition when you are ready to map the features onto your surface.

Rhino Light Guide Tutorial - Mesh Resolution

6. Photopia Simulation Notes

When using curved cutout features in a lightguide, be sure to set appropriate mesh resolution parameters using the “PhotopiaMeshSettings” command. For a more accurate model, you’ll need a small “Maximum angle” value to represent the cutout features as well as any curvature across the base NURBS surface. Also choose a reasonable “Minimum edge length” and preview the mesh to ensure it’s acceptable.

When raytracing this model in Rhino, you’ll need to reassign the Photopia material each time a new surface is baked from the Grasshopper definition since the Photopia materials are assigned to objects. This can quickly be done by selecting the solid and then selecting your previous material in the “Recently Used” section at the top of the Materials panel.

Rhino Light Guide Tutorial - Mesh Resolution

Back to top