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

Commit 2adc9b8

Browse files
committed
Reverting changes for the trailer
1 parent 9f9f7bb commit 2adc9b8

17 files changed

+97
-140
lines changed

demo/demo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int WispEntry()
8585
};
8686

8787
render_system = std::make_unique<wr::D3D12RenderSystem>();
88-
auto window = std::make_unique<wr::Window>(GetModuleHandleA(nullptr), "D3D12 Test App", 1920, 1080);
88+
auto window = std::make_unique<wr::Window>(GetModuleHandleA(nullptr), "D3D12 Test App", 1280, 720);
8989

9090
window->SetKeyCallback([](int key, int action, int mods)
9191
{

demo/demo_frame_graphs.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ namespace fg_manager
9292
wr::AddPostProcessingTask<wr::DeferredCompositionTaskData>(*fg);
9393

9494
// Do Depth of field task
95-
/*wr::AddDoFCoCTask<wr::DeferredMainTaskData>(*fg);
95+
wr::AddDoFCoCTask<wr::DeferredMainTaskData>(*fg);
9696

9797
wr::AddDoFDownScaleTask<wr::PostProcessingData, wr::DoFCoCData>(*fg,
9898
rs.m_window.value()->GetWidth(), rs.m_window.value()->GetHeight());
@@ -112,12 +112,12 @@ namespace fg_manager
112112
wr::AddDoFBokehPostFilterTask<wr::DoFBokehData>(*fg,
113113
rs.m_window.value()->GetWidth(), rs.m_window.value()->GetHeight());
114114

115-
wr::AddDoFCompositionTask<wr::PostProcessingData, wr::DoFBokehPostFilterData, wr::DoFCoCData>(*fg);*/
115+
wr::AddDoFCompositionTask<wr::PostProcessingData, wr::DoFBokehPostFilterData, wr::DoFCoCData>(*fg);
116116

117117
// Copy the scene render pixel data to the final render target
118-
wr::AddRenderTargetCopyTask<wr::PostProcessingData>(*fg);
118+
wr::AddRenderTargetCopyTask<wr::DoFCompositionData>(*fg);
119119
// Display ImGui
120-
fg->AddTask<wr::ImGuiTaskData>(wr::GetImGuiTask<wr::PostProcessingData>(imgui_func));
120+
fg->AddTask<wr::ImGuiTaskData>(wr::GetImGuiTask<wr::DoFCompositionData>(imgui_func));
121121

122122
fg->Setup(rs);
123123
}

demo/scene_viknell.hpp

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace viknell_scene
4545
wr::TextureHandle bamboo_roughness = texture_pool->LoadFromFile("resources/materials/bamboo/bamboo-wood-semigloss-roughness.png", false, true);
4646
wr::TextureHandle bamboo_metallic = texture_pool->LoadFromFile("resources/materials/bamboo/bamboo-wood-semigloss-metal.png", false, true);
4747

48-
equirectangular_environment_map = texture_pool->LoadFromFile("resources/materials/SunTemple_Skybox.hdr", false, false);
48+
equirectangular_environment_map = texture_pool->LoadFromFile("resources/materials/Circus_Backstage_3k.hdr", false, false);
4949

5050
// Create Materials
5151
mirror_material = material_pool->Create();
@@ -69,7 +69,7 @@ namespace viknell_scene
6969
bamboo_material_internal->SetMetallic(bamboo_metallic);
7070

7171
plane_model = model_pool->Load<wr::VertexColor>(material_pool.get(), texture_pool.get(), "resources/models/plane.fbx");
72-
test_model = model_pool->LoadWithMaterials<wr::VertexColor>(material_pool.get(), texture_pool.get(), "resources/materials/SunTemple.fbx");
72+
test_model = model_pool->LoadWithMaterials<wr::VertexColor>(material_pool.get(), texture_pool.get(), "resources/models/xbot.fbx");
7373
sphere_model = model_pool->Load<wr::VertexColor>(material_pool.get(), texture_pool.get(), "resources/models/sphere.fbx");
7474
}
7575

@@ -84,12 +84,8 @@ namespace viknell_scene
8484

