Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/TeamWisp/WispRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
VZout committed May 6, 2019
2 parents db7013f + 9f116ba commit 40ce139
Show file tree
Hide file tree
Showing 64 changed files with 522 additions and 525 deletions.
112 changes: 109 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,109 @@
# Procedural-Ray-Tracing
Repository for our Procedural Ray Tracing project, made by Y3 students at Breda University of Applied Science (former NHTV)
More information: [Wiki](https://teamwisp.github.io/)
# [<img src="http://upload.vzout.com/wisp/logo.png" width="40"> WispRenderer](https://teamwisp.github.io) - Real-Time Raytracing Renderer

[![Release](https://img.shields.io/github/release/TeamWisp/WispRenderer.svg)](https://github.com/TeamWisp/WispRenderer/releases)
[![Issues](https://img.shields.io/github/issues/TeamWisp/WispRenderer.svg)](https://github.com/TeamWisp/WispRenderer/issues)
[![License](https://img.shields.io/badge/license-EPL%202.0-red.svg)](https://opensource.org/licenses/EPL-2.0)
[![Discord](https://img.shields.io/discord/486967125504688128.svg?color=blueviolet&label=Discord)](https://discord.gg/Q3vDfqR)
[![Twitter](https://img.shields.io/twitter/follow/wisprenderer.svg?style=social)](https://twitter.com/wisprenderer)
![](https://img.shields.io/github/stars/TeamWisp/WispRenderer.svg?style=social)

## [What is it?](https://teamwisp.github.io/product/)

Wisp is a general purpose high level rendering library. Specially made for real time raytracing with NVIDIA RTX graphics cards. Made by a group of students from [Breda University of Applied Sciences](https://www.buas.nl/) specializing in graphics programming.

**Features**

* Physically Based Rendering
* Ray Traced Global Illumination
* Path Traced Global Illumination
* Ray Traced Ambient Occlusion
* Ray Traced Reflections
* Ray Traced Shadows
* Translucency & Transparency.
* NVIDIA's HBAO+
* NVIDIA's AnselSDK

**Suprted Rendering Backends**

* DirectX 12

**Supported Platforms**

* Windows 10 (Version 1903)

**Supported Compilers**

* Visual Studio 2017
* Visual Studio 2019


## [Installation](https://teamwisp.github.io/workspace_setup/)

### Installer

```
git clone https://github.com/TeamWisp/WispRenderer.git
```

Then run `installer.exe` located in the new `WispRenderer` folder and follow the on-screen prompts. When finished you can find the `.sln` file in the `build_vs2019_win64` folder.


### Manual

```
git clone https://github.com/TeamWisp/WispRenderer.git
cd WispRenderer
mkdir build
cd build
cmake -G "Visual Studio 16 2019" ..
```

Now you can run the `.sln` file inside the `build` folder. Want to use NVIDIA Gameworks? See the [advanced documation](https://teamwisp.github.io/workspace_setup/).

# [Documentation](https://teamwisp.github.io/)

# [Example](https://github.com/TeamWisp/WispRenderer/tree/master/demo)

# [Getting Involved](https://teamwisp.github.io/)

Want to help us out? That's definatly possible! Check out our [contribution page](https://teamwisp.github.io/) on how.

# [Development Blog](https://teamwisp.github.io/WispBlog/)

# [Discord](https://discord.gg/Q3vDfqR)

Need help, want to get updates as soon as they happen or just want a chat? Join our [Discord Server](https://discord.gg/Q3vDfqR)!

## Trailer

<a href="http://www.youtube.com/watch?feature=player_embedded&v=JsqF1jyyz2M"
target="_blank"><img src="http://img.youtube.com/vi/JsqF1jyyz2M/0.jpg"
alt="Torque 6 Material Editor" border="0" /></a>

## Media

<img src="http://upload.vzout.com/wisp/sponza.png" width="300"> <img src="http://upload.vzout.com/wisp/sun_temple.jpg" width="300">

## [License (Eclipse Public License version 2.0)](https://opensource.org/licenses/EPL-2.0)

<a href="https://opensource.org/licenses/EPL-2.0" target="_blank">
<img align="right" src="http://opensource.org/trademarks/opensource/OSI-Approved-License-100x137.png">
</a>

```
Copyright 2018-2019 Breda University of Applied Sciences
If a Contributor Distributes the Program in any form, then:
a) the Program must also be made available as Source Code, in accordance with section 3.2, and the Contributor must accompany the Program with a statement that the Source Code for the Program is available under this Agreement, and informs Recipients how to obtain it in a reasonable manner on or through a medium customarily used for software exchange; and
b) the Contributor may Distribute the Program under a license different than this Agreement, provided that such license:
i) effectively disclaims on behalf of all other Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
ii) effectively excludes on behalf of all other Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
iii) does not attempt to limit or alter the recipients' rights in the Source Code under section 3.2; and
iv) requires any subsequent distribution of the Program by any party to be under a license that satisfies the requirements of this section 3.
When the Program is Distributed as Source Code:
a) it must be made available under this Agreement, or if the Program (i) is combined with other material in a separate file or files made available under a Secondary License, and (ii) the initial Contributor attached to the Source Code the notice described in Exhibit A of this Agreement, then the Program may be made available under the terms of such Secondary Licenses, and
b) a copy of this Agreement must be included with each copy of the Program.
Contributors may not remove or alter any copyright, patent, trademark, attribution notices, disclaimers of warranty, or limitations of liability (‘notices’) contained within the Program from any copy of the Program which they Distribute, provided that Contributors may add their own appropriate notices.
```
8 changes: 4 additions & 4 deletions demo/debug_camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ class DebugCamera : public wr::CameraNode
{
public:
DebugCamera(float fov, float aspect_ratio)
: wr::CameraNode(fov, aspect_ratio), m_forward_axis(0), m_right_axis(0), m_up_axis(0), m_rmb_down(false), m_speed(1), m_sensitivity(0.01), m_position_lerp_speed(10.f), m_rotation_lerp_speed(5.f)
: wr::CameraNode(aspect_ratio), m_forward_axis(0), m_right_axis(0), m_up_axis(0), m_rmb_down(false), m_speed(1), m_sensitivity(0.01), m_position_lerp_speed(10.f), m_rotation_lerp_speed(5.f)
{
GetCursorPos(&m_last_cursor_pos);
m_target_rotation_radians = m_rotation_radians;
m_target_position = m_position;
}

//Takes roll, pitch and yaw and converts it to quaternion
virtual void SetRotation(DirectX::XMVECTOR roll_pitch_yaw) override
void SetRotation(DirectX::XMVECTOR roll_pitch_yaw) override
{
m_rotation_radians = roll_pitch_yaw;
m_use_quaternion = false;
m_target_rotation_radians = roll_pitch_yaw;
}

//Sets position
virtual void SetPosition(DirectX::XMVECTOR position) override
void SetPosition(DirectX::XMVECTOR position) override
{
m_position = position;
m_target_position = position;
Expand Down Expand Up @@ -61,7 +61,7 @@ class DebugCamera : public wr::CameraNode
m_target_position = DirectX::XMVectorAdd(m_target_position, DirectX::XMVectorScale(right, delta * m_speed * m_right_axis));

// Rotation
DirectX::XMVECTOR new_rot{ cursor_pos.y - m_last_cursor_pos.y, cursor_pos.x - m_last_cursor_pos.x };
DirectX::XMVECTOR new_rot{ static_cast<float>(cursor_pos.y - m_last_cursor_pos.y), static_cast<float>(cursor_pos.x - m_last_cursor_pos.x) };
SetRotation(DirectX::XMVectorSubtract(m_target_rotation_radians, DirectX::XMVectorScale(new_rot, m_sensitivity)));
}
else
Expand Down
6 changes: 3 additions & 3 deletions demo/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void RenderEditor(ImTextureID output)
engine::RenderEngine(output, render_system.get(), scene_graph.get());
}

void ShaderDirChangeDetected(std::string path, util::FileWatcher::FileStatus status)
void ShaderDirChangeDetected(std::string const & path, util::FileWatcher::FileStatus status)
{
auto& registry = wr::PipelineRegistry::Get();
auto& rt_registry = wr::RTPipelineRegistry::Get();
Expand Down Expand Up @@ -162,14 +162,14 @@ int WispEntry()

render_system->InitSceneGraph(*scene_graph.get());

fg_manager::Setup(*render_system.get(), &RenderEditor);
fg_manager::Setup(*render_system, &RenderEditor);

window->SetResizeCallback([&](std::uint32_t width, std::uint32_t height)
{
render_system->WaitForAllPreviousWork();
render_system->Resize(width, height);
SCENE::camera->SetAspectRatio((float)width / (float)height);
fg_manager::Resize(*render_system.get(), width, height);
fg_manager::Resize(*render_system, width, height);
});

auto file_watcher = new util::FileWatcher("resources/shaders", std::chrono::milliseconds(100));
Expand Down
8 changes: 4 additions & 4 deletions demo/demo_frame_graphs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
namespace fg_manager
{

enum class PrebuildFrameGraph
enum class PrebuildFrameGraph : std::uint32_t
{
DEFERRED = 0,
RT_HYBRID = 1,
Expand Down Expand Up @@ -57,7 +57,7 @@ namespace fg_manager
static PrebuildFrameGraph current = fg_manager::PrebuildFrameGraph::DEFERRED;
static std::array<wr::FrameGraph*, 4> frame_graphs = {};

inline void Setup(wr::RenderSystem& rs, util::Delegate<void(ImTextureID)> imgui_func)
inline void Setup(wr::RenderSystem& rs, util::Delegate<void(ImTextureID)> const & imgui_func)
{
// Raytracing
{
Expand Down Expand Up @@ -240,12 +240,12 @@ namespace fg_manager

inline void Next()
{
current = (PrebuildFrameGraph)(((int)current + 1) % frame_graphs.size());
current = (PrebuildFrameGraph)((static_cast<std::uint32_t>(current) + 1ull) % frame_graphs.size());
}

inline void Prev()
{
current = (PrebuildFrameGraph)(((int)current - 1) % frame_graphs.size());
current = (PrebuildFrameGraph)((static_cast<std::uint32_t>(current) - 1ull) % frame_graphs.size());
}

inline void Set(PrebuildFrameGraph value)
Expand Down
49 changes: 5 additions & 44 deletions demo/scene_emibl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace emibl_scene

static wr::Model* cube_model;
static wr::Model* plane_model;
static wr::Model* test_model;
static wr::Model* material_knob;

static wr::MaterialHandle rusty_metal_material;
Expand All @@ -30,18 +29,12 @@ namespace emibl_scene

static wr::TextureHandle equirectangular_environment_map;

static wr::TextureHandle flat_normal;

void CreateResources(wr::RenderSystem* render_system)
{
texture_pool = render_system->CreateTexturePool();
material_pool = render_system->CreateMaterialPool(256);

// Load Texture.
wr::TextureHandle white = texture_pool->LoadFromFile("resources/materials/white.png", false, true);
wr::TextureHandle black = texture_pool->LoadFromFile("resources/materials/black.png", false, true);
flat_normal = texture_pool->LoadFromFile("resources/materials/flat_normal.png", false, true);

wr::TextureHandle metal_splotchy_albedo = texture_pool->LoadFromFile("resources/materials/metal-splotchy-albedo.png", true, true);
wr::TextureHandle metal_splotchy_normal = texture_pool->LoadFromFile("resources/materials/metal-splotchy-normal-dx.png", false, true);
wr::TextureHandle metal_splotchy_roughness = texture_pool->LoadFromFile("resources/materials/metal-splotchy-rough.png", false, true);
Expand Down Expand Up @@ -232,8 +225,6 @@ namespace emibl_scene

{
{
test_model = model_pool->LoadWithMaterials<wr::VertexColor>(material_pool.get(), texture_pool.get(), "resources/models/xbot.fbx");

cube_model = model_pool->Load<wr::VertexColor>(material_pool.get(), texture_pool.get(), "resources/models/cube.fbx");
for (auto& m : cube_model->m_meshes)
{
Expand All @@ -257,23 +248,18 @@ namespace emibl_scene
model_pool.reset();
texture_pool.reset();
material_pool.reset();
};

}
}


static std::shared_ptr<DebugCamera> camera;
static std::shared_ptr<wr::LightNode> directional_light_node;
static std::shared_ptr<wr::MeshNode> test_model;
static std::shared_ptr<wr::MeshNode> cube_node;
static float t = 0;
static float lerp_t = 0.0f;

std::shared_ptr<wr::MeshNode> models[10];
std::shared_ptr<wr::MeshNode> platforms[10];

static DirectX::XMVECTOR camera_start_pos = { 500.0f, 60.0f, 260.0f };
static DirectX::XMVECTOR camera_end_pos = { -500.0f, 60.0f, 260.0f };


void CreateScene(wr::SceneGraph* scene_graph, wr::Window* window)
Expand Down Expand Up @@ -328,10 +314,9 @@ namespace emibl_scene
models[0]->SetPosition({ +500, 0 , 160 });
platforms[0]->SetPosition({ +500, -3 , 160 });

for (uint32_t i = 0; i < 10; ++i)
for (auto& model : models)
{
//models[i]->SetScale({ 0.5f, 0.5f, 0.5f });
models[i]->SetRotation({ 90_deg, 0, 0 });
model->SetRotation({ 90_deg, 0, 0 });
}

directional_light_node = scene_graph->CreateChild<wr::LightNode>(nullptr, wr::LightType::DIRECTIONAL, DirectX::XMVECTOR{ 0, 1, 0 });
Expand All @@ -340,36 +325,12 @@ namespace emibl_scene

void UpdateScene()
{
static float waiting = 0.0f;
static bool start_lerp = false;

float deltaTime = ImGui::GetIO().DeltaTime;

//waiting += deltaTime;

//if (waiting > 20.0f)
//{
// start_lerp = true;
//}

//t += 5.f * deltaTime;

//if (lerp_t < 1.0f && start_lerp)
//{
// lerp_t += deltaTime * 0.05f;

// if (lerp_t > 1.0f)
// {
// lerp_t = 1.0f;
// }

// DirectX::XMVECTOR new_cam_pos = DirectX::XMVectorLerp(camera_start_pos, camera_end_pos, lerp_t);
// camera->SetPosition(new_cam_pos);
//}

for (uint32_t i = 0; i < 10; ++i)
for (auto& model : models)
{
models[i]->SetRotation({ 0, DirectX::XMConvertToRadians(t), 0 });
model->SetRotation({ 0, DirectX::XMConvertToRadians(t), 0 });
}

camera->Update(deltaTime);
Expand Down
4 changes: 0 additions & 4 deletions demo/scene_spheres.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace spheres_scene
static std::shared_ptr<wr::MaterialPool> material_pool;

static wr::Model* sphere_model;
static wr::Model* test_model;

static wr::TextureHandle equirectangular_environment_map;

Expand Down Expand Up @@ -51,8 +50,6 @@ namespace spheres_scene
spheres_material_internal->SetMetallic(spheres_metallic);

// Create Models
test_model = model_pool->LoadWithMaterials<wr::VertexColor>(material_pool.get(), texture_pool.get(), "resources/models/xbot.fbx");

sphere_model = model_pool->Load<wr::VertexColor>(material_pool.get(), texture_pool.get(), "resources/models/sphere.fbx");
for (auto& m : sphere_model->m_meshes)
{
Expand All @@ -71,7 +68,6 @@ namespace spheres_scene

static std::shared_ptr<DebugCamera> camera;
static std::shared_ptr<wr::LightNode> directional_light_node;
static std::shared_ptr<wr::MeshNode> test_model;

static float t = 0;

Expand Down
Loading

0 comments on commit 40ce139

Please sign in to comment.