Skip to content

Code for "Real-Time Polygonal-Light Shading with Linearly Transformed Cosines"

License

Notifications You must be signed in to change notification settings

mathijs727/ltc_code

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linearly Transformed Cosines

This is a fork of the original LTC code base by selfshadow with various improvements:

  • CMake build system
  • Dependency management with vcpkg package manager
  • Code split into a separate library and executable to make integration into existing projects easier
  • Parallelized code for significantly reduced fitting time
  • Modernize code base in a few places (needs some more work)
    • Replace new/delete by std::vector (prevents the potential for memory leaks)
    • Replace C math calls by their C++ equivalent (e.g. std::sqrt instead of sqrtf)
    • No more using namespace
    • Add all code to ltc namespace

Building (Windows)

Install vcpkg (see getting started) in any directory on your file system. This folder does not have to be in the project directory.

cd PATH_WHERE_YOU_WANT_VCPKG
git clone https://github.com/Microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
vcpkg integrate install

You can now open the ltc_code folder with Visual Studio using the "Open a local folder" button on the start page; or FILE => Open => CMake. Visual Studio will automatically invoke CMake and use vcpkg to install the dependencies.

Building (Linux)

Install vcpkg (see getting started) in any directory on your file system. This folder does not have to be in the project directory.

cd PATH_WHERE_YOU_WANT_VCPKG
git clone https://github.com/Microsoft/vcpkg.git
./vcpkg\bootstrap-vcpkg.sh

To build the project, create a build directory and pass the path to the CMake toolchain file provided by vcpkg:

cd PATH_TO_LTC_CODE
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE="PATH_WHERE_YOU_WANT_VCPKG/vcpkg/scripts/buildsystems/vcpkg.cmake" ../

Project Integration

The project can be either added to a CMake project using add_subdirectory or using find_package.

Overview

This repository contains an (evolving) reference implementation for the following publications:

Notes:

  • The Linearly Transformed Cosine (LTC) tables in this implementation differ in their parameterisation and storage compared to the original paper. See fitting code and WebGL demos for details.

WebGL Demos

Quad lights
Line lights
Disk lights

About

Code for "Real-Time Polygonal-Light Shading with Linearly Transformed Cosines"

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 70.4%
  • HTML 12.9%
  • C++ 8.2%
  • GLSL 6.9%
  • CSS 1.2%
  • CMake 0.4%