_images/nTiled_icon.png

nTiled Documentation

nTiled is an openGL viewer that implements tiled and clustered shading as well as a novel technique named hierarchical shading. It is written to evaulate the time and space complexity of said algorithms.

nTiled is written as part of my thesis in order to obtain my masters in computer science at KU Leuven.

How this document is organised

Over time nTiled has grown significantly in size. In order to ensure the usefulness of this project, this documentation is organised in four sections:

  • Motivation describes in depth the use case of this project as well as provide links to the data generated by this project and the actual text written.
  • Getting Started describes how to get this project running.
  • Structure of the Project provides a high level overview of the project as well as several class diagrams.
  • The nTiled API reference section describes in depth the classes and functions of this project.

Furthermore the thesis text and additional data are housed at the following repositories:

Index

Motivation

nTiled is written as a tool the evaluate the performance of several light assignment algorithms.

Light Assignment

The Algorithms

Tiled Shading
Clustered Shading
Hierarchal Shading

Thesis and data sources

Getting Started

Installation

nTiled is developed as a visual studio project. In order to get it running on your machine you will need the latest visual studio as well as the following set of dependencies.

Dependencies

nTiled requires the following dependencies:

  • openGL in the form of GLAD
  • glfw as a windows manager
  • glm to manage mathematics
  • assimp to read different 3d files
  • rapidjson to read json files
Step by step installation
  1. Install Visual Studio with the installer obtained from here.

  2. Clone the nTiled repository

    cd <desired parent directory>
    git clone https://github.com/BeardedPlatypus/nTiled.git
    
  3. Download dependencies and put them at their relative path

    1. openGL: glad

      Follow the instructions in the readme of glad to generate the appropriate c code and headers. Place these these files at <solution_directory>/nTiled/lib/>

    2. glfw

      Download the files from the homepage and put these under <solution_directory>/nTiled/lib/glfw/> If a different version then 3.1.2 is used this needs to be updated in the nTiled properties

    3. glm

      Download the files and put these under <solution_directory>/nTiled/lib/glm/>

    4. assimp

      Download the files from the homepage and put these under <solution_directory>/nTiled/lib/assimp/>

    5. rapidjson

      Follow the installation instructions on the README of rapidjson

  4. You should now be able to start the solution from inside visual studio and it should compile.

Basic Usage

_images/ui.png

nTiled can be run by running the produced executable followed by the path to a run configuration file.

nTiled <path_to_conf_file.json>

An example run configuration file can be found in the example folder. This is the same file that will be run when no path is specified.

For other example files see the data repository. For a complete overview of the configuration options see :ref: conf_spec

Structure of the Project

The nTiled API reference

The nTiled api is divided into modules.

Camera

The camera module contains all classes and functions related to the Camera in nTiled. The Camera class acts as a facade, facilitating interactions between the rest of the program and the camera module. The control scheme of the Camera is controlled by the CameraControl class.

Camera Model

In order to ensure no errors in communication are made, the following naming conventions were adopted within the camera module:

_images/camera_model.png

The location of the camera is specified by Eye vector. The look at point is defined by the centre, finally the local y-direction is controlled by the Up-vector.

Furthermore each camera has a limited space it will display. This space is controlled by the z-near and z-far values. These in combination with the field of view and aspect ratio values determine the view frustrum.

The field of view values are all specified in degrees. The eye, centre and z-depth values are all defined in world coordinates.

Camera Input

In order to control the Camera the following classes are implemented: * TURNTABLE: allows a direct user controlled input similar to the controls in blender

  • PATH: Loads a file containing the lookat matrices per frame. It will render these sequentially.
Camera API
class nTiled::camera::Camera

Warning

doxygenclass: Cannot find class “nTiled::camera::Camera” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::camera::CameraControl

Warning

doxygenclass: Cannot find class “nTiled::camera::CameraControl” in doxygen xml output for project “nTiled” from directory: doxyxml/


Warning

