• Stars
    star
    153
  • Rank 243,368 (Top 5 %)
  • Language
    C++
  • License
    BSD 3-Clause "New...
  • Created about 9 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A small, reference GI renderer

nanogi

A small, reference GI renderer.

Build Status Build status

Introduction

nanogi is a small global illumination (GI) renderer intended to be utilized as a reference renderer. The application is written in C++, focusing on the correctness of the implementation rather than performance, e.g., we removed caches which is often introduced as an optimization. In the overall of the implementation, we tried to compute the equation in the original mathematical formulation as it is, as much as possible.

Building

Dependencies

Docker

$ cd nanogi  
$ sudo docker build -t nanogi .  
$ sudo docker run nanogi /nanogi/build/bin/nanogi

Setup for runC exection

$ cd nanogi/utils

# create stripped docker image from `nanogi` 
$ strip-nanogi-docker-image.sh
$ export-nanogi-dist.sh
# nanogi-dist.tar.bz2 will be generated

Execute nanogi with runC

$ cd nanogi/utils/runc

# place scene file into `data/` directory.
# edit nanogi command in `input.config.json`
# then generate runC config files.
$ sh setup.sh

# run nanogi with runC.
$ sudo runc start

Windows

Tested on VS2013 Update 4.
We prepared pre-built libraries for VS2013 x64 environment in the external repository.

  1. Install cmake (>= 3.1).

  2. Install Qt (e.g., msvc2013_64_opengl)

  3. Install Boost library

  4. Move to the repository and run cmake command. You need to specify environment variables for

    • Boost
      • BOOST_ROOT
      • BOOST_INCLUDEDIR
      • BOOST_LIBRARYDIR
    • tbb
      • TBB_ROOT
      • TBB_ARCH_PLATFORM
    • Qt
      • QTDIR

    e.g.,

    $ cd (project root)
    $ mkdir build
    $ BOOST_ROOT="" BOOST_INCLUDEDIR="D:\boost\boost_1_58_0" BOOST_LIBRARYDIR="D:\boost\boost_1_58_0\lib64-msvc-12.0" TBB_ROOT="D:\tbb\tbb43_20150611oss" TBB_ARCH_PLATFORM="intel64" QTDIR="D:\Qt\Qt5.4.2\5.4\msvc2013_64_opengl" cmake -G "Visual Studio 12 2013 Win64" ..

  5. Open solution and build.

Mac OS X

  1. Install some dependencies

    $ sudo ports install cmake boost glm tbb google-ctemplate

  2. Install embree

  3. Build

    $ cd (project root)
    $ mkdir build
    $ cmake -DCMAKE_BUILD_TYPE=Release ..

Linux

Tested on Debian 7 (wheezy).

  1. Add testing repository to the source list (and preferences).
    Some dependencies requires libraries only distributed under testing repository.
    Of cource you have a option to build and install them from sources.
    e.g.

    # vim /etc/apt/sources.list ...
    deb http://ftp.jp.debian.org/debian/ testing main non-free contrib
    deb-src http://ftp.jp.debian.org/debian/ testing main non-free contrib

    deb http://security.debian.org/ testing/updates main contrib non-free
    deb-src http://security.debian.org/ testing/updates main contrib non-free

    # vim /etc/apt/preferences Package: *
    Pin: release a=stable
    Pin-Priority: 700

    Package: *
    Pin: release a=testing
    Pin-Priority: 650

  2. Install some dependencies

    $ aptitude install libboost1.55-dev libboost-regex1.55-dev libboost-program-options1.55-dev libboost-system1.55-dev libboost-filesystem1.55-dev
    $ aptitude install libyaml-cpp-dev/testing libassimp-dev libglm-dev

  3. Download and install embree.
    e.g.

    # aptitude install freeglut3-dev libxmu-dev libxi-dev
    $ cd (downloaded source directory)
    $ mkdir build
    $ cmake -DCMAKE_BUILD_TYPE=Release -D ENABLE_ISPC_SUPPORT=OFF -D RTCORE_TASKING_SYSTEM=INTERNAL ..

  4. Move to the repository and run cmake like

    $ cd (project root)
    $ mkdir build
    $ BOOST_ROOT="" BOOST_INCLUDEDIR="/usr/include" BOOST_LIBRARYDIR="/usr/lib/x86_64-linux-gnu" cmake -DCMAKE_BUILD_TYPE=Release ..

  5. Make.

    $ make

