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
bystd::vector
(prevents the potential for memory leaks) - Replace C math calls by their C++ equivalent (e.g.
std::sqrt
instead ofsqrtf
) - No more
using namespace
- Add all code to
ltc
namespace
- Replace
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.
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" ../
The project can be either added to a CMake project using add_subdirectory
or using find_package
.
This repository contains an (evolving) reference implementation for the following publications:
- Real-Time Polygonal-Light Shading with Linearly Transformed Cosines (2016)
- Real-Time Area Lighting: a Journey From Research to Production (2016)
- Linear-Light Shading with Linearly Transformed Cosines (2017)
- Real-Time Line- and Disk-Light Shading (2017)
- 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.