doxygenclass: Cannot find class “nTiled::camera::TurnTableCameraControl” in doxygen xml output for project “nTiled” from directory: doxyxml/


Warning

doxygenclass: Cannot find class “nTiled::camera::PathCameraControl” in doxygen xml output for project “nTiled” from directory: doxyxml/

struct nTiled::camera::CameraConstructionData

Warning

doxygenstruct: Cannot find class “nTiled::camera::CameraConstructionData” in doxygen xml output for project “nTiled” from directory: doxyxml/

struct nTiled::camera::CameraData

Warning

doxygenstruct: Cannot find class “nTiled::camera::CameraData” in doxygen xml output for project “nTiled” from directory: doxyxml/

GUI

The gui module is written with the dear, imgui library, (available here) It determines whether user input is meant for the interface, or should be forwarded to the Camera of nTiled.

GUI API
class nTiled::gui::GuiManager

Warning

doxygenclass: Cannot find class “nTiled::gui::GuiManager” in doxygen xml output for project “nTiled” from directory: doxyxml/

enum class nTiled::gui::GuiFocus

Warning

doxygenenum: Cannot find enum “nTiled::gui::GuiFocus” in doxygen xml output for project “nTiled” from directory: doxyxml/

Logging

The logging module provides the functionality to track the execution time of functions.

Logging API
class nTiled::logged::ExecutionTimeLogger

Warning

doxygenclass: Cannot find class “nTiled::logged::ExecutionTimeLogger” in doxygen xml output for project “nTiled” from directory: doxyxml/

Main

Main contains the definitions of the classes and functions related to executing nTiled.

Main API
class nTiled::Clock

Warning

doxygenclass: Cannot find class “nTiled::Clock” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::Controller

Warning

doxygenclass: Cannot find class “nTiled::Controller” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::DrawMethod

Warning

doxygenclass: Cannot find class “nTiled::DrawMethod” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::DrawToMemory

Warning

doxygenclass: Cannot find class “nTiled::DrawToMemory” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::DrawToView

Warning

doxygenclass: Cannot find class “nTiled::DrawToView” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::FrameEvent

Warning

doxygenclass: Cannot find class “nTiled::FrameEvent” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::FrameEventCompare

Warning

doxygenclass: Cannot find class “nTiled::FrameEventCompare” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::SetDrawMethodEvent

Warning

doxygenclass: Cannot find class “nTiled::SetDrawMethodEvent” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::ToggleLoggingDataEvent

Warning

doxygenclass: Cannot find class “nTiled::ToggleLoggingDataEvent” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::ExportLoggingDataEvent

Warning

doxygenclass: Cannot find class “nTiled::ExportLoggingDataEvent” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::ExitEvent

Warning

doxygenclass: Cannot find class “nTiled::ExitEvent” in doxygen xml output for project “nTiled” from directory: doxyxml/

Math

The Math module contains all custom math functions used in nTiled.

Math API
Functions

Warning

doxygenfunction: Cannot find function “nTiled::math::to_radians” in doxygen xml output for project “nTiled” from directory: doxyxml/

Warning

doxygenfunction: Cannot find function “nTiled::math::to_degrees” in doxygen xml output for project “nTiled” from directory: doxyxml/

Warning

doxygenfunction: Cannot find function “nTiled::math::getNextPow2” in doxygen xml output for project “nTiled” from directory: doxyxml/

Constants

Warning

doxygenvariable: Cannot find variable “nTiled::math::kPi” in doxygen xml output for project “nTiled” from directory: doxyxml/

Pipeline

The Pipeline module is the heart of nTiled, it contains all rendering functionality, including both Tiled and Clustered shading.

Because the module itself is as big as it is, it has been subdivided in the following sections

Interfaces of the Pipeline

This section contains links to all the interfaces used in the Pipeline module.

Interfaces API
class nTiled::pipeline::Pipeline

Warning

doxygenclass: Cannot find class “nTiled::pipeline::Pipeline” in doxygen xml output for project “nTiled” from directory: doxyxml/

