# Sampling Clear Sky Models using Truncated Gaussian Mixtures
# Authors: Vitsas Nick, Vardis Konstantinos, Papaioannou Georgios

This folder contains datasets, source code for the reproduction of the paper and screenshots that could not be included in the paper due to paper size constraints.
The folders are:
- cpp_sky_gen_code, contains C++ source code for the generation of radiance and luminance maps for the Hosek and Preetham models. See README.txt for the compilation of the tool. A compiled executable is also provided for convenience.
- dataset, contains a subset of the dataset for the Hosek and Preetham sky models
- pbrt, containing the PBRT-v3 code for plugging in the tGMM source code
- python_fitting_code, encompassing the Python 3 source code for the fitting process and visualisation utilities
- screenshots, including all rendered images that were included in the paper plus additional ones, for reference. The file naming convention is: <model>_<elevation>_<turbidity>_<spp>_<sampling_method>_<importance_sampling>. For example: barcelona-pavilion_23_4_4_gmm_mis, elevation: 23, turbidity: 4, spp: 4, Sampling method: tGMM, MIS enabled: Yes. To reduce content size, files have been converted to PNG format.

-----Sky Maps-----
To generate sky maps and dataset, Go to cpp_sky_gen_code and run:
SunSky.exe -s Hosek -p    (for Hosek)
SunSky.exe -s Preetham -p (for Preetham)

Note that the luminance dataset can also be generated using Python

-----Python-----
To run the scripts that generate the dataset and perform the fitting process, go to the python_fitting_code\skymodel folder and run main.py.

To generate luminance sky maps: 
python main.py --generateDataset ..\..\dataset\hosek\hosek_sky ..\..\dataset\hosek\hosek_sky_luminance

To run the fitting process (output at fit\model.csv):
python main.py --fit --skymapdir ..\..\dataset\hosek\hosek_sky_luminance --outdir fit

------PBRT------
Simply replace the files in the pbrt source code directory. The important files are: 
- infinite_gmm, containing the tGMM infinite light implementation
- infinite_uniform, containing the naive uniform sampling for comparison purposes

The contents of this archive are licensed under the following license:

Copyright 2021 Computer Graphics Group, Athens University of Economics and Business

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.