Applications

Libraries

All libraries are written as single file library, intended to be able to modify the library itself easily.

  • nanogi/macros.hpp
    • A collection of platform-dependent macros
  • nanogi/basic.hpp
    • Common basic components
      • Constants
      • Logger
      • Floating point exception handling
      • RNGs
      • Distributions
      • Utility functions, e.g., image saving
  • nanogi/rt.hpp
    • Core components for implementing renderers
      • Mesh loading
      • Geometries
      • Primitive definition
      • Scene definition
  • nanogi/bpt.hpp
    • Core components for implementing BDPT based techniques
      • Path definition
  • nanogi/gl.hpp
    • Thin OpenGL wrapper

Applications

  • nanogi
    • Algorithm
      • Renderer
        • pt: Path tracing
        • ptdirect: Path tracing with next event estimation
        • lt: Light tracing
        • ltdirect: Light tracing with next event estimation
        • bdpt: Bidirectional path tracing
        • ptmnee: Path tracing with manifold next event estimation
          • NOTE: Experimenal
          • Utilizes simplified formulation with specular manifold
      • BSDF
        • D: Diffuse material
        • G: Glossy material
        • S: Specular material
          • reflection: Perfect reflection
          • refraction: Perfect refraction with total internal reflection
          • fresnel: Flesnel reflection and refraction
      • Emitter
        • L: Light sources
          • area: Area light source
          • point: Point light source
          • direction: Directional light source
        • E: Sensors
          • area: Area sensor (mainly for verification purpose)
          • pinhole: Pinhole camera
    • Config version: 3-5
    • Platform
      • Windows
      • Linux
      • Mac OS X
  • nanogi-viewer
    • Simple scene viewer
    • Config version: 3-5
    • Platform
      • Windows

Scene specification

The software utilizes original scene configuration file written in YAML. See schema.yml for the complete specification. Brief explanation of the scene configuration:

  • The version of the scene configuration file must be supported by the renderer. Current version is 5.
  • A scene is a set of primitives.
  • A primitive is a logical component of a mesh and a material.
    • Primitive type defines the type of the primitive specified by
      • L: Light source
      • E: Sensor
      • D: Diffuse material
      • S: Specular material
      • G: Glossy material
    • Each primitive type might have sub-types
      • L
        • area: Area light source
        • point: Point light source
        • direction: Directional light source
      • E
        • area: Area sensor (mainly for verification purpose)
        • pinhole: Pinhole camera
      • S
        • reflection: Perfect reflection
        • refraction: Perfect refraction with total internal reflection
        • fresnel: Flesnel reflection and refraction
    • A primitive utilizes its original vertex position, i.e., there is no transformation nor instancing. You need to finish transformation of the meshes in your workflow.

An example: A scene with 2 planes and 1 sphere (triangle mesh). One of the plane is the area light source. The sensor is pinhole camera.

version: 5
scene:
  primitives:
    - type: [L, D]
      mesh:
        path: 'Plane.000.obj'
      params:
        L:
          type: area
          area:
            Le: [1, 1, 1]
        D:
          R: [0, 0, 0]

    - type: [D]
      mesh:
        path: 'Plane.001.obj'
      params:
        D:
          R: [1, 1, 1]

    - type: [S]
      mesh:
        path: 'Icosphere.obj'
      params:
        S:
          type: fresnel
          fresnel:
            R: [1, 1, 1]
            eta1: 1
            eta2: 2

    - type: [E]
      main_sensor: true
      params:
        E:
          type: pinhole
          pinhole:
            We: [1, 1, 1]
            view:
              eye: [ 0.139240, 0.145503, 3.983653 ]
              center: [ 0.079524, 0.098253, 2.986557 ]
              up: [ 0, 1, 0 ]
            perspective:
              fov: 45

Tips

Code reading. We wrote the code to increase locality of the implementation. In many cases, we did not create new function as a logical component of some feature. Instead, we extensively facilitated scopes surrounded with pragma region. So we recommend to use Visual Studio for code reading if possible. Although commenting of the code is minimum, the code structure can be recognizable with hierarchical structure of pragma region.

Varidation of scene configuration files. e.g., in Windows environment.