_nTiled-pipeline-PipelineType:

enum class nTiled::pipeline::PipelineType

Warning

doxygenenum: Cannot find enum “nTiled::pipeline::PipelineType” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::Shader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::Shader” in doxygen xml output for project “nTiled” from directory: doxyxml/

struct nTiled::pipeline::ShaderKey

Warning

doxygenstruct: Cannot find class “nTiled::pipeline::ShaderKey” in doxygen xml output for project “nTiled” from directory: doxyxml/

Forward Pipeline

Forward Pipeline module is part of the Pipeline module and provides all functionality related to the Forward Pipeline, including the ForwardPipeline definitions, and the ForwardShader definitions.

Forward API
class nTiled::pipeline::ForwardPipeline

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ForwardPipeline” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ForwardPipelineLogged

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ForwardPipelineLogged” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::DepthBuffer

Warning

doxygenclass: Cannot find class “nTiled::pipeline::DepthBuffer” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ForwardShader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ForwardShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

_nTiled-pipeline-ForwardShaderId:

enum class nTiled::pipeline::ForwardShaderId

Warning

doxygenenum: Cannot find enum “nTiled::pipeline::ForwardShaderId” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ForwardAttenuatedShader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ForwardAttenuatedShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ForwardTiledShader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ForwardTiledShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ForwardClusteredShader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ForwardClusteredShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ForwardAttenuatedShaderLogged

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ForwardAttenuatedShaderLogged” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ForwardTiledShaderLogged

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ForwardTiledShaderLogged” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ForwardClusteredShaderLogged

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ForwardClusteredShaderLogged” in doxygen xml output for project “nTiled” from directory: doxyxml/

Deferred Pipeline

Deferred Pipeline module is part of the Pipeline module and provides all functionality related to the Deferred Pipeline, including the DeferredPipeline definitions, and the DeferredShader definitions.

Deferred API
class nTiled::pipeline::DeferredPipeline

Warning

doxygenclass: Cannot find class “nTiled::pipeline::DeferredPipeline” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::DeferredPipelineLogged

Warning

doxygenclass: Cannot find class “nTiled::pipeline::DeferredPipelineLogged” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::GBuffer

Warning

doxygenclass: Cannot find class “nTiled::pipeline::GBuffer” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::DeferredShader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::DeferredShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

_nTiled-pipeline-DeferredShaderId:

enum class nTiled::pipeline::DeferredShaderId

Warning

doxygenenum: Cannot find enum “nTiled::pipeline::DeferredShaderId” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::DeferredAttenuatedShader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::DeferredAttenuatedShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::DeferredTiledShader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::DeferredTiledShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::DeferredClusteredShader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::DeferredClusteredShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::DeferredAttenuatedShaderLogged

Warning

doxygenclass: Cannot find class “nTiled::pipeline::DeferredAttenuatedShaderLogged” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::DeferredTiledShaderLogged

Warning

doxygenclass: Cannot find class “nTiled::pipeline::DeferredTiledShaderLogged” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::DeferredClusteredShaderLogged

Warning

doxygenclass: Cannot find class “nTiled::pipeline::DeferredClusteredShaderLogged” in doxygen xml output for project “nTiled” from directory: doxyxml/

Light Management

The Light Management module contains all functionality related to the light assignment algorithms. Currently it supports both Tiled as well as Clustered shading.

LightManagement API
class nTiled::pipeline::TiledLightManager

Warning

doxygenclass: Cannot find class “nTiled::pipeline::TiledLightManager” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::TiledLightManagerBuilder

Warning

doxygenclass: Cannot find class “nTiled::pipeline::TiledLightManagerBuilder” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::TiledLightManagerLogged

Warning

doxygenclass: Cannot find class “nTiled::pipeline::TiledLightManagerLogged” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::TiledLightManagerLoggedBuilder

Warning

