Skip to content

Rendering components and systems ​

Optical components are rendered by drawing their shape. Example renderings of the individual components can be found in the Mirrors, Lenses, Beamsplitters and Polarizers sections.

Components ​

The generic method below covers every BeamletOptics.AbstractObject, including groups of components such as an ObjectGroup, whose members are rendered one after another.

BeamletOptics.render! Method
julia
render!(ax, object; material = nothing, edges = nothing, kwargs...)

Renders the object into the specified axis. Additional kwargs can be piped through to the backend.

Look

Each object is rendered with the material preset of its component class, e.g. clear glass for lenses and prisms or silver for mirrors. The parts of composite objects (e.g. the prisms and the coating of a CubeBeamsplitter) are rendered with the class of each part. Explicit kwargs like color, alpha or transparency override the preset, for all parts of the object.

  • material = nothing: one of :refractive, :reflective, :coating, :polarizer, :detector, :mechanics and :interface, overrides the component class

  • edges = nothing: draws the feature edges of the object, i.e. the sharp edges and the boundary of open surfaces, as thin dark lines. By default in the :cad look for all materials except :mechanics, in the :modern look as faint silhouettes of the glass (:refractive, :coating and :interface) only, see set_render_look

The cemented interfaces of doublet and triplet lenses are rendered as thin amber surfaces. See also studio_lighting! for the lighting of the scene.

Examples

It is recommended to use the following snippet in order to generate plots:

julia
using GLMakie, BeamletOptics

fig = Figure()
ax = LScene(fig[1,1]) # or Axis3
render!(ax, my_BMO_obj; color=:white)

Additional keyword arguments can be passed. Refer to the Makie and BeamletOptics documentation for supported options for each object.

source

Materials ​

The color, opacity and shading of a component follow its material class, e.g. clear glass for lenses or metallic silver for mirrors, in the active look (:modern or :cad). The materials, feature edges and lighting are described on the Look page. Each default can be overridden with the corresponding keyword argument, e.g. render!(ax, lens; color=:orange), render!(ax, mirror; transparency=true) or render!(ax, mount; material=:mechanics).

Polarizing filters ​

BeamletOptics.render! Method
julia
render!(ax, pf::PolarizationFilter; kwargs...)

Renders the PolarizationFilter pf into the specified ax, optionally with its transmission axis.

Keyword args

  • show_transmission_axis = true: draws the transmission_axis as a line on the filter

  • axis_color = :black: color of the transmission axis line

  • axis_linewidth = 2: line width of the transmission axis line

Remaining kwargs are passed on to the Makie mesh plot.

source
BeamletOptics.render! Method
julia
render!(ax, lipo::LinearPolarizer; kwargs...)

Renders the LinearPolarizer lipo into the specified ax, optionally with its transmission axis. The two substrate halves render like refractive optics, the filter film with the polarizer material of the render look; explicit kwargs (e.g. material, edges) apply to all parts.

Keyword args

  • show_transmission_axis = true: draws the transmission_axis as a line on the filter

  • axis_color = :black: color of the transmission axis line

  • axis_linewidth = 2: line width of the transmission axis line

Remaining kwargs are passed on to the Makie mesh plots of the substrate halves.

source

Systems ​

BeamletOptics.render! Method
julia
render!(ax::_RenderEnv, sys::AbstractSystem)

Render all objects contained in the system.

source

Shapes (advanced) ​

The following methods render the shapes that components are built from. They are mainly of interest when writing custom components, see the Signed Distance Functions (SDFs) and Meshes pages of the API documentation. A BeamletOptics.UnionSDF or BeamletOptics.DifferenceSDF is rendered as one mesh, which is merged from the analytical meshes of its SDFs if all of them have one, and otherwise sampled via marching cubes. The spherical, aspherical and acylindrical lens surfaces have dedicated analytical renderers that are used automatically when a lens is rendered.

BeamletOptics.render! Method
julia
render!(ax, sdf; kwargs...)

Render the surface of the sdf into the specified axis. Shapes with an analytic tessellation (see _tessellate) are rendered as a single mesh. Other shapes are rendered based on the marching cubes algorithm, with a resolution of x_resolution, y_resolution and z_resolution samples per axis (defaults: a voxel size of 1/100 of the largest bounding box width, at most 150 samples per axis).

Additional kwargs can be passed into the mesh plot.

source
BeamletOptics.render! Method
julia
render!(ax, s::ConicSDF; color=:silver, kwargs...)

Analytical mesh renderer for a BeamletOptics.ConicSDF. Renders the concave/convex conic front reflective face in color, the cylindrical substrate side wall and the flat rear substrate base in grey into ax.

source
BeamletOptics.render! Method
julia
render!(ax, d::DifferenceSDF{T, <:ConicSDF}; color=:silver, kwargs...)

Analytical mesh renderer for a BeamletOptics.ConicSDF with an axial cylindrical bore (e.g. Cassegrain, Ritchey-Chrétien, or OAP with :collimated through-hole). Other tools are cut from the mesh of the BeamletOptics.ConicSDF, see _difference.

source
BeamletOptics.render! Method
julia
render!(axis, mesh; kwargs...)

Renders the mesh into the specified axis.

Keyword args

  • show_normals = false: shows a small line

  • show_normals_length = 0.01:

Makie kwargs

source