Right-handed coorinate, Y up, counter clock-wise normal definition.
Face must be triangle or quad. No n-gons(n >= 5) are supported.
- git
- cmake
- OpenGL 2.x
Clone ptex-aarch64
(Added reading ptex data from memory) https://github.com/syoyo/ptex-aarch64.git to this directory.
$ cd $nanort/examples/ptex
$ git clone https://github.com/syoyo/ptex-aarch64.git
$ rmdir build
$ mkdir build
$ cd build
$ cmake ..
$ make
$ rmdir /s /q build
$ mkdir build
$ cd build
$ cmake -G "Visual Studio 15 2017" -A x64 ..
Open .sln
and build it with Visual Studio 2017.
Prepare ptex scene. for example download some ptex scene for example from http://ptex.us/samples.html
Edit config.json
and setup file path to .obj and .ptx, then
$ cd build
$ ./ptexrt ../config.json
Quad must be planar.
We tessellate a quad to two-triangles and build BVH, then do ray-triangle intersection. To compute correct UV, we store
obj_filename
: filepath : filenam of wavefront obj mesh(.obj)ptex_filename
: filepath : filenam of ptex(.ptx)dump_ptex
: true/false : Dump ptex data after loading it.
- Read vertex/index information from .ptx so that we can render pentagon example(its represented as 5 quads in .ptx, but .obj uses single face with 5 verties)
- Support Quad primitive in ray traversal. http://graphics.cs.kuleuven.be/publications/LD05ERQIT/index.html
- left mouse = rotate
- shift + left mouse = translate
- tab + left mouse = dolly(Z axis)