8585
static std::shared_ptr<DebugCamera> camera;
8686
static std::shared_ptr<SplineNode> camera_spline_node;
87-
static std::shared_ptr<SplineNode> light_1_spline_node;
88-
static std::shared_ptr<SplineNode> light_2_spline_node;
8987
static std::shared_ptr<wr::LightNode> directional_light_node;
9088
static std::shared_ptr<wr::MeshNode> test_model;
91-
static std::shared_ptr<wr::LightNode> point_light_1;
92-
static std::shared_ptr<wr::LightNode> point_light_2;
9389
static float t = 0;
9490

9591
void CreateScene(wr::SceneGraph* scene_graph, wr::Window* window)
@@ -99,21 +95,19 @@ namespace viknell_scene
9995
camera->SetSpeed(10);
10096

10197
camera_spline_node = scene_graph->CreateChild<SplineNode>(nullptr, "Camera Spline", false);
102-
light_1_spline_node = scene_graph->CreateChild<SplineNode>(nullptr, "Light 1 Spline", true);
103-
light_2_spline_node = scene_graph->CreateChild<SplineNode>(nullptr, "Light 2 Spline", true);
10498

10599
scene_graph->m_skybox = resources::equirectangular_environment_map;
106100
auto skybox = scene_graph->CreateChild<wr::SkyboxNode>(nullptr, resources::equirectangular_environment_map);
107101

108102
// Geometry
109-
//auto floor = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::plane_model);
110-
//auto roof = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::plane_model);
111-
//auto back_wall = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::plane_model);
112-
//auto left_wall = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::plane_model);
113-
//auto right_wall = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::plane_model);
103+
auto floor = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::plane_model);
104+
auto roof = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::plane_model);
105+
auto back_wall = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::plane_model);
106+
auto left_wall = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::plane_model);
107+
auto right_wall = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::plane_model);
114108
test_model = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::test_model);
115-
//auto sphere = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::sphere_model);
116-
/*floor->SetPosition({0, -1, 0});
109+
auto sphere = scene_graph->CreateChild<wr::MeshNode>(nullptr, resources::sphere_model);
110+
floor->SetPosition({0, -1, 0});
117111
floor->SetRotation({90_deg, 0, 0});
118112
floor->AddMaterial(resources::bamboo_material);
119113
sphere->SetPosition({1, -1, -1});
@@ -130,23 +124,21 @@ namespace viknell_scene
130124
left_wall->AddMaterial(resources::bamboo_material);
131125
right_wall->SetPosition({1, 0, 0});
132126
right_wall->SetRotation({0, 90_deg, 0});
133-
right_wall->AddMaterial(resources::bamboo_material);*/
127+
right_wall->AddMaterial(resources::bamboo_material);
134128
test_model->SetPosition({0, -1, 0});
135129
test_model->SetRotation({0, 180_deg, 0});
136130
test_model->SetScale({0.01f,0.01f,0.01f});
137131

138-
139132
// Lights
140-
auto point_light_0 = scene_graph->CreateChild<wr::LightNode>(nullptr, wr::LightType::POINT, DirectX::XMVECTOR{ 1000 / 255, 1000 / 255, 1000 / 255 });
141-
//point_light_0->SetRadius(3.0f);
142-
point_light_0->SetPosition({ 0, 2.5, 0 });
143-
point_light_0->SetRadius(10000.f);
133+
auto point_light_0 = scene_graph->CreateChild<wr::LightNode>(nullptr, wr::LightType::DIRECTIONAL, DirectX::XMVECTOR{ 1, 1, 1 });
134+
point_light_0->SetRotation({20.950, 0.98, 0});
135+
point_light_0->SetPosition({-0.002, 0.080, 1.404});
144136

145-
point_light_1 = scene_graph->CreateChild<wr::LightNode>(nullptr, wr::LightType::POINT, DirectX::XMVECTOR{3000 / 255, 0, 0});
137+
auto point_light_1 = scene_graph->CreateChild<wr::LightNode>(nullptr, wr::LightType::POINT, DirectX::XMVECTOR{1, 0, 0});
146138
point_light_1->SetRadius(5.0f);
147139
point_light_1->SetPosition({0.5, 0, -0.3});
148140

149-
point_light_2 = scene_graph->CreateChild<wr::LightNode>(nullptr, wr::LightType::POINT, DirectX::XMVECTOR{0, 0, 3000 / 255});
141+
auto point_light_2 = scene_graph->CreateChild<wr::LightNode>(nullptr, wr::LightType::POINT, DirectX::XMVECTOR{0, 0, 1});
150142
point_light_2->SetRadius(5.0f);
151143
point_light_2->SetPosition({-0.5, 0.5, -0.3});
152144

