Home Examples Screenshots User manual Bluesky logo
OghmaNano Simulate organic/Perovskite Solar Cells, OFETs, and OLEDs DOWNLOAD

Ray-Tracing Tutorial (Part B): Editing Prisms and Lenses

In Part A you loaded the prism demo, ran the ray tracer and inspected the detector outputs. In this part you will start to manipulate the geometry: first by resizing a prism, and then by replacing the front prism with a proper lens. Along the way you will see how the Mesh editor and Object editor work together.

OghmaNano’s mesh system uses a mixture of procedural primitives (box, prism, sphere, lens, etc.) and imported CAD files. Primitive shapes are generated on-the-fly by the software and are very fast to calculate; CAD meshes are read from disk. In this tutorial we will only use primitives.

Step 1: Resize the prism using the Mesh editor

Make sure you have the prism demo scene open, as in Part A. We will first change the size of one of the prisms.

  1. Right-click the pyramid/prism object in the scene.
  2. From the context menu select Mesh editor, as shown in ??.
Optical Workbench scene with right-click context menu on the prism, highlighting Mesh editor
Right-click the prism and choose Mesh editor from the context menu to edit its mesh.
Mesh editor window showing primitive shapes such as CAD file, box, prism, sphere, tube and pyramid
The Mesh editor. Primitive shapes (box, prism, sphere, lens, etc.) are generated on the fly and render very quickly. Imported CAD shapes are loaded from files.

The Mesh editor opens with the current shape selected. In this case the Prism tab is active. We will shrink the prism in the x direction.

  1. Under xyz size, set dx from 4.0 cm to 2.0 cm, as in ??.
  2. Leave dy and dz at 4.0 cm.
  3. Ensure Peak in center is switched On.
  4. Close the Mesh editor.
Mesh editor with prism dx reduced from 4 cm to 2 cm
Reducing the prism dx from 4.0 cm to 2.0 cm. The update is applied immediately to the object in the scene.
Ray-tracing scene after resizing the prism and rerunning the simulation
After resizing the prism and rerunning the simulation, the ray bundle through the prism changes, altering the beam profile at the detector.

Now click Run simulation (or press F9) and compare the new ray paths with the original ones from Part A. You should see that the narrower prism changes the way the rays are refracted and how they fill the detector.

Step 2: Replace the prism with a lens

Next you will convert the object into a proper lens. We again start from the Mesh editor, but this time switch shape type.

  1. Right-click the same object and choose Mesh editor again.
  2. In the toolbar at the top of the Mesh editor click the Lens icon, as shown in ??.
Mesh editor Lens tab with spherical surfaces and body parameters
Switching the shape to Lens in the Mesh editor. The object now has two spherical surfaces and a cylindrical body.

Set the lens parameters as follows:

These values give a compact lens that fits easily between the source and detector. Close the Mesh editor. Back in the main window you should see that the previous prism has been replaced by a lens, but it may not yet be aligned with the optical axis.

Step 3: Rotate the lens using the Object editor

The general Object editor controls the position, rotation, colour and material of any object. We will use it to rotate the lens so that its axis lines up with the incoming rays.

  1. Right-click the lens and select Edit object, as in ??.
  2. In the Object editor set the rotation to:
    • x-axis: 90.0 degrees
    • y-axis: 90.0 degrees
    • z-axis: 0.0 degrees
  3. Close the Object editor.
Context menu showing the Edit object entry for the lens
Right-click the lens and choose Edit object to open the Object editor.
Object editor window with rotation parameters for x-axis and y-axis set to 90 degrees
The Object editor. Set the x-axis and y-axis rotation to 90.0 degrees so that the lens faces the source.

After closing the editor the lens should now sit correctly in the optical path. If its position is slightly off, you can drag it with the mouse to fine-tune its location between the source, prisms and aperture.

Run the simulation again. The scene should now look similar to ??, with the lens focusing and redistributing the coloured rays.

Ray-tracing scene with a lens inserted into the optical system and coloured rays passing through
After adding and rotating the lens, rerun the simulation to see how the beam changes. The lens focuses and bends the spectrum differently from the original prism.
Scene with the aperture moved closer to the lens
You can further tune the system by moving the aperture closer to the lens, changing which rays reach the detector.

Step 4: Move the aperture and use collision detection

Finally we will adjust the position of the aperture (the red plate with a hole). This lets you experiment with beam clipping and the β€œhole” in the detector image.

  1. In the 3D view, drag the aperture with the mouse to move it towards the lens.
  2. You will notice that as you drag it, the aperture collides with other objects and cannot pass through them – OghmaNano prevents objects from overlapping by default.
  3. To force the aperture through another object, hold Shift while dragging. This temporarily disables collision detection.
  4. Place the aperture close to the lens, as in ??.
  5. Run the simulation again and observe how the beam profile and detector outputs change.

If any object becomes stuck against another, remember you can always use Shift+drag to move it freely. This is particularly useful when you have a crowded scene with many overlapping rays and optical elements.

πŸ‘‰ Next step: Continue to Part C to analyse detector images and beam profiles in more detail, and to explore how these outputs relate to your optical design choices.