Skip to content

Commit

Permalink
Merge pull request #2 from sergeyreznik/dev
Browse files Browse the repository at this point in the history
Developer Preview 02
  • Loading branch information
sergeyreznik authored Feb 20, 2022
2 parents 39906d6 + 05acf50 commit cde081e
Show file tree
Hide file tree
Showing 277 changed files with 165,107 additions and 1,259 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.exe
*.pdb
*.dll
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
project(etx-tracer)

cmake_minimum_required(VERSION 3.1)
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0074 NEW)
cmake_policy(SET CMP0091 NEW)

project(etx-tracer VERSION 0.0.1)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Physically-based GPU and CPU ray-tracer emerging on a surface.
* Volumetric Bidirectional Path Tracing integrator;
* Variety of BSDFs:
- basic materials - diffuse, plastic, conductor, dielectric;
- multiscattering materials - diffuse, conductor, dielectric;
- additionaal materials - thinfilm, translucent, coating, mirror, coating;
- generic PBR material (WIP);
* Variety of emitters:
* Variety of emitters:
- area;
- environment map;
- directional emitter with finite angluar size;
Expand Down Expand Up @@ -68,3 +69,4 @@ Links to the books/papers/publications/resources I've used during the developmen
- [PBRT book](https://www.pbr-book.org/)
- [VCM paper / implementation](https://cgg.mff.cuni.cz/~jaroslav/papers/2012-vcm/)
- [Rendering resources by Benedikt Bitterli](https://benedikt-bitterli.me/resources/)
- [Multiple-Scattering Microfacet BSDFs with the Smith Model](https://eheitzresearch.wordpress.com/240-2/)
16 changes: 8 additions & 8 deletions bin/assets/materials-showcase/materials-showcase-materials.mtl
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ material class translucent
Kd 0.395292 0.557676 0.8

newmtl curtain-bar
material class conductor
int_ior nickel
Pr 0.2
material class msconductor
int_ior osmium
Pr 0.3

newmtl emitter-left
emitter blackbody 12000.0 scale 0.00025 collimated 65536.0
Expand All @@ -50,29 +50,29 @@ Ks 0.04 0.04 0.04
Kd 0.131063 0.121089 0.113964

newmtl projector-holder
material class conductor
material class msconductor
int_ior chrome
Pr 0.5

newmtl projector-interior
material class mirror

newmtl torus-stand
material class conductor uroughness 0.5 vroughness 0.01
material class msconductor uroughness 0.5 vroughness 0.01
int_ior gold

newmtl torus.000
material class dielectric
material class msdielectric
int_ior sapphire
int_medium torus.000
Pr 0.0

newmtl torus.001
material class dielectric
material class msdielectric
int_ior diamond
Pr 0.1

newmtl torus.002
material class dielectric
material class msdielectric
int_ior glass
Pr 0.05
62 changes: 62 additions & 0 deletions bin/spectrum/brass.spd
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
0.3000 1.388 1.731
0.3100 1.419 1.764
0.3200 1.446 1.789
0.3300 1.473 1.807
0.3400 1.494 1.815
0.3500 1.504 1.815
0.3600 1.503 1.815
0.3700 1.497 1.818
0.3800 1.487 1.818
0.3900 1.471 1.813
0.4000 1.445 1.805
0.4100 1.405 1.794
0.4200 1.350 1.786
0.4300 1.278 1.784
0.4400 1.191 1.797
0.4500 1.094 1.829
0.4600 0.994 1.883
0.4700 0.900 1.957
0.4800 0.816 2.046
0.4900 0.745 2.145
0.5000 0.686 2.250
0.5100 0.639 2.358
0.5200 0.602 2.464
0.5300 0.573 2.568
0.5400 0.549 2.668
0.5500 0.527 2.765
0.5600 0.505 2.860
0.5700 0.484 2.958
0.5800 0.468 3.059
0.5900 0.460 3.159
0.6000 0.450 3.253
0.6100 0.452 3.345
0.6200 0.449 3.434
0.6300 0.445 3.522
0.6400 0.444 3.609
0.6500 0.444 3.695
0.6600 0.445 3.778
0.6700 0.444 3.860
0.6800 0.444 3.943
0.6900 0.445 4.025
0.7000 0.446 4.106
0.7100 0.448 4.186
0.7200 0.450 4.266
0.7300 0.452 4.346
0.7400 0.455 4.424
0.7500 0.457 4.501
0.7600 0.458 4.579
0.7700 0.460 4.657
0.7800 0.464 4.737
0.7900 0.469 4.814
0.8000 0.473 4.890
0.8100 0.478 4.965
0.8200 0.481 5.039
0.8300 0.483 5.115
0.8400 0.486 5.192
0.8500 0.490 5.269
0.8600 0.494 5.346
0.8700 0.500 5.423
0.8800 0.507 5.500
0.8900 0.515 5.575
0.9000 0.523 5.650

61 changes: 61 additions & 0 deletions bin/spectrum/bronze.spd
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
0.3000 1.453 1.449
0.3100 1.454 1.438
0.3200 1.437 1.424
0.3300 1.401 1.415
0.3400 1.350 1.420
0.3500 1.292 1.443
0.3600 1.238 1.483
0.3700 1.193 1.534
0.3800 1.156 1.587
0.3900 1.126 1.641
0.4000 1.098 1.693
0.4100 1.072 1.745
0.4200 1.047 1.796
0.4300 1.024 1.847
0.4400 1.002 1.897
0.4500 0.980 1.945
0.4600 0.959 1.990
0.4700 0.937 2.033
0.4800 0.912 2.073
0.4900 0.883 2.108
0.5000 0.846 2.140
0.5100 0.798 2.173
0.5200 0.738 2.211
0.5300 0.667 2.262
0.5400 0.592 2.329
0.5500 0.519 2.415
0.5600 0.457 2.516
0.5700 0.409 2.626
0.5800 0.377 2.739
0.5900 0.357 2.848
0.6000 0.346 2.950
0.6100 0.339 3.046
0.6200 0.333 3.137
0.6300 0.327 3.226
0.6400 0.323 3.312
0.6500 0.320 3.396
0.6600 0.317 3.478
0.6700 0.314 3.558
0.6800 0.311 3.638
0.6900 0.308 3.717
0.7000 0.306 3.795
0.7100 0.305 3.872
0.7200 0.304 3.947
0.7300 0.302 4.022
0.7400 0.300 4.097
0.7500 0.298 4.171
0.7600 0.296 4.245
0.7700 0.294 4.320
0.7800 0.293 4.394
0.7900 0.293 4.466
0.8000 0.291 4.537
0.8100 0.287 4.609
0.8200 0.283 4.682
0.8300 0.280 4.757
0.8400 0.279 4.833
0.8500 0.278 4.908
0.8600 0.279 4.983
0.8700 0.279 5.057
0.8800 0.280 5.133
0.8900 0.284 5.208
0.9000 0.289 5.280
39 changes: 39 additions & 0 deletions bin/spectrum/osmium.spd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
0.300 2.50 3.34
0.310 2.56 3.32
0.320 2.59 3.31
0.330 2.38 3.25
0.340 2.33 3.25
0.350 2.41 3.47
0.360 2.43 3.54
0.370 2.50 3.75
0.380 2.55 3.90
0.390 2.65 4.05
0.400 2.78 4.19
0.410 2.97 4.34
0.420 3.14 4.44
0.430 3.37 4.50
0.440 3.64 4.48
0.450 3.85 4.44
0.460 4.07 4.30
0.470 4.17 4.15
0.480 4.28 3.97
0.490 4.32 3.83
0.500 4.38 3.61
0.520 4.33 3.40
0.540 4.22 3.15
0.560 4.03 2.96
0.580 3.79 2.82
0.600 3.50 2.79
0.620 3.24 2.80
0.640 2.98 2.94
0.660 2.67 3.17
0.680 2.51 3.40
0.700 2.39 3.60
0.725 2.30 3.90
0.750 2.26 4.17
0.775 2.25 4.43
0.800 2.24 4.66
0.825 2.28 4.90
0.850 2.30 5.13
0.875 2.35 5.35
0.900 2.42 5.56
12 changes: 11 additions & 1 deletion docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,14 @@ These libraries are included into the source code in `thirdparty` folder:
- [tinyexr](https://github.com/syoyo/tinyexr) - Tiny OpenEXR image loader/saver library
- [tinyobjloader](https://github.com/tinyobjloader/tinyobjloader) - Tiny but powerful single file wavefront obj loader


### Building with OpenVDB
Optionally OpenVDB library could be used to load volumetric data stored in .vdb format.
Snapshot of [openvdb](https://github.com/AcademySoftwareFoundation/openvdb) included into the `thirdparty` folder.
For building it, please refer to the documentation. I was able to easily build it following the instructions (using vkpkg).
After installing all required libraries in vcpkg reconfigure and regenerate a project using CMake:
```
cmake -G "Visual Studio 17 2022"
-DCMAKE_TOOLCHAIN_FILE="(PATH_TO_VCPKG)/scripts/buildsystems/vcpkg.cmake"
-DWITH_OPENVDB=1 ..
```
The new option `WITH_OPENVDB=1` enables support for loading volumetric data from .vdb format.
9 changes: 8 additions & 1 deletion sources/etx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function(create_library folder)
etx_build_pack(${lib_name} "${CMAKE_CURRENT_LIST_DIR}/${folder}")

target_compile_options(${lib_name} PRIVATE "/Zl")
target_compile_options(${lib_name} PRIVATE -DNOMINMAX=1 -D_CRT_SECURE_NO_WARNINGS=1 -DWIN32_LEAN_AND_MEAN=1)
target_compile_options(${lib_name} PRIVATE -DNOMINMAX=1 -D_CRT_SECURE_NO_WARNINGS=1 -DWIN32_LEAN_AND_MEAN=1 -D_USE_MATH_DEFINES=1)

set_property(TARGET ${lib_name} PROPERTY FOLDER "etx")
set_property(TARGET ${lib_name} PROPERTY LINKER_LANGUAGE CXX)
Expand All @@ -58,7 +58,14 @@ create_library(render)
target_link_libraries(etx-render PRIVATE glm stb_image tinyexr tiny_obj_loader mikktspace enkiTS etx-core)
target_include_directories(etx-render PRIVATE ${JANSSON_INCLUDE_DIRS})

if (WITH_OPENVDB)
target_link_libraries(etx-render PUBLIC openvdb)
target_compile_definitions(etx-render PUBLIC -DETX_HAVE_OPENVDB=1)
endif()


find_package(embree 3.0 REQUIRED)

create_library(rt)
target_link_libraries(etx-rt PRIVATE glm embree etx-core etx-render)

21 changes: 21 additions & 0 deletions sources/etx/core/core.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,25 @@ std::string open_file(const std::vector<std::string>& filters) {
return GetOpenFileNameA(&of) ? of.lpstrFile : "";
}

std::string save_file(const std::vector<std::string>& filters) {
char name_buffer[MAX_PATH] = {};

size_t fp = 0;
char filter_buffer[2048] = {};
for (const std::string& w : filters) {
memcpy(filter_buffer + fp, w.data(), w.length());
fp += 1 + w.length();
}

OPENFILENAME of = {};
of.lStructSize = sizeof(of);
of.hInstance = GetModuleHandle(nullptr);
of.Flags = OFN_ENABLESIZING | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_OVERWRITEPROMPT;
of.lpstrFile = name_buffer;
of.nMaxFile = MAX_PATH;
of.lpstrFilter = filter_buffer;
of.nFilterIndex = filters.empty() ? 0 : 1;
return GetSaveFileName(&of) ? of.lpstrFile : "";
}

} // namespace etx
1 change: 1 addition & 0 deletions sources/etx/core/core.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ struct TimeMeasure {
};

std::string open_file(const std::vector<std::string>& filters);
std::string save_file(const std::vector<std::string>& filters);

} // namespace etx
10 changes: 5 additions & 5 deletions sources/etx/core/options.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@ bool Options::load_from_file(const char* filename) {
json_object_foreach(js, key, value) {
switch (json_typeof(value)) {
case JSON_STRING: {
set(key, std::string(json_string_value(value)));
add(key, std::string(json_string_value(value)));
break;
}
case JSON_INTEGER: {
set(uint32_t(json_integer_value(value)), key, std::string{});
add(uint32_t(json_integer_value(value)), key, std::string{});
break;
}
case JSON_REAL: {
set(float(json_real_value(value)), key, std::string{});
add(float(json_real_value(value)), key, std::string{});
break;
}
case JSON_TRUE: {
set(true, key, std::string{});
add(true, key, std::string{});
break;
}
case JSON_FALSE: {
set(false, key, std::string{});
add(false, key, std::string{});
break;
}
default:
Expand Down
Loading

0 comments on commit cde081e

Please sign in to comment.