LightingTroubleshooting

Lighting for codes inside glass: a test plan

Choose lighting for codes inside glass with controlled tests for wavelength, reflections, camera response and image quality before decoder tuning.

LumaSpec Vision10 min read Share on LinkedIn

On this page 10 sections
  1. 011. Identify what is actually missing
  2. 022. Establish a camera and focus baseline
  3. 033. Compare geometries before changing wavelength
  4. 044. Test wavelength without assuming infrared will work
  5. 055. Check whether the camera resolves the modules
  6. 066. Separate reflection control from mark visibility
  7. 077. Measure image quality before tuning the decoder
  8. 088. Verify repeatability and know when to stop
  9. 099. Checks before choosing the test hardware
  10. 10Questions

A code embedded in glass can remain unreadable because the mark produces little contrast, surface reflections hide it, or the camera cannot detect the useful wavelengths. Changing the decoder cannot recover detail that never reaches the sensor. This troubleshooting plan helps you separate those causes with controlled lighting tests. You will establish a reference image, compare illumination geometries and wavelengths, and decide whether the remaining limitation is optical access, sampling or decoding.

1. Identify what is actually missing

Start with the marking process, not a light purchase. An embedded code might consist of scattering features, local absorption changes or another optical modification. Those mechanisms respond differently to illumination. Ask the marking provider how the mark is intended to be inspected, including any specified wavelength or viewing direction.

Record the code dimensions, smallest module, depth below the surface, glass thickness and allowable part orientation. Also establish whether the code lies on a flat plane or follows a curved surface.

Use this order to investigate the symptom:

Observation Likely cause to test first Discriminating test
No recognizable pattern in any frame Wrong focus, inadequate sampling or weak optical response Capture a reference target, then sweep focus through the mark depth
Bright patches cover part of the code Reflections from glass surfaces Move the light while keeping the camera and part fixed
Pattern appears only at certain angles Directional scattering, reflection or refraction Repeat a small angle sweep with fixed exposure
Visible lighting fails but the marking process specifies another band Illumination and camera response mismatch Test that band with a compatible camera and optics
Modules are clear but decoding fails Cropping, polarity, distortion or decoder settings Inspect the saved image independently of live acquisition

The broader illumination geometry guide explains why changing the direction of light can matter more than increasing brightness.

2. Establish a camera and focus baseline

Disable automatic exposure, automatic gain and automatic contrast adjustments during comparisons. Save unprocessed images where possible. Record exposure, gain, aperture, light setting and part position for every image.

First image a visible reference target near the intended inspection plane. This checks that the camera, lens and acquisition software can produce a sharp image. It does not prove that the embedded mark will be visible.

Next, remove the reference and sweep focus through the suspected mark depth. Looking through glass changes apparent depth, and surface scratches can look sharper than the feature you actually need. Do not assume that focusing on the front face also focuses the embedded code.

Check camera sensitivity and optical transmission before testing outside the visible range. A camera may have weak response at the selected wavelength, an infrared-blocking filter, or processing that obscures a weak signal. Lens transmission also matters.

Use the lens and lighting test plan to organize samples and acquisition settings before comparing hardware.

3. Compare geometries before changing wavelength

Keep the wavelength constant during the first geometry comparison. Begin with visible illumination unless the marking process specifies otherwise. Choose a wavelength appropriate to the camera and available sources.

  1. Test transmitted illumination if rear access exists. Place an extended source behind the glass and image from the opposite side. Absorbing features may appear dark, but scattering features can also disappear against a bright background. Compare both background uniformity and module contrast.
  2. Test coaxial illumination for a flat viewing face. It can provide an on-axis reference, but the front surface may return a strong reflection that overwhelms the embedded mark. Treat that reflection as a diagnostic observation, not proof that the source lacks intensity.
  3. Test oblique illumination. Move the source away from the viewing axis and observe whether the mark becomes brighter while the background becomes darker. Keep the source outside the direct reflection path where practical.
  4. Test illumination from several azimuths. A feature that scatters toward the camera from one direction may fade when illuminated from the opposite direction. Rotate the lighting direction before changing the camera position.

In a dark-field arrangement, direct specular return misses the camera while scattered light can enter it. Embedded features will benefit only if their scattering reaches the lens and the glass surfaces do not dominate the image.

Bright-field and dark-field lighting geometry High-angle light reflects off the flat surface straight into the lens, so the surface looks bright. Low-angle light reflects away from the lens, so the surface looks dark and only edges or scratches scatter light upward.flat part with a scratchCamerabright field(high angle)dark field (low angle)flat areas reflect away;only the scratch sends light up
Bright-field and dark-field lighting geometry. High-angle light reflects off the flat surface straight into the lens, so the surface looks bright. Low-angle light reflects away from the lens, so the surface looks dark and only edges or scratches scatter light upward.

