Skip to content

isspecular parameter ignored in MMC at air-interface #114

@lvdtweel

Description

@lvdtweel

Dear @fangq and colleagues,

I have encountered discrepancies for how specular reflection at air-interface (escaping background into volume) is handled between MCX and MMC. Based on the documentation, this behavior seems to be unintentional.

The simulated volume contains a cube (label 1) with 30 mm edges sandwiched between two 3 mm thick layers of air (label 0) with properties ((0, 0, 1, 1), (1e-3, 1e-1, 0.5, 1.35)). A pencil source is placed off-center in the background with an angle of incidence 45° relative to the normal of the surface.

Expected behavior:

  • isspecular = True: specular reflection into the background and refraction at the interface, resulting in the ray propagating into the medium at an angle determined from Snell's law.
  • isspecular = False: no consideration of the refractive index mismatch at the air interface. The ray propagates at 0° relative to angle of incidence.

This behavior is observed in MCX: the ray refracts at the interface by default, and is propagating in a straight line when disabling isspecular.
Image

The behavior is not expected when using MMC, as the beam is always refracted regardless of the value of the isspecular parameter. The parameter is set correctly, as it's value is reflected by the Dgcfgisspecular build argument used to build the kernel.

Image

MCX (rev. aa62f2$v2025.10, pmcx 0.6.1) and MMC (rev. ae42a8$v2025.10, pmmc 0.3.6) were both installed from the wheels provided via pypi. The used system is based on Ubuntu 24.04 running on the Intel Cascade Lake platform with a NVIDIA L4.

The used Python environment and minimal working example in a Jupyter notebook (including outputs) can be found in this repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions