Skip to content

Commit

Permalink
AO Integrator
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-van-bergen committed Jan 28, 2022
1 parent da87b52 commit 2fd07ca
Show file tree
Hide file tree
Showing 59 changed files with 3,469 additions and 527 deletions.
40 changes: 22 additions & 18 deletions Pathtracer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NOMINMAX;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<AdditionalIncludeDirectories>Src;.\include;$(CUDA_PATH)\include</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
Expand Down Expand Up @@ -173,7 +173,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NOMINMAX;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>false</ConformanceMode>
<AdditionalIncludeDirectories>Src;.\include;$(CUDA_PATH)\include</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
Expand Down Expand Up @@ -235,12 +235,14 @@
<ClCompile Include="Src\Main.cpp" />
<ClCompile Include="Src\Math\AABB.cpp" />
<ClCompile Include="Src\Math\Mipmap.cpp" />
<ClCompile Include="Src\Pathtracer\Camera.cpp" />
<ClCompile Include="Src\Pathtracer\Mesh.cpp" />
<ClCompile Include="Src\Pathtracer\Pathtracer.cpp" />
<ClCompile Include="Src\Pathtracer\Scene.cpp" />
<ClCompile Include="Src\Pathtracer\Sky.cpp" />
<ClCompile Include="Src\Pathtracer\Texture.cpp" />
<ClCompile Include="Src\Renderer\Camera.cpp" />
<ClCompile Include="Src\Renderer\Integrators\AO.cpp" />
<ClCompile Include="Src\Renderer\Integrators\Integrator.cpp" />
<ClCompile Include="Src\Renderer\Integrators\Pathtracer.cpp" />
<ClCompile Include="Src\Renderer\Mesh.cpp" />
<ClCompile Include="Src\Renderer\Scene.cpp" />
<ClCompile Include="Src\Renderer\Sky.cpp" />
<ClCompile Include="Src\Renderer\Texture.cpp" />
<ClCompile Include="Src\Util\BlueNoise.cpp" />
<ClCompile Include="Src\Util\Geometry.cpp" />
<ClCompile Include="Src\Util\PerfTest.cpp" />
Expand Down Expand Up @@ -306,16 +308,18 @@
<ClInclude Include="Src\Math\Vector2.h" />
<ClInclude Include="Src\Math\Vector3.h" />
<ClInclude Include="Src\Math\Vector4.h" />
<ClInclude Include="Src\Pathtracer\Camera.h" />
<ClInclude Include="Src\Pathtracer\Material.h" />
<ClInclude Include="Src\Pathtracer\Medium.h" />
<ClInclude Include="Src\Pathtracer\Mesh.h" />
<ClInclude Include="Src\Pathtracer\MeshData.h" />
<ClInclude Include="Src\Pathtracer\Pathtracer.h" />
<ClInclude Include="Src\Pathtracer\Scene.h" />
<ClInclude Include="Src\Pathtracer\Sky.h" />
<ClInclude Include="Src\Pathtracer\Texture.h" />
<ClInclude Include="Src\Pathtracer\Triangle.h" />
<ClInclude Include="Src\Renderer\Camera.h" />
<ClInclude Include="Src\Renderer\Integrators\AO.h" />
<ClInclude Include="Src\Renderer\Integrators\Integrator.h" />
<ClInclude Include="Src\Renderer\Integrators\Pathtracer.h" />
<ClInclude Include="Src\Renderer\Material.h" />
<ClInclude Include="Src\Renderer\Medium.h" />
<ClInclude Include="Src\Renderer\Mesh.h" />
<ClInclude Include="Src\Renderer\MeshData.h" />
<ClInclude Include="Src\Renderer\Scene.h" />
<ClInclude Include="Src\Renderer\Sky.h" />
<ClInclude Include="Src\Renderer\Texture.h" />
<ClInclude Include="Src\Renderer\Triangle.h" />
<ClInclude Include="Src\Util\BlueNoise.h" />
<ClInclude Include="Src\Util\Geometry.h" />
<ClInclude Include="Src\Util\PerfTest.h" />
Expand Down
117 changes: 66 additions & 51 deletions Pathtracer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,6 @@
<ClCompile Include="Src\BVH\Builders\SBVHBuilder.cpp">
<Filter>BVH\Builders</Filter>
</ClCompile>
<ClCompile Include="Src\Pathtracer\Camera.cpp">
<Filter>Pathtracer</Filter>
</ClCompile>
<ClCompile Include="Src\Pathtracer\Mesh.cpp">
<Filter>Pathtracer</Filter>
</ClCompile>
<ClCompile Include="Src\Pathtracer\Pathtracer.cpp">
<Filter>Pathtracer</Filter>
</ClCompile>
<ClCompile Include="Src\Pathtracer\Scene.cpp">
<Filter>Pathtracer</Filter>
</ClCompile>
<ClCompile Include="Src\Pathtracer\Sky.cpp">
<Filter>Pathtracer</Filter>
</ClCompile>
<ClCompile Include="Src\Util\PerfTest.cpp">
<Filter>Util</Filter>
</ClCompile>
Expand Down Expand Up @@ -82,9 +67,6 @@
<ClCompile Include="Src\Assets\Mitsuba\MitshairLoader.cpp">
<Filter>Assets\Mitsuba</Filter>
</ClCompile>
<ClCompile Include="Src\Pathtracer\Texture.cpp">
<Filter>Pathtracer</Filter>
</ClCompile>
<ClCompile Include="Src\Device\CUDAMemory.cpp">
<Filter>Device</Filter>
</ClCompile>
Expand Down Expand Up @@ -149,6 +131,30 @@
<ClCompile Include="Src\Exporters\EXRExporter.cpp">
<Filter>Exporters</Filter>
</ClCompile>
<ClCompile Include="Src\Renderer\Scene.cpp">
<Filter>Renderer</Filter>
</ClCompile>
<ClCompile Include="Src\Renderer\Sky.cpp">
<Filter>Renderer</Filter>
</ClCompile>
<ClCompile Include="Src\Renderer\Texture.cpp">
<Filter>Renderer</Filter>
</ClCompile>
<ClCompile Include="Src\Renderer\Camera.cpp">
<Filter>Renderer</Filter>
</ClCompile>
<ClCompile Include="Src\Renderer\Mesh.cpp">
<Filter>Renderer</Filter>
</ClCompile>
<ClCompile Include="Src\Renderer\Integrators\Pathtracer.cpp">
<Filter>Renderer\Integrators</Filter>
</ClCompile>
<ClCompile Include="Src\Renderer\Integrators\AO.cpp">
<Filter>Renderer\Integrators</Filter>
</ClCompile>
<ClCompile Include="Src\Renderer\Integrators\Integrator.cpp">
<Filter>Renderer\Integrators</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="Math">
Expand All @@ -160,9 +166,6 @@
<Filter Include="BVH">
<UniqueIdentifier>{ebb62919-8744-439d-9578-09dfe535ab82}</UniqueIdentifier>
</Filter>
<Filter Include="Pathtracer">
<UniqueIdentifier>{294a8797-60a4-4a69-b01a-7c9af82a64c9}</UniqueIdentifier>
</Filter>
<Filter Include="Assets">
<UniqueIdentifier>{6f3338e2-ac89-4452-8dcb-2d4fb9144c6e}</UniqueIdentifier>
</Filter>
Expand All @@ -187,6 +190,12 @@
<Filter Include="Exporters">
<UniqueIdentifier>{fa13993b-69d4-460f-84c1-41572d053ea4}</UniqueIdentifier>
</Filter>
<Filter Include="Renderer">
<UniqueIdentifier>{294a8797-60a4-4a69-b01a-7c9af82a64c9}</UniqueIdentifier>
</Filter>
<Filter Include="Renderer\Integrators">
<UniqueIdentifier>{19bb3711-1af8-4298-89b6-e719d008a79f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Src\Assets\OBJLoader.h">
Expand Down Expand Up @@ -219,24 +228,6 @@
<ClInclude Include="Src\Math\Vector4.h">
<Filter>Math</Filter>
</ClInclude>
<ClInclude Include="Src\Pathtracer\Camera.h">
<Filter>Pathtracer</Filter>
</ClInclude>
<ClInclude Include="Src\Pathtracer\Mesh.h">
<Filter>Pathtracer</Filter>
</ClInclude>
<ClInclude Include="Src\Pathtracer\Pathtracer.h">
<Filter>Pathtracer</Filter>
</ClInclude>
<ClInclude Include="Src\Pathtracer\Scene.h">
<Filter>Pathtracer</Filter>
</ClInclude>
<ClInclude Include="Src\Pathtracer\Sky.h">
<Filter>Pathtracer</Filter>
</ClInclude>
<ClInclude Include="Src\Pathtracer\Triangle.h">
<Filter>Pathtracer</Filter>
</ClInclude>
<ClInclude Include="Src\Util\PerfTest.h">
<Filter>Util</Filter>
</ClInclude>
Expand Down Expand Up @@ -297,18 +288,6 @@
<ClInclude Include="Src\Assets\Mitsuba\MitshairLoader.h">
<Filter>Assets\Mitsuba</Filter>
</ClInclude>
<ClInclude Include="Src\Pathtracer\Texture.h">
<Filter>Pathtracer</Filter>
</ClInclude>
<ClInclude Include="Src\Pathtracer\Material.h">
<Filter>Pathtracer</Filter>
</ClInclude>
<ClInclude Include="Src\Pathtracer\Medium.h">
<Filter>Pathtracer</Filter>
</ClInclude>
<ClInclude Include="Src\Pathtracer\MeshData.h">
<Filter>Pathtracer</Filter>
</ClInclude>
<ClInclude Include="Src\Device\CUDAEvent.h">
<Filter>Device</Filter>
</ClInclude>
Expand Down Expand Up @@ -403,5 +382,41 @@
<ClInclude Include="Src\Core\Sort.h">
<Filter>Core</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\Scene.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\Sky.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\Texture.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\Triangle.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\Camera.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\Material.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\Medium.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\Mesh.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\MeshData.h">
<Filter>Renderer</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\Integrators\Integrator.h">
<Filter>Renderer\Integrators</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\Integrators\Pathtracer.h">
<Filter>Renderer\Integrators</Filter>
</ClInclude>
<ClInclude Include="Src\Renderer\Integrators\AO.h">
<Filter>Renderer\Integrators</Filter>
</ClInclude>
</ItemGroup>
</Project>
13 changes: 12 additions & 1 deletion Src/Args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ static void parse_args(const Array<StringView> & args) {
};

static Array<Option> options = {
Option { "I"_sv, "integrator"_sv, "Choose the interagor type. Supported options: pathtracer, ao"_sv, 1, [](const Array<StringView> & args, size_t i) {
if (args[i + 1] == "pathtracer") {
cpu_config.integrator = IntegratorType::PATHTRACER;
} else if (args[i + 1] == "ao") {
cpu_config.integrator = IntegratorType::AO;
} else {
IO::print("'{}' is not a recognized integrator type! Supported options: pathtracer, ao\n"_sv, args[i + 1]);
IO::exit(1);
}
} },

Option { "W"_sv, "width"_sv, "Sets the width of the window"_sv, 1, [](const Array<StringView> & args, size_t i) { cpu_config.initial_width = parse_arg_int(args[i + 1]); } },
Option { "H"_sv, "height"_sv, "Sets the height of the window"_sv, 1, [](const Array<StringView> & args, size_t i) { cpu_config.initial_height = parse_arg_int(args[i + 1]); } },
Option { "b"_sv, "bounce"_sv, "Sets the number of pathtracing bounces"_sv, 1, [](const Array<StringView> & args, size_t i) { gpu_config.num_bounces = Math::clamp(parse_arg_int(args[i + 1]), 0, MAX_BOUNCES - 1); } },
Expand All @@ -55,7 +66,7 @@ static void parse_args(const Array<StringView> & args) {
Option { "s"_sv, "scene"_sv, "Sets path to scene file. Supported formats: Mitsuba XML, OBJ, and PLY"_sv, 1, [](const Array<StringView> & args, size_t i) { cpu_config.scene_filenames.push_back(args[i + 1]); } },
Option { "S"_sv, "sky"_sv, "Sets path to sky file. Supported formats: HDR"_sv, 1, [](const Array<StringView> & args, size_t i) { cpu_config.sky_filename = args[i + 1]; } },

Option { "b"_sv, "bvh"_sv, "Sets type of BLAS BVH used: Supported options: sah, sbvh, bvh4, bvh8"_sv, 1, [](const Array<StringView> & args, size_t i) {
Option { "b"_sv, "bvh"_sv, "Sets type of BLAS BVH used. Supported options: sah, sbvh, bvh4, bvh8"_sv, 1, [](const Array<StringView> & args, size_t i) {
if (args[i + 1] == "sah") {
cpu_config.bvh_type = BVHType::BVH;
} else if (args[i + 1] == "sbvh") {
Expand Down
8 changes: 4 additions & 4 deletions Src/Assets/AssetManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#include "Core/Mutex.h"
#include "Core/OwnPtr.h"

#include "Pathtracer/MeshData.h"
#include "Pathtracer/Material.h"
#include "Pathtracer/Medium.h"
#include "Pathtracer/Texture.h"
#include "Renderer/MeshData.h"
#include "Renderer/Material.h"
#include "Renderer/Medium.h"
#include "Renderer/Texture.h"

#include "BVHLoader.h"
#include "BVH/BVHCollapser.h"
Expand Down
2 changes: 1 addition & 1 deletion Src/Assets/BVHLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "Core/StringView.h"

#include "BVH/BVH.h"
#include "Pathtracer/MeshData.h"
#include "Renderer/MeshData.h"

namespace BVHLoader {
inline constexpr const char * BVH_FILE_EXTENSION = ".bvh";
Expand Down
2 changes: 1 addition & 1 deletion Src/Assets/Mitsuba/MitshairLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "Math/Quaternion.h"

#include "Pathtracer/Triangle.h"
#include "Renderer/Triangle.h"

Array<Triangle> MitshairLoader::load(const String & filename, SourceLocation location_in_mitsuba_file, float radius) {
String file = IO::file_read(filename);
Expand Down
4 changes: 2 additions & 2 deletions Src/Assets/Mitsuba/MitsubaLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "Assets/OBJLoader.h"
#include "Assets/PLYLoader.h"

#include "Pathtracer/Scene.h"
#include "Pathtracer/MeshData.h"
#include "Renderer/Scene.h"
#include "Renderer/MeshData.h"

#include "Util/Util.h"
#include "Util/Geometry.h"
Expand Down
2 changes: 1 addition & 1 deletion Src/Assets/Mitsuba/SerializedLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <miniz/miniz.h>

#include "Pathtracer/Triangle.h"
#include "Renderer/Triangle.h"

#include "XMLParser.h"

Expand Down
2 changes: 1 addition & 1 deletion Src/Assets/OBJLoader.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "Pathtracer/Triangle.h"
#include "Renderer/Triangle.h"

#include "Core/String.h"

Expand Down
2 changes: 1 addition & 1 deletion Src/Assets/PLYLoader.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "Pathtracer/Triangle.h"
#include "Renderer/Triangle.h"

#include "Core/Array.h"
#include "Core/String.h"
Expand Down
2 changes: 1 addition & 1 deletion Src/Assets/TextureLoader.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "Core/StringView.h"

#include "Pathtracer/Texture.h"
#include "Renderer/Texture.h"

namespace TextureLoader {
bool load_dds(const String & filename, Texture & texture);
Expand Down
2 changes: 1 addition & 1 deletion Src/BVH/BVH.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "Config.h"

#include "Pathtracer/Triangle.h"
#include "Renderer/Triangle.h"

#include "Core/Array.h"
#include "Core/OwnPtr.h"
Expand Down
4 changes: 2 additions & 2 deletions Src/BVH/Builders/BVHPartitions.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "BVHPartitions.h"

#include "Pathtracer/Mesh.h"
#include "Pathtracer/Triangle.h"
#include "Renderer/Mesh.h"
#include "Renderer/Triangle.h"

// Evaluates SAH for every object for every dimension to determine splitting candidate
template<typename GetAABB>
Expand Down
2 changes: 1 addition & 1 deletion Src/BVH/Builders/SAHBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "BVH/BVH.h"
#include "BVHPartitions.h"

#include "Pathtracer/Mesh.h"
#include "Renderer/Mesh.h"

template<typename Primitive>
static void build_bvh_recursive(SAHBuilder & builder, BVHNode2 & node, const Array<Primitive> & primitives, int * indices[3], int first_index, int index_count) {
Expand Down
Loading

0 comments on commit 2fd07ca

Please sign in to comment.