The coaxial lights category provides candidates for the on-axis comparison. The LS-CXL-0092 is a coaxial candidate to evaluate, not a guarantee of buried-mark contrast.

Coaxial lights70 x 70 mm coaxial light (LS-CXL-0092)LS-CXL-0092
Size
50-100 mm
Voltage
24 V
$309.00View partBuild a system with it

For a surrounding illumination comparison, review ring lights. The LS-RNG-0143 is listed as a ring light with a diffuser. Confirm its illumination footprint at your intended mounting position before selecting it.

Ring lights100 mm dia. ring light with diffuser, 30° (LS-RNG-0143)LS-RNG-0143
Size
100-200 mm
Type
Diffused
Angle
30°
Voltage
24 V
$169.00View partBuild a system with it

The lesson from glass defect imaging before thresholding also applies here: improve optical separation before asking image processing to classify weak detail.

4. Test wavelength without assuming infrared will work

Near-infrared illumination is worth testing when the marking process, glass transmission or measured contrast supports it. It is not a universal way to reveal an invisible code. Both the glass and the mark must interact usefully with the chosen wavelength, and the camera must detect the returning light.

For each wavelength, capture a light-off frame and a light-on frame. Keep focus, aperture and viewing geometry fixed initially. Adjust exposure or source output enough to obtain a usable, unsaturated image, and record those changes.

Compare contrast rather than raw brightness. Equal exposure does not mean equal illumination, and equal illumination does not mean equal sensor response. If a candidate wavelength looks promising, refocus before rejecting it: focus can change between visible and infrared imaging.

The LS-CXL-0168 is listed at 940 nm. Verify camera response, optical transmission and the mark's response before treating it as a suitable test source.

Coaxial lights75 x 73 mm coaxial light (LS-CXL-0168)LS-CXL-0168
Size
50-100 mm
Voltage
24 V
Wavelength
940 nm
from $340.00View partBuild a system with it

Do not start with ultraviolet illumination merely because visible light failed. Fluorescence requires an appropriate material response and often emission filtering. Follow documented optical safety precautions for any nonvisible source, and do not judge its output by looking at it.

The wavelength sequencing guide explains how to keep successive wavelength captures comparable without confusing illumination changes with part movement.

5. Check whether the camera resolves the modules

A lighting test is inconclusive if the code is too small in the image. Estimate sampling across the smallest module, not across the entire glass part.

object sampling = field width / horizontal image pixels pixels per module = module width / object sampling horizontal pixels required = field width × target pixels per module / module width

Suppose the horizontal field covers 40 mm, the image contains 2,000 horizontal pixels, and the smallest module measures 0.10 mm:

  • Object sampling = 40 mm / 2,000 = 0.020 mm per pixel.
  • Module sampling = 0.10 mm / 0.020 mm per pixel = 5 pixels per module.
  • At an 80 mm field with the same image width, sampling falls to 2.5 pixels per module.

For an initial test, targeting approximately 4–6 pixels per smallest module gives useful inspection margin. This is a test-planning range, not a guaranteed decoding threshold. Blur, noise, distortion, code structure and the decoder can increase the requirement.

Camera resolution for the smallest feature
Units
Pixels needed
–
Sensor size
– MP
Smallest sensor that fits
–
Pixel on the part
– mm
Pixels across the feature, that sensor
–

Pixels needed = field / feature × pixels per feature on each axis (field incl. margin). The lens must resolve the pixels too: Nyquist = 1000 / (2 × pixel µm) lp/mm.

Find cameras with enough pixels Open the full calculator

The calculation assumes an approximately planar mark viewed near normal incidence. Curved glass and oblique viewing can make sampling uneven across the code. Check the least-resolved region rather than relying only on the center.

Keep the full code and its required clear border in the image. A larger image of a cropped code is not necessarily more readable than a smaller complete one.

6. Separate reflection control from mark visibility

Reflection suppression and mark enhancement are different tasks. A darker background helps only if enough useful mark signal remains.

Begin with a small angular sweep. For example, capture the same stationary part at nominal viewing alignment and at 5° and 10° offsets. Change only one axis at a time. These are exploratory settings, not recommended production angles.

Watch whether the bright patch moves independently of the code. A moving patch usually indicates a reflection path. If the code also changes shape or disappears, refraction and directional mark response may limit the useful viewing range.