@@ -163,7 +155,5 @@ namespace viknell_scene
163155

164156
camera->Update(ImGui::GetIO().DeltaTime);
165157
camera_spline_node->UpdateSplineNode(ImGui::GetIO().DeltaTime, camera);
166-
light_1_spline_node->UpdateSplineNode(ImGui::GetIO().DeltaTime, point_light_1);
167-
light_2_spline_node->UpdateSplineNode(ImGui::GetIO().DeltaTime, point_light_2);
168158
}
169159
} /* cube_scene */

imgui.ini

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
[Window][DockspaceViewport_11111111]
22
Pos=0,21
3-
Size=32,32
3+
Size=1496964992,452
44
Collapsed=0
55

66
[Window][Debug##Default]
7-
Pos=1074,572
7+
Pos=1074,453
88
Size=228,150
99
Collapsed=1
1010

1111
[Window][Theme]
12-
Pos=26,38
13-
Size=6,10
12+
Pos=1194760704,213
13+
Size=302204288,198
1414
Collapsed=0
1515
DockId=0x00000007,0
1616

1717
[Window][ImGui Details]
18-
Pos=26,50
19-
Size=6,3
18+
Pos=1194760704,413
19+
Size=302204288,60
2020
Collapsed=0
2121
DockId=0x00000008,0
2222

2323
[Window][Camera Settings]
24-
Pos=0,41
25-
Size=11,12
24+
Pos=0,293
25+
Size=283,180
2626
Collapsed=0
2727
DockId=0x0000000A,0
2828

@@ -48,14 +48,14 @@ Size=169,259
4848
Collapsed=0
4949

5050
[Window][DirectX 12 Settings]
51-
Pos=26,38
52-
Size=6,10
51+
Pos=1194760704,213
52+
Size=302204288,198
5353
Collapsed=0
5454
DockId=0x00000007,1
5555

5656
[Window][Hardware Info]
57-
Pos=26,21
58-
Size=6,15
57+
Pos=1194760704,21
58+
Size=302204288,190
5959
Collapsed=0
6060
DockId=0x00000003,1
6161

@@ -78,25 +78,25 @@ Collapsed=0
7878
DockId=0x00000003,2
7979

8080
[Window][Viewport]
81-
Pos=13,21
82-
Size=11,32
81+
Pos=285,21
82+
Size=1194760448,452
8383
Collapsed=0
8484
DockId=0x00000002,0
8585

8686
[Window][Scene Graph Editor]
8787
Pos=0,21
88-
Size=11,18
88+
Size=283,270
8989
Collapsed=0
9090
DockId=0x00000011,0
9191

9292
[Window][Inspector]
93-
Pos=26,21
94-
Size=6,15
93+
Pos=1194760704,21
94+
Size=302204288,190
9595
Collapsed=0
9696
DockId=0x00000003,0
9797

9898
[Docking][Data]
99-
DockSpace ID=0x4DDED0D8 Pos=0,21 Size=32,32 Split=X
99+
DockSpace ID=0x4DDED0D8 Pos=0,21 Size=-8320,452 Split=X
100100
DockNode ID=0x00000004 Parent=0x4DDED0D8 SizeRef=1020,699 Split=X
101101
DockNode ID=0x00000001 Parent=0x00000004 SizeRef=283,699 Split=Y SelectedTab=0x1FA76273
102102
DockNode ID=0x00000009 Parent=0x00000001 SizeRef=463,418 Split=Y SelectedTab=0x1FA76273
@@ -111,7 +111,7 @@ DockSpace ID=0x4DDED0D8 Pos=0,21 Size=32,32 Split=X
111111
DockNode ID=0x0000000A Parent=0x00000001 SizeRef=463,279 SelectedTab=0x8722C6A1
112112
DockNode ID=0x00000002 Parent=0x00000004 SizeRef=735,699 CentralNode=1 SelectedTab=0x995B0CF8
113113
DockNode ID=0x00000005 Parent=0x4DDED0D8 SizeRef=258,699 Split=Y SelectedTab=0x070A839D
114-
DockNode ID=0x00000003 Parent=0x00000005 SizeRef=236,295 SelectedTab=0xF02CD328
114+
DockNode ID=0x00000003 Parent=0x00000005 SizeRef=236,295 SelectedTab=0x053C54B8
115115
DockNode ID=0x00000006 Parent=0x00000005 SizeRef=236,402 Split=Y SelectedTab=0x070A839D
116116
DockNode ID=0x00000007 Parent=0x00000006 SizeRef=236,307 SelectedTab=0x070A839D
117117
DockNode ID=0x00000008 Parent=0x00000006 SizeRef=236,93 SelectedTab=0x45C34A56

resources/shaders/basic.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ VS_OUTPUT main_vs(VS_INPUT input, uint instid : SV_InstanceId)
5858
output.uv = float2(input.uv.x, 1.0f - input.uv.y);
5959
output.tangent = normalize(mul(inst.model, float4(input.tangent, 0))).xyz;
6060
output.bitangent = normalize(mul(inst.model, float4(input.bitangent, 0))).xyz;
61-
output.normal = normalize(mul(inst.model, float4(-input.normal, 0))).xyz;
61+
output.normal = normalize(mul(inst.model, float4(input.normal, 0))).xyz;
6262
output.color = input.color;
6363

6464
return output;

resources/shaders/deferred_composition.hlsl

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define LIGHTS_REGISTER register(t3)
2-
#define MAX_REFLECTION_LOD 4
2+
#define MAX_REFLECTION_LOD 3
33

44
#include "fullscreen_quad.hlsl"
55
#include "util.hlsl"
@@ -80,19 +80,14 @@ void main_cs(int3 dispatch_thread_id : SV_DispatchThreadID)
8080
else
8181
{
8282
irradiance = irradiance_map.SampleLevel(linear_sampler, flipped_N, 0).xyz;
83-
irradiance /= 2;
8483
}
8584

86-
#ifdef HARD_IRR
87-
irradiance = IRR;
88-
#endif
89-
9085
// Get shadow factor (0: fully shadowed, 1: no shadow)
9186
float shadow_factor = lerp(
9287
// Do deferred shadow (fully lit for now)
9388
1.0,
9489
// Shadow buffer if its hybrid rendering
95-
buffer_refl_shadow.SampleLevel(linear_sampler, uv, 0).w,
90+
buffer_refl_shadow[screen_coord].a,
9691
// Lerp factor (0: no hybrid, 1: hybrid)
9792
is_hybrid);
9893

@@ -103,13 +98,12 @@ void main_cs(int3 dispatch_thread_id : SV_DispatchThreadID)
10398
// Sample from environment if it IS NOT hybrid rendering
10499
sampled_environment_map,
105100
// Reflection buffer if it IS hybrid rendering
106-
buffer_refl_shadow.SampleLevel(linear_sampler, uv, 0).xyz,
101+
buffer_refl_shadow[screen_coord].xyz,
107102
// Lerp factor (0: no hybrid, 1: hybrid)
108103
is_hybrid);
109104