> conda create --name pykwalify python
> activate pykwalify
> conda install docopt pyyaml python-dateutil
> pip install pykwalify
> pykwalify --data-file --schema-file schema.yml

License

This software is licenced under BSD 3-Clause. For detail, see LICENSE file.

More Repositories

1

nanort

NanoRT, single header only modern ray tracing kernel.
C++
1,019
star
2

nanostl

NanoSTL, a small subset of C++ STL and libm
C++
111
star
3

nnview

A neural network visualizer
C
90
star
4

colorcorrectionmatrix

Compute color correction matrix in python and C++
C++
86
star
5

prnet-infer

C++11 port of YadiraF's PRNet(inference only)
C
68
star
6

mallie

Mallie, bootstrap for your own ray tracer.
C
57
star
7

embree-aarch64

AARCH64 port of Embree ray tracing library
C++
47
star
8

softcompute

SoftCompute, CPU JIT execution of SPIR-V compute shader
C++
42
star
9

lighttransportequation-orb

Light Transport Equation Orb
40
star
10

pbrlab

`pbrlab` is well-verified(through brute force human verification and debugging) path tracing + PBR shading/rendering implementation.
C++
35
star
11

japanese-llama-experiment

Japanese LLaMa experiment
C
33
star
12

nanocsv

Multithreaded header only C++11 CSV parser
C
29
star
13

gltf-insight

C++11 based glTF 2.0 data insight tool
C
25
star
14

nanosnap

Nanoscale Signal, Noise and Audio Processing library in C++11
C
22
star
15

c-libtorch

Experimental C binding for libtorch
C++
15
star
16

lighttransportequation-glass

Light Transport Equation Glass
15
star
17

nanolog

Nanoscale logging library in C++11
C++
13
star
18

simple_vulkan

simple vulkan framework
C++
13
star
19

oclc

Simple OpenCL offline compiler
C++
13
star
20

VisemeNet-infer

CPU inference version of VisemeNet-tensorflow
Jupyter Notebook
11
star
21

vermeer-box

Vermeer box scene
11
star
22

tf-frozen2cc

TensorFlow frozen forward model to plain C++ converter
Python
10
star
23

francine

Highly scalable renderer backend
C++
10
star
24

procedural-eyeball-shader

Fully procedural GLSL eyeball shader
JavaScript
10
star
25

sss-model

Test model for subsurface scattering
9
star
26

mlspv

Machine Learning with SPIR-V(Experimental)
C
8
star
27

cpp-guidelines

Light Transport Entertainment's C/C++ coding guidelines
8
star
28

nanolibc

Nanoscale libc
C
7
star
29

kuroga

Kuroga, simple & single python file meta-build system for ninja
Python
7
star
30

obj2eson

Wavefront obj to ESON converter.
C++
7
star
31

tubular-cpp

Curves to tube mesh conversion in cpp
C++
6
star
32

rainbowmist

RainbowMist 🌈🌫️ is a simple C++ macro and template based unified compute kernel utility.
C++
5
star
33

ZoCap

C++
4
star
34

objlab

Simple wavefront .obj viewer
C
4
star
35

tinyvtkxml

Tiny VTK XML parser in C++.
C++
4
star
36

brdfview

C++
3
star
37

francine-ui

francine viewer
JavaScript
3
star
38

usd-fuzz

USD(USDA, USDC, USDZ) poc and regression files for fuzzing test
3
star
39

chainer2tflite

Chainer model to TensorFlow-Lite converter
3
star
40

rcopy-win

Windows port of rcopy from librdmacm
C
3
star
41

tinyplotlib

Tiny plotting library in C++11
3
star
42

jagger-python

Python binding for Jagger(C++ implementation of Pattern-based Japanese Morphological Analyzer)
C++
3
star
43

japanese-normalizer-cpp

Header-only Japanese Normalizer in C++11
C++
2
star
44

is

Interstellar: file sync utility for multiple remote servers with terabytes of files
Go
2
star
45

USD-android

Building USD(Universal Scene Description) on Android
C++
2
star
46

nanodenoise-example

GUI and other example codes for nanodenoise
2
star
47

nanozlib

Nanoscale secure zlib library
C
1
star
48

imagediffview

Image diff view in HTML.
JavaScript
1
star
49

simpleVK

C++
1
star
50

english-text-to-sequence

English text to sequence conversion in Python
Python
1
star