doxygenclass: Cannot find class “nTiled::pipeline::TiledLightManagerLoggedBuilder” in doxygen xml output for project “nTiled” from directory: doxyxml/

_nTiled-pipeline-LightProjector:

enum class nTiled::pipeline::LightProjector

Warning

doxygenenum: Cannot find enum “nTiled::pipeline::LightProjector” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::BoxProjector

Warning

doxygenclass: Cannot find class “nTiled::pipeline::BoxProjector” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::LightGrid

Warning

doxygenclass: Cannot find class “nTiled::pipeline::LightGrid” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ClusteredLightManager

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ClusteredLightManager” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ClusteredLightManagerBuilder

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ClusteredLightManagerBuilder” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ClusteredLightManagerLogged

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ClusteredLightManagerLogged” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::ClusteredLightManagerLoggedBuilder

Warning

doxygenclass: Cannot find class “nTiled::pipeline::ClusteredLightManagerLoggedBuilder” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::clustered::LightClustering

Warning

doxygenclass: Cannot find class “nTiled::pipeline::clustered::LightClustering” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::clustered::ComputeShader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::clustered::ComputeShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::clustered::KeyComputeShader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::clustered::KeyComputeShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::pipeline::clustered::KeySortAndCompactShader

Warning

doxygenclass: Cannot find class “nTiled::pipeline::clustered::KeySortAndCompactShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

Pipeline Utility functionality

This section contains all supporting functions and classes for the Pipeline module. This includes the methods with which openGL programs are loaded and compiled, as well as the classes used internally to represent objects and lights.

PipelineUtil API
struct nTiled::pipeline::PipelineLight

Warning

doxygenstruct: Cannot find class “nTiled::pipeline::PipelineLight” in doxygen xml output for project “nTiled” from directory: doxyxml/

struct nTiled::pipeline::PipelineObject

Warning

doxygenstruct: Cannot find class “nTiled::pipeline::PipelineObject” in doxygen xml output for project “nTiled” from directory: doxyxml/

PipelineObject* nTiled::pipeline::constructQuad()

Warning

doxygenfunction: Cannot find function “nTiled::pipeline::constructQuad” in doxygen xml output for project “nTiled” from directory: doxyxml/

std::stringstream nTiled::pipeline::readShader()

Warning

doxygenfunction: Cannot find function “nTiled::pipeline::readShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

std::stringstream nTiled::pipeline::readShaderWithLights()

Warning

doxygenfunction: Cannot find function “nTiled::pipeline::readShaderWithLights” in doxygen xml output for project “nTiled” from directory: doxyxml/

GLuint nTiled::pipeline::compileShader()

Warning

doxygenfunction: Cannot find function “nTiled::pipeline::compileShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

GLuint nTiled::pipeline::createProgram()

Warning

doxygenfunction: Cannot find function “nTiled::pipeline::createProgram” in doxygen xml output for project “nTiled” from directory: doxyxml/

GLuint nTiled::pipeline::loadAndCompileShader()

Warning

doxygenfunction: Cannot find function “nTiled::pipeline::loadAndCompileShader” in doxygen xml output for project “nTiled” from directory: doxyxml/

GLuint nTiled::pipeline::createVertexFragmentProgram()

Warning

doxygenfunction: Cannot find function “nTiled::pipeline::createVertexFragmentProgram” in doxygen xml output for project “nTiled” from directory: doxyxml/

GLuint nTiled::pipeline::createComputeProgram()

Warning

doxygenfunction: Cannot find function “nTiled::pipeline::createComputeProgram” in doxygen xml output for project “nTiled” from directory: doxyxml/

GLuint nTiled::pipeline::loadTexturePNG()

Warning

doxygenfunction: Cannot find function “nTiled::pipeline::loadTexturePNG” in doxygen xml output for project “nTiled” from directory: doxyxml/

Debug Pipeline

Debug Pipeline module is part of the Pipeline module and provides the functionality to display a variety of PostProcessing effects in order to visualise the different algorithms used in Pipeline.