110105
// Shade pixel
111106
retval = shade_pixel(pos, V, albedo, metallic, roughness, normal, irradiance, reflection, sampled_brdf, shadow_factor);
112-
//retval = reflection;
113107
}
114108
else
115109
{

resources/shaders/lighting.hlsl

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ float3 shade_pixel(float3 pos, float3 V, float3 albedo, float metallic, float ro
7272
float3 specular = prefiltered_color * (kS * sampled_brdf.x + sampled_brdf.y);
7373
//float3 specular = reflection * kS;
7474

75-
float3 ambient = ((kD * diffuse) + specular) * 1.0f; //Replace 1.0f with AO, when we have it.
75+
float3 ambient = (kD * diffuse + specular) * 1.0f; //Replace 1.0f with AO, when we have it.
7676

77-
return ambient + (res);
77+
return ambient + (res * shadow_factor);
7878
}
7979

8080
float3 shade_light(float3 pos, float3 V, float3 albedo, float3 normal, float metallic, float roughness, Light light, inout uint rand_seed, uint depth)
@@ -147,18 +147,8 @@ float DoShadowAllLights(float3 wpos, uint depth, inout float rand_seed)
147147
// Get maxium ray length (depending on type)
148148
float t_max = lerp(light_dist, 100000, tid == light_type_directional);
149149

150-
float min_cos = cos(light.ang);
151-
float max_cos = lerp(min_cos, 1, 0.5f);
152-
float cos_angle = dot(light.dir, L);
153-
float spot_intensity = lerp(smoothstep(min_cos, max_cos, cos_angle), 1, tid != light_type_spot);
154-
155-
//Attenuation & spot intensity (only used with point or spot)
156-
float attenuation = lerp(1.0f - smoothstep(0, light.rad, light_dist), 1, tid == light_type_directional);
157-
158-
float3 radiance = attenuation;
159-
160150
// Add shadow factor to final result
161-
res += GetShadowFactor(wpos, L, t_max, depth, rand_seed) * length(radiance);
151+
res += GetShadowFactor(wpos, L, t_max, depth + 1, rand_seed);
162152
}
163153

