Get Started

  • 2021.2
  • 03/26/2021
  • Public Content

Run a Sample with Intel® OSPRay

The sample application uses Intel® OSPRay to render a simple set of triangles and enhance the quality of the original rendering. This walkthrough demonstrates how to run the sample application with Intel® OSPRay from the
Intel® oneAPI Rendering Toolkit
(
Render Kit
).
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.
    Intel® DevCloud has the toolkit pre-installed.
  • A
    .ppm
    image viewer (
    for example, ImageMagick*, Eye of GNOME* (EoG), or GIMP*
    )
  • Optional
    : Docker* platform. Docker containers are useful to make setting prerequisites easier.
Run the ospTutorial Sample Application
  1. Open a
    new terminal window or set up a Docker container with the
    Render Kit
    and software prerequisites installed. Refer to Configure Your System for instructions.
    Terminal-only Intel® DevCloud instances include the Render Kit already installed and configured.
  2. Go to a writable directory and create a directory to save the sample application results to.
    For example, create the
    rk_gsg
    folder
    under the home directory
    ~
    :
    cd ~
    mkdir rk_gsg
    cd rk_gsg
  3. Run
    ospTutorial
    :
    <install-dir>/ospray/latest/bin/ospTutorial
    To run this application in the Intel® DevCloud environment, run it with your preferred queue mechanism. For example:
    <install-dir>/ospray/latest/bin/ospTutorial | qsub
    If the sample executes successfully, you should see two
    .ppm
    images in the working directory:
    firstFrame.ppm
    and
    accumulatedFrame.ppm
    .
  4. Open the resulting files with a preferred image viewer. For example,
    to open resulting images with the
    EoG
    image viewer
    :
    eog firstFrame.ppm
    eog accumulatedFrame.ppm
    If you ran the sample in the Intel® DevCloud, transfer the resulting images to your local system with the
    scp
    tool to view them.
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
This is only for environments with a graphical user interface (GUI).
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
Make sure you install all the listed prerequisites following the steps in Configure Your System.
  • 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
    /opt/intel/oneapi/
    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 GNU* Compiler Collection (GCC and G++ with C++11 and C99 support).
  • Git*
  • CMake* 3.12 or higher
  • A
    .ppm
    image viewer (
    for example, Eye of GNOME* (EoG), ImageMagick*, or GIMP*
    )
  • Optional:
    Docker* platform. Docker containers are useful to make setting prerequisites easier.
Build the ospTutorialFindospray Sample Application
  1. Open a
    new terminal window or set up a Docker container with the
    Render Kit
    and software prerequisites installed. Refer to Configure Your System for instructions.
  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. 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>
  5. 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.
  6. Clone the Intel OSPRay GitHub* project:
    git clone --no-checkout https://github.com/ospray/ospray.git ospray
    cd ospray
  7. Fetch the version tags:
    git fetch --tags
  8. 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.5.0
    cd apps/ospTutorial/ospTutorialFindospray
    You can also obtain samples with tools such as SVN* or GNU* Wget or by extracting the source
    .zip
    file for the Intel OSPRay from the GitHub repository.
  9. Configure and build the sample in a Release mode:
    cmake -DCMAKE_PREFIX_PATH=/opt/intel/oneapi/ospray/latest/lib/cmake/ospray-2.5.0
    cmake --build .
  10. 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
    .
  11. Open the resulting files with a preferred image viewer. For example,
    to open resulting images with the
    EoG
    image viewer
    :
    eog firstFrame.ppm
    eog accumulatedFrame.ppm
    If you ran the sample in the Intel® DevCloud, transfer the resulting images to your local system with the
    scp
    tool to view them.
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.
    • To open the
      README.md
      documentation file:
      grip -b <install-dir>/ospray/latest/doc/README.md
    • To open the
      readme.pdf
      documentation file:
      evince <install-dir>/ospray/latest/doc/readme.pdf
      Graphical user interface (GUI) is required.
    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 and review the sample application.

Product and Performance Information

1

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