Get Started

  • 2021.3
  • 07/20/2021
  • Public Content

Run a Sample with Intel® OSPRay

This walkthrough demonstrates how to run the sample application with Intel® OSPRay from the
Intel® oneAPI Rendering Toolkit
(
Render Kit
)
for macOS*
.
To run an Intel OSPRay sample application, do one of the following:

Run Pre-Built Samples

Prerequisites
  • Intel® oneAPI Rendering Toolkit
    with Intel OSPRay. By default, the
    Intel® oneAPI Rendering Toolkit
    is installed to
    /opt/intel/oneapi/
    directory. Replace
    <install-dir>
    with the default or your custom installation path.
  • A
    .ppm
    image viewer (
    for example, ImageMagick* or GIMP*
    )
Run the ospTutorial Sample Application
The sample application uses Intel® OSPRay to render a simple set of triangles and enhance the quality of the original rendering.
  1. Open a new terminal window. Open Spotlight* tool and enter
    Terminal
    .
  2. Go to a writable directory and create a directory to save the sample application results to.
    For example, create the
    rk_gsg
    folder
    :
    cd ~
    mkdir rk_gsg
    cd rk_gsg
  3. Set environment variables so that programs can see Render Kit runtime libraries. From the terminal, do one of the following:
    • Run the script to set the variables:
      source <install-dir>/setvars.sh
    • Set the
      DYLD_LIBRARY_PATH
      manually:
      export DYLD_LIBRARY_PATH=<install-dir>/rkcommon/latest/lib:<install-dir>/ospray/latest/lib:<install-dir>/oidn/latest/lib:<install-dir>/embree/latest/lib:<install-dir>/openvkl/latest/lib:<install-dir>/tbb/latest/lib
  4. Run
    ospTutorial
    :
    <install-dir>/ospray/latest/bin/ospTutorial
    If the sample executes successfully, you should see two
    .ppm
    images in the working directory:
    firstFrame.ppm
    and
    accumulatedFrame.ppm
    .
  5. Open the resulting files
    with
    Preview
    .
    :
    open firstFrame.ppm
    open accumulatedFrame.ppm
Each image shows two triangles rendered by Intel® OSPRay:
  • The
    firstFrame.ppm
    shows the image after one call to a renderer, which results in triangles with jagged edges and noise in the shadow.
  • The
    accumulatedFrame.ppm
    shows the image after ten calls to a renderer, which results in triangles with antialiased edges and converged shadows. Multiple calls to a renderer enable progressive refinement and enhance image quality.
Run the ospExamples Sample Application
Run the
ospExamples
sample application as follows:
<install-dir>/ospray/latest/bin/ospExamples
A new GUI window will open with multiple simple scenes composed of basic geometry types, lights, and volumes. You can edit the scene by clicking the drop-down buttons. Move the camera by clicking and holding a mouse button, then dragging the mouse. See https://www.ospray.org/tutorials.html for details about controls.
`

Build and Run a Sample

Prerequisites
  • Intel® oneAPI Rendering Toolkit
    (
    Render Kit
    ) with Intel OSPRay. The tutorial describes how to build a sample Intel OSPRay application, which is part of
    Intel® oneAPI Rendering Toolkit
    . By default, the
    Intel® oneAPI Rendering Toolkit
    is installed to directory. Replace
    <install-dir>
    with the default or your custom installation path.
  • A system compiler that supports C99 and C++11. This tutorial uses the included default C/C++ compiler with Xcode*.
  • Git*
  • CMake* 3.12 or higher
  • A
    .ppm
    image viewer (
    for example, ImageMagick* or GIMP*
    )
Build the ospTutorialFindospray Sample Application
  1. Open a
    new terminal.
  2. Create a directory for sample result files in a user-writeable location. For example, to create the
    rk_gsg
    folder in the
    ~
    home directory
    :
    cd ~
    mkdir ~/rk_gsg
    cd rk_gsg
  3. Ensure that Git is available:
    which git
    git --version
    You should get the version of Git installed on your machine.
  4. Set environment variables so that programs can see Render Kit runtime libraries. From the terminal, do one of the following:
    • Run the script to set the variables:
      source <install-dir>/setvars.sh
    • Set the
      DYLD_LIBRARY_PATH
      manually:
      export DYLD_LIBRARY_PATH=<install-dir>/rkcommon/latest/lib:<install-dir>/ospray/latest/lib:<install-dir>/oidn/latest/lib:<install-dir>/embree/latest/lib:<install-dir>/openvkl/latest/lib:<install-dir>/tbb/latest/lib
  5. For corporate network users: Configure the Git proxy server if necessary:
    git config --global http.proxy http://<user>:<pass>@proxy.<server>.com:<port>
    git config --global https.proxy https://<user>:<pass>@proxy.<server>.com:<port>
  6. Ensure that CMake is available:
    which cmake
    cmake --version
    You should see the version of CMake installed on your machine. It should be 3.1 or higher.
  7. Clone the Intel OSPRay GitHub* project:
    git clone --no-checkout https://github.com/ospray/ospray.git ospray
    cd ospray
  8. Fetch the version tags:
    git fetch --tags
  9. Check out the tutorial sources for the Intel OSPRay. Pick the version from your deployment of the Intel oneAPI Rendering Toolkit release:
    git checkout tags/v2.6.0
    cd apps/ospTutorial/ospTutorialFindospray
  10. Configure and build the sample in a Release mode:
    export rkcommon_DIR=<install-dir>/rkcommon/latest
    export embree_DIR=<install-dir>/embree/latest
    export openvkl_DIR=<install-dir>/openvkl/latest
    export ospray_DIR=<install-dir>/ospray/latest
    mkdir build
    cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release
    cmake --build .
  11. Run the sample application:
    ./ospTutorialFindospray
    If the sample executes successfully, you should see two
    .ppm
    images in the working directory:
    firstFrame.ppm
    and
    accumulatedFrame.ppm
    .
  12. Open the resulting files
    with
    Preview
    .
    :
    open firstFrame.ppm
    open accumulatedFrame.ppm
Each image shows two triangles rendered by Intel® OSPRay:
  • The
    firstFrame.ppm
    shows the image after one call to a renderer, which results in triangles with jagged edges and noise in the shadow.
  • The
    accumulatedFrame.ppm
    shows the image after ten accumulations, which result in triangles with antialiased edges and converged shadows. Multiple accumulations enable progressive refinement and enhance image quality.

Next Steps

  • Review the API details provided in the Intel OSPRay documentation.
  • Review other Intel OSPRay sample programs located in the
    <install-dir>/ospray/latest/bin
    directory. Refer to the Intel OSPRay documentation for usage details.
    The default installation directory is
    /opt/intel/oneapi
    . If you installed the
    Render Kit
    to a custom directory, replace the
    <install-dir>
    with your custom installation path.
  • Explore the to build the libraries. Also, use the guide to review, explore, and rebuild the sample application.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.