Coder Social home page Coder Social logo

jonike / embree_viewer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from martin-pr/embree_viewer

0.0 2.0 0.0 32.22 MB

Embree viewer is a simple implementation of a progressive renderer, based on Intel's Embree raytracing kernels. Its UI is written in SDL2, and it supports Alembic, OBJ file formats, with a JSON file to describe a scene.

License: MIT License

Python 1.65% CMake 1.20% C++ 96.74% HTML 0.41%

embree_viewer's Introduction

Embree Viewer

Embree viewer is a simple implementation of a progressive renderer, based on Intel's Embree raytracing kernels. Its UI is written in SDL2, and it supports Alembic and OBJ model file formats, with a simple JSON file to describe a scene.

Use case

Embree viewer is intended as a simple example implementation of a progressive renderer with Embree, one step above the simple examples Embree ships with, but significantly simpler than Ospray and similar.

Its main purpose is to demonstrate the performance of Embree raytracing kernels, and the scalability of its instancing system, in a simple real-time multithread framework that can load common model files. It is not intended as a full raytracer - it does not have any support for materials, textures, normals, lighting or sampling.

Clarisse scripts

Isotropix Clarisse is a professional lighting tool, heavily focusing on efficient object instancing. It is available as a professional package, or as a Personal Learning Edition.

For the purposes of experimentation with Embree, the clarisse directory contains a number of PLE scene files, with a set of scripts to export their scattering setup to a set of JSON and binary files compatible with Embree viewer.

Building

Embree viewer was developed on a standard installation of Debian Linux; it has not been tested on MS Windows (any contribution in that respect would be appreciated).

Dependencies

Non-standard dependencies, which have to be compiled on the target Linux machine, and installed into a location available to CMake:

Standard dependencies, available in Debian (or other Linux distro):

  • Boost (tested against 1.62.0)
  • OpenEXR and IlmBase (tested against 2.2.0)
  • SDL2 (tested against 2.0.5)
  • TBB (tested against 4.3)

Compilation

The repository contains a standard set of CMake build files:

mkdir build
cmake ..
make -j

Usage

Command line options

Allowed options:
  --help                produce help message
  --mesh arg            load mesh file (.abc, .obj)
  --scene arg           load a scene file (.json)

Mouse interaction

The viewer implements only minimal mouse interaction (for now):

  • left mouse button + movement rotates around the current origin point
  • right mouse button + movement moves the camera towards or away form the origin point (using logarithmic scale based on distance)
  • left double click selects the camera's focus point to the point of intersection between the camera ray determined from the click and the scene

File formats

At the moment, there are 3 input file types - .abc, .obj and .json.

Scene file format

Scene file is a very simple JSON-based file format, describing the input files and scattering information.

The root of the scene is a json list, enumerating the elements of the scene. Each element can either be a subscene or an object.

Each object is represented as a simple dictionary, with a filesystem path (absolute or relative) to an .obj or a .abc mesh file, and a 4x4 matrix transform represented as an array.

A scene is a dictionary containing an array of objects (each either an object, or another sub-scene), a transform acting as a parent for all objects and either a set of instances in an array of structs with id and transform, or an instance_file link to a binary file containing the instancing information. A scene_path string then represents a unique ID of the instanced sub-scene in the scene file, serving as an identifier to de-duplicated sub-scenes.

Binary instances file format

The instancing file is a plain binary file, containing 17x32bit data records:

  • first 4 bytes represent a 32-bit unsigned integer, referencing which of the objects records should be used for this particular instance
  • 16 4-byte records after that represent a transformation matrix of each instance (composed of 32-bit floats)

Example files

Embree viewer comes with a small number of example files in the data directory (each directory includes a LICENSE file for the files it contains):

Virtual Emily mesh

Virtual Emily project's main mesh, demonstrating how to load a single model file.

/embree_viewer --mesh data/Emily/Emily_2_1_Alembic_Scene.abc

A Grass Scatterer

A simple scattering scene, using assets exported from Blender and Clarisse, showing the performance and possible complexity of the scene.

/embree_viewer --scene data/Grass/scene.json

License and contributions

This demo is licensed under MIT license, and as such you can use this code for both commercial and noncommercial purposes.

Any contributions are welcome, in terms of ideas, improvements, bugfixes or additional example files.

embree_viewer's People

Contributors

martin-pr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.