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 Windows* OS
.
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
    C:\Program Files (x86)\Intel\oneAPI
    directory. Replace
    <install-dir>
    with the default or your custom installation path.
  • Windows* 10, 64 bit
  • A
    .ppm
    image viewer ()
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. From the
    Start
    menu, type
    cmd
    and press
    Enter
    to open a new command prompt window.
  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 %USERPROFILE%
    mkdir rk_gsg
    cd rk_gsg
  3. Set Intel® oneAPI Toolkits environment variables:
    call "<install-dir>\setvars.bat"
    where
    <install-dir>
    is the directory where you installed the
    Intel® oneAPI Rendering Toolkit
    . By default, it is
    C:\Program Files (x86)\Intel\oneAPI\
    .
    This script checks that Render Kit programs and pre-compiled library
    .dll
    files are available for samples launched within the command shell session. You can also set up the
    Render Kit
    environment variables per component from a command prompt as follows:
    path <install-dir>\ospray\latest\bin;%PATH%
    path <install-dir>\ospray_studio\latest\bin;%PATH%
    path <install-dir>\embree\latest\bin;%PATH%
    path <install-dir>\tbb\latest\redist\intel64\vc_mt;%PATH%
    path <install-dir>\openvkl\latest\bin;%PATH%
    path <install-dir>\oidn\latest\bin;%PATH%
    path <install-dir>\rkcommon\latest\bin;%PATH%
  4. Run
    ospTutorial
    :
    ospTutorial.exe
    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 a preferred image viewer. For example, to open resulting images with the
    ImageMagick*
    image viewer
    :
    imdisplay.exe firstFrame.ppm
    imdisplay.exe 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
  1. From the
    Start
    menu, type
    cmd
    and press
    Enter
    to open a new command prompt window.
  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 %USERPROFILE%
    mkdir rk_gsg
    cd rk_gsg
  3. Set Intel® oneAPI Toolkits environment variables:
    call "<install-dir>\setvars.bat"
    where
    <install-dir>
    is the directory where you installed the
    Intel® oneAPI Rendering Toolkit
    . By default, it is
    C:\Program Files (x86)\Intel\oneAPI\
    .
    This script checks that Render Kit programs and pre-compiled library
    .dll
    files are available for samples launched within the command shell session. You can also set up the
    Render Kit
    environment variables per component from a command prompt as follows:
    path <install-dir>\ospray\latest\bin;%PATH%
    path <install-dir>\ospray_studio\latest\bin;%PATH%
    path <install-dir>\embree\latest\bin;%PATH%
    path <install-dir>\tbb\latest\redist\intel64\vc_mt;%PATH%
    path <install-dir>\openvkl\latest\bin;%PATH%
    path <install-dir>\oidn\latest\bin;%PATH%
    path <install-dir>\rkcommon\latest\bin;%PATH%
  4. Run
    ospExamples
    :
    ospExamples.exe
A new GUI window will open with multiple simple ray-traced scenes composed of basic geometry types, lights, and volumes. You can edit the scene or select a different scene with the drop-down buttons. Move the camera by clicking and holding a left, right, or middle 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
    C:\Program Files (x86)\Intel\oneAPI
    directory. Replace
    <install-dir>
    with the default or your custom installation path.
  • You should have all the Render Kit components installed.
  • Intel® oneAPI Threading Building Blocks
    (
    oneTBB
    ) headers from the Intel® oneAPI Base Toolkit.
    • Render Kit installs only
      oneTBB
      runtimes. Headers are also required to build samples.
  • Windows* 10, 64 bit
  • Microsoft Visual Studio* 2019
    You can also use Microsoft Visual Studio 2017, but it may require different CMake* toggles to function.
  • CMake* 3.12 or higher
    • Microsoft Visual Studio 2017 or 2019 may include the CMake 3.12 extension.
  • A
    .ppm
    image viewer ()
Build the ospTutorialFindospray Sample Application
  1. Open a
    x64 Native Tools Command Prompt for VS 2019
    from the start menu.
  2. Create a directory for sample result files in a user-writeable location. For example, to create the
    rk_gsg
    folder in the
    %USERPROFILE%
    directory to match the source distribution for the Intel OSPRay library and sample programs
    :
    cd %USERPROFILE%
    mkdir rk_gsg
    cd rk_gsg
  3. Set Intel® oneAPI Toolkits environment variables:
    call "<install-dir>\setvars.bat"
    where
    <install-dir>
    is the directory where you installed the
    Intel® oneAPI Rendering Toolkit
    . By default, it is
    C:\Program Files (x86)\Intel\oneAPI\
    .
    This script checks that Render Kit programs and pre-compiled library
    .dll
    files are available for samples launched within the command shell session. You can also set up the
    Render Kit
    environment variables per component from a command prompt as follows:
    path <install-dir>\ospray\latest\bin;%PATH%
    path <install-dir>\ospray_studio\latest\bin;%PATH%
    path <install-dir>\embree\latest\bin;%PATH%
    path <install-dir>\tbb\latest\redist\intel64\vc_mt;%PATH%
    path <install-dir>\openvkl\latest\bin;%PATH%
    path <install-dir>\oidn\latest\bin;%PATH%
    path <install-dir>\rkcommon\latest\bin;%PATH%
  4. Ensure that CMake is available:
    cmake --version
    You should see the version of CMake installed on your machine. It should be 3.1 or higher.
  5. Otherwise, add CMake to your PATH environment variable:
    set PATH=C:\Program Files\CMake\bin;%PATH%
  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.6.0
    cd apps\ospTutorial\ospTutorialFindospray
  9. Create a
    build
    directory:
    mkdir build
    where
    <install-dir>
    is the directory where you installed the
    Intel® oneAPI Rendering Toolkit
    . By default, it is
    C:\Program Files (x86)\Intel\oneAPI\
    .
  10. Generate a Microsoft Visual Studio solution and project hierarchy for Intel OSPRay
    ospTutorialFindospray
    sample:
    cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_PREFIX_PATH="<install-dir>/ospray/latest/lib/cmake/ospray;<install-dir>/embree/latest;<install-dir>/rkcommon/latest/lib/cmake/rkcommon;<install-dir>/openvkl/latest/lib/cmake/openvkl" -DRKCOMMON_TBB_ROOT="<install-dir>/tbb/latest" ..
  11. Configure and build the sample in a Release mode:
    cmake --build . --config Release
  12. Navigate to the installation output directory:
    cd Release
  13. Run the sample application:
    ospTutorialFindospray.exe
    If the sample executes successfully, you should see two
    .ppm
    images in the working directory:
    firstFrame.ppm
    and
    accumulatedFrame.ppm
    .
  14. Open the resulting files
    with a preferred image viewer. For example, to open resulting images with the
    ImageMagick*
    image viewer
    :
    imdisplay.exe firstFrame.ppm
    imdisplay.exe 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
    C:\Program Files (x86)\Intel\oneAPI\
    . If you installed the
    Render Kit
    to a custom directory, replace the
    <install-dir>
    with your custom installation path.
  • Review the sample source and
    CMakeLists.txt
    files in the
    %USERPROFILE%\rk_gsg\ospray\apps\ospTutorial
    directory.
  • Examine your generated
    .sln
    and
    .proj
    solution files generated by the CMake and the Microsoft Visual Studio IDE. Review the project properties to understand library linking and header inclusion for Intel OSPRay. Apply properties to your own programs as required.
  • 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.