  We present an image generation methodology based on ray tracing that can be
used to render realistic images of Particle Image Velocimetry (PIV) and
Background Oriented Schlieren (BOS) experiments in the presence of
density/refractive index gradients. This methodology enables the simulation of
aero-thermodynamics experiments for experiment design, error, and uncertainty
analysis. Images are generated by emanating light rays from the particles or
dot pattern, and propagating them through the density gradient field and the
optical elements, up to the camera sensor. The rendered images are realistic,
and can replicate the features of a given experimental setup, like optical
aberrations and perspective effects, which can be deliberately introduced for
error analysis. We demonstrate this methodology by simulating a BOS experiment
with a known density field obtained from direct numerical simulations (DNS) of
homogeneous buoyancy driven turbulence, and comparing the light ray
displacements from ray tracing to results from BOS theory. The light ray
displacements show good agreement with the reference data. This methodology
provides a framework for further development of simulation tools for use in
experiment design and development of image analysis tools for PIV and BOS
applications. An implementation of the proposed methodology in a Python-CUDA
program is made available as an open source software for researchers.