Crossed polarizers can reduce some surface glare, but they also reduce available light. They may suppress useful signal or reveal stress patterns within the glass. Compare the code's contrast and consistency, not just the apparent cleanliness of the background. The cross-polarization guide explains the tradeoffs.

When several lighting directions deserve investigation, special lights offer additional geometries. The LS-SPC-0142 is listed as a multi-angle ring light. Confirm its available illumination arrangements and control requirements before planning a sequence.

Special lightsMulti-angle ring light, Ø80 mm (LS-SPC-0142)LS-SPC-0142
Size
50-100 mm
Voltage
24 V
Type
AOI
$729.00View partBuild a system with it

7. Measure image quality before tuning the decoder

Choose representative bright and dark module regions after confirming that neither is clipped. Record their mean intensities and the variation within each region.

A simple normalized contrast measure is:

contrast = (bright mean − dark mean) / (bright mean + dark mean)

For example, means of 140 and 100 give contrast = 40 / 240 = 0.17. Means of 180 and 60 give contrast = 120 / 240 = 0.50. These are illustrative image values, not acceptance limits.

Contrast alone is insufficient. A high-contrast image can still fail because of blurred module boundaries, missing corners, a damaged clear border or spatially varying distortion. Inspect the weakest region and retain the original image alongside any processed version.

Only then compare decoder settings, including supported code type, polarity and search region. Avoid aggressive sharpening that creates false edges or changes module shapes.

The QR image and search fault guide helps distinguish acquisition problems from decoder search problems. A recognizable pattern is evidence of progress, but repeatable decoding on representative parts is the relevant functional check.

8. Verify repeatability and know when to stop

A successful stationary image is the beginning of validation. Repeat the preferred setup across the expected variation in glass thickness, mark depth, surface condition, position and orientation.

As an exploratory screen, test 10 representative parts at 3 permitted orientations, producing 30 captures per candidate condition. This can expose obvious weaknesses, but it is not statistical proof of production reliability. Set the final validation size and acceptance criteria from the application's risks and requirements.

If the part moves during inspection, repeat the test at the intended exposure and motion conditions. A long stationary exposure can hide an illumination shortfall that becomes decisive on the machine.

Stop changing lights randomly when every controlled test lacks a recognizable module pattern. Recheck the marking specification, actual mark location, camera response and optical access. Depending on the evidence, the legitimate next step may be a different viewing arrangement, another marking process or specialist characterization—not a more powerful decoder.

9. Checks before choosing the test hardware

Before ordering, assemble a short requirements list:

  • Mark information: code dimensions, smallest module, depth and marking method explain what signal must be detected.
  • Optical access: front and rear clearance determine which illumination geometries are possible.
  • Camera compatibility: sensitivity and installed filters determine whether wavelength tests are meaningful.
  • Mechanical fit: light aperture, lens clearance and mounting space prevent an otherwise useful geometry from becoming impractical.
  • Electrical compatibility: verify supply, connector, controller and operating-mode requirements from the selected product documentation.
  • Evidence: retain sample images, settings and failure cases so the next hardware choice addresses an observed limitation.

Use the lighting finder to compare candidates after identifying a useful geometry. Continue with the light configurator, or send representative images and the requirements list through application support before choosing a source for an unproven embedded mark.

Questions

Will infrared lighting reveal a code that is invisible inside glass?

Not necessarily. Infrared helps only when the glass transmits the chosen band, the mark produces useful contrast there, and the imaging system detects it. Ask for the marking process's inspection specification first. Then compare controlled captures rather than assuming an invisible mark requires infrared.

Which lighting geometry should be tested first?

Use the marking mechanism and available access to choose the first comparison. Transmitted illumination is useful to investigate absorption when rear access exists. Oblique illumination can reveal scattering, while coaxial illumination provides an on-axis comparison for flat parts. None is universally suitable for embedded codes.

Why can the glass look sharp while the embedded code remains unreadable?

The camera may have focused on a glass surface rather than the embedded features. A sharp-looking pattern can also have insufficient module sampling, glare over a finder pattern, distortion or an incomplete clear border. Inspect saved images before changing decoder settings.

How many pixels per code module should the test setup provide?

Approximately four to six pixels across the smallest module is a useful starting target for controlled testing, not a decoding guarantee. Evaluate the least-resolved part of the code. Blur, noise, curvature and viewing angle can require additional sampling or a different optical arrangement.

Should polarizers always be used when imaging through glass?

Polarizers can reduce certain reflections, but they also remove light and may weaken the mark's signal. Glass stress patterns can become visible between crossed polarizers. Compare module contrast, exposure requirements and decoding consistency with and without polarization before including it in the final setup.