164154
// return final res

resources/shaders/material_util.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ OutputMaterialData InterpretMaterialData(MaterialData data,
4949

5050
float4 albedo = lerp(material_albedo.Sample(s0, uv), float4(data.albedo_alpha.xyz, 1.0f), use_albedo_constant != 0 || has_albedo_texture == 0);
5151

52-
#define COMPRESSED_PBR
52+
//#define COMPRESSED_PBR
5353
#ifdef COMPRESSED_PBR
5454
float4 roughness = lerp(material_metallic.Sample(s0, uv).y, data.metallic_roughness.w, use_roughness_constant != 0 || has_roughness_texture == 0);
5555
float4 metallic = lerp(material_metallic.Sample(s0, uv).z, length(data.metallic_roughness.xyz), use_metallic_constant != 0 || has_metallic_texture == 0);
@@ -86,7 +86,7 @@ OutputMaterialData InterpretMaterialDataRT(MaterialData data,
8686
uint has_metallic_texture = data.flags & MATERIAL_HAS_METALLIC_TEXTURE;
8787
uint use_normal_texture = data.flags & MATERIAL_HAS_NORMAL_TEXTURE;
8888

89-
#define COMPRESSED_PBR
89+
//#define COMPRESSED_PBR
9090
#ifdef COMPRESSED_PBR
9191
const float3 albedo = lerp(material_albedo.SampleLevel(s0, uv, mip_level).xyz,
9292
data.albedo_alpha.xyz,

resources/shaders/post_processing.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ void main(uint3 DTid : SV_DispatchThreadID)
2020
float2 uv = (float2(DTid.xy) / resolution);
2121

2222
float gamma = 2.2;
23-
float exposure = 2;
23+
float exposure = 1;
2424

2525
float3 color = input[DTid.xy].rgb;
26-
color = SampleFXAA(input, s0, DTid.xy, resolution);
26+
//color = SampleFXAA(input, s0, DTid.xy, resolution);
2727
//uv = ZoomUV(uv, 0.75);
2828
//float3 color = input.SampleLevel(s0, BarrelDistortUV(uv, 2), 0);
2929
//float3 color = ChromaticAberrationV2(input, s0, uv, 0.2, 0.96f).rgb;
3030

3131
if (hdr == 0)
3232
{
33-
//color = linearToneMapping(color, exposure, gamma);
34-
color = simpleReinhardToneMapping(color, exposure, gamma);
33+
color = linearToneMapping(color, exposure, gamma);
34+
//color = simpleReinhardToneMapping(color, exposure, gamma);
3535
//color = lumaBasedReinhardToneMapping(color, gamma);
3636
//color = whitePreservingLumaBasedReinhardToneMapping(color, gamma);
3737
//color = RomBinDaHouseToneMapping(color, gamma);

resources/shaders/rt_global.hlsl

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#define MAX_RECURSION 2
1+
#define MAX_RECURSION 3
22
//#define FOUR_X_A
33
//#define PATH_TRACING
44
//#define DEPTH_OF_FIELD
5-
#define SOFT_SHADOWS
6-
#define EPSILON 0.05
7-
#define MAX_SHADOW_SAMPLES 8
5+
#define EPSILON 0.01
6+
#define MAX_SHADOW_SAMPLES 4
87

98
#ifdef FALLBACK
109
#undef MAX_RECURSION
@@ -13,10 +12,5 @@
1312
#define NO_SHADOWS
1413
#endif
1514

16-
#define HARD_IRR
17-
#ifdef HARD_IRR
18-
#define IRR 0.15
19-
#endif
20-
2115
RaytracingAccelerationStructure Scene : register(t0, space0);
2216

0 commit comments

Comments
 (0)