Debug API

Interfaces contains the Interfaces from which Forward and Deferred inherit. Forward contains all functionality relating to the Forward Pipeline, and deferred contains all the functionality relating to the Deferred Pipeline. LightManagement contains all functionality related to Tiled, Clustered and Hierarchical shading. Finally Debug contains the Debug functionality used to display additional information on top of the rendered scene.

State

The State module holds all classes and structs related to the state of a single run of nTiled.

The state itself does not contain any functions and merely serves as a datastructure on which each component of nTiled act.

It has been separeted in several sections in order to decrease coupling within nTiled.

State API
struct nTiled::state::State

Warning

doxygenstruct: Cannot find class “nTiled::state::State” in doxygen xml output for project “nTiled” from directory: doxyxml/

struct nTiled::state::Log

Warning

doxygenstruct: Cannot find class “nTiled::state::Log” in doxygen xml output for project “nTiled” from directory: doxyxml/

struct nTiled::state::Shading

Warning

doxygenstruct: Cannot find class “nTiled::state::Shading” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::state::TextureCatalog

Warning

doxygenclass: Cannot find class “nTiled::state::TextureCatalog” in doxygen xml output for project “nTiled” from directory: doxyxml/

struct nTiled::state::View

Warning

doxygenstruct: Cannot find class “nTiled::state::View” in doxygen xml output for project “nTiled” from directory: doxyxml/

struct nTiled::state::ViewOutput

Warning

doxygenstruct: Cannot find class “nTiled::state::ViewOutput” in doxygen xml output for project “nTiled” from directory: doxyxml/

_nTiled-state-OutputType:

enum class nTiled::state::OutputType

Warning

doxygenenum: Cannot find enum “nTiled::state::OutputType” in doxygen xml output for project “nTiled” from directory: doxyxml/

State* nTiled::state::constructStateFromJson()

Warning

doxygenfunction: Cannot find function “nTiled::state::constructStateFromJson” in doxygen xml output for project “nTiled” from directory: doxyxml/

void nTiled::state::parseLights()

Warning

doxygenfunction: Cannot find function “nTiled::state::parseLights” in doxygen xml output for project “nTiled” from directory: doxyxml/

void nTiled::state::parseGeometry()

Warning

doxygenfunction: Cannot find function “nTiled::state::parseGeometry” in doxygen xml output for project “nTiled” from directory: doxyxml/

std::vector<glm::mat4> nTiled::state::readCameraFrames()

Warning

doxygenfunction: Cannot find function “nTiled::state::readCameraFrames” in doxygen xml output for project “nTiled” from directory: doxyxml/

World

The World holds all data related to internal representation of the world within a nTiled execution. The meshes, objects, textures and lights can all be found within the world. as

World API
struct nTiled::world::Mesh

Warning

doxygenstruct: Cannot find class “nTiled::world::Mesh” in doxygen xml output for project “nTiled” from directory: doxyxml/

struct nTiled::world::Object

Warning

doxygenstruct: Cannot find class “nTiled::world::Object” in doxygen xml output for project “nTiled” from directory: doxyxml/

struct nTiled::world::PointLight

Warning

doxygenstruct: Cannot find class “nTiled::world::PointLight” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::world::LightConstructor

Warning

doxygenclass: Cannot find class “nTiled::world::LightConstructor” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::world::PointLightConstructor

Warning

doxygenclass: Cannot find class “nTiled::world::PointLightConstructor” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::world::PrimitiveConstructor

Warning

doxygenclass: Cannot find class “nTiled::world::PrimitiveConstructor” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::world::AssImpConstructor

Warning

doxygenclass: Cannot find class “nTiled::world::AssImpConstructor” in doxygen xml output for project “nTiled” from directory: doxyxml/

class nTiled::world::World

Warning

doxygenclass: Cannot find class “nTiled::world::World” in doxygen xml output for project “nTiled” from directory: doxyxml/

Indices and tables