Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ set (Scenes
"Data/Levels/EnvironmentMapUnitTest.xml"
"Data/Levels/StressTest.xml"
"Data/Levels/Terrain.xml"
"Data/Levels/LightingTest.xml"
"Source/Scenes/Scenes.h"
"Source/Scenes/DefaultScene.cpp"
"Source/Scenes/SponzaScene.cpp"
"Source/Scenes/EnvironmentMapUnitTestScene.cpp"
"Source/Scenes/StressTestScene.cpp"
"Source/Scenes/TerrainScene.cpp"
"Source/Scenes/LightingTestScene.cpp"
)

set (Config
Expand Down
6 changes: 3 additions & 3 deletions Data/Levels/Default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
<Enabled>false</Enabled>
<Color>0.4 0.4 0.15</Color>
<Range> 200 </Range>
<Brightness> 35 </Brightness>z
<Brightness> 35 </Brightness>
<Shadows>
<DepthBias> 0.05 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand All @@ -268,7 +268,7 @@
<Enabled>true</Enabled>
<Color>0.9 0.9 0.9</Color>
<Range> 35 </Range>
<Brightness> 1500 </Brightness>
<Brightness> 15 </Brightness>
<Shadows>
<DepthBias> 0.000009 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand All @@ -290,7 +290,7 @@
<Enabled>true</Enabled>
<Color>0.4 0.4 0.15</Color>
<Range> 35 </Range>
<Brightness> 1000 </Brightness>
<Brightness> 10 </Brightness>
<Shadows>
<DepthBias> 0.000005 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand Down
83 changes: 83 additions & 0 deletions Data/Levels/LightingTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Scene>
<!--
CAMERAS
-->
<Camera>
<Position> 0 112 246 </Position>
<Pitch> 17.100004 </Pitch>
<Yaw> 0 </Yaw>
<Projection>Perspective</Projection>
<FoV>60.0</FoV>
<Near>0.1</Near>
<Far>5000</Far>

<FirstPerson>
<TranslationSpeed>5800</TranslationSpeed>
<AngularSpeed>0.05</AngularSpeed>
<Drag>9.5</Drag>
</FirstPerson>
</Camera>

<!--
OBJECTS
-->

<!--
LIGHTS
-->

<Light>
<Transform>
<Position>36.86 35.58 396.14</Position>
<Rotation> 90 0 0 </Rotation>
</Transform>
<!-- Linear Light -->
<Mobility> Dynamic </Mobility>
<Enabled>true</Enabled>
<Color>0.1 0.2 0.85</Color>
<Brightness> 100 </Brightness>
<Linear>
<Length> 100 </Length>
</Linear>
</Light>
<Light>
<Transform>
<Position>240.86 35.58 386.14</Position>
<Rotation> 90 90 0 </Rotation>
<Scale> 0.1 0.1 0.1 </Scale>
</Transform>
<!-- Cylinder Light -->
<Mobility> Dynamic </Mobility>
<Enabled>true</Enabled>
<Color>0.1 0.9 0.15</Color>
<Brightness> 500 </Brightness>
<Cylinder>
<Length> 40 </Length>
<Radius> 5 </Radius>
</Cylinder>
</Light>
<Light>
<Transform>
<Position>-280.86 45.58 396.14</Position>
<Rotation> 0 120 0 </Rotation>
<Scale> 0.1 0.1 0.1 </Scale>
</Transform>
<!-- Rectangular Light -->
<Mobility> Dynamic </Mobility>
<Enabled>true</Enabled>
<Color>0.6 0.02 0.02</Color>
<Brightness> 4000 </Brightness>
<Rectangular>
<Width> 80 </Width>
<Height> 45 </Height>
</Rectangular>
</Light>

<!--
POST PROCESS
-->
<PostProcess>
<!-- TBA -->
</PostProcess>
</Scene>
57 changes: 52 additions & 5 deletions Data/Levels/Sponza.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
CAMERAS
-->
<Camera>
<Position> 700.0 170.0 -50 </Position>
<Pitch> 15 </Pitch>
<Yaw> -90 </Yaw>
<Position> 631.155762 124.675674 34.538948 </Position>
<Pitch> 17.100004 </Pitch>
<Yaw> 89.500031 </Yaw>
<Projection>Perspective</Projection>
<FoV>60.0</FoV>
<Near>0.1</Near>
Expand Down Expand Up @@ -69,7 +69,54 @@
<Name>Sponza</Name>
</Model>
</GameObject>


<Light>
<Transform>
<Position>1196.140625 55.589787 36.861996</Position>
<Rotation> 0 0 0 </Rotation>
</Transform>
<!-- Linear Light -->
<Mobility> Dynamic </Mobility>
<Enabled>true</Enabled>
<Color>0.1 0.2 0.85</Color>
<Brightness> 500 </Brightness>
<Linear>
<Length> 100 </Length>
</Linear>
</Light>
<Light>
<Transform>
<Position>886.140625 55.589787 140.861996</Position>
<Rotation> 90 0 20 </Rotation>
<Scale> 0.1 0.1 0.1 </Scale>
</Transform>
<!-- Cylinder Light -->
<Mobility> Dynamic </Mobility>
<Enabled>true</Enabled>
<Color>0.1 0.9 0.15</Color>
<Brightness> 300 </Brightness>
<Cylinder>
<Length> 40 </Length>
<Radius> 5 </Radius>
</Cylinder>
</Light>
<Light>
<Transform>
<Position>896.140625 55.589787 -40.861996</Position>
<Rotation> 0 120 0 </Rotation>
<Scale> 0.1 0.1 0.1 </Scale>
</Transform>
<!-- Rectangular Light -->
<Mobility> Dynamic </Mobility>
<Enabled>true</Enabled>
<Color>0.6 0.02 0.02</Color>
<Brightness> 400 </Brightness>
<Rectangular>
<Width> 80 </Width>
<Height> 45 </Height>
</Rectangular>
</Light>

<Light>
<Transform>
<Position>12.5 100 0</Position>
Expand All @@ -81,7 +128,7 @@
<Enabled>true</Enabled>
<Color>0.4 0.4 0.85</Color>
<Range> 5000 </Range>
<Brightness> 65000 </Brightness>
<Brightness> 40 </Brightness>
<Shadows>
<DepthBias> 0.5 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand Down
20 changes: 10 additions & 10 deletions Data/Levels/StressTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
<Enabled>true</Enabled>
<Color>0.8 0.95 0.8</Color>
<Range> 170 </Range>
<Brightness> 4000 </Brightness>
<Brightness> 20 </Brightness>
<Shadows>
<DepthBias> 0.000005 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand All @@ -211,7 +211,7 @@
<Enabled>true</Enabled>
<Color>0.8 0.95 0.8</Color>
<Range> 170 </Range>
<Brightness> 4000 </Brightness>
<Brightness> 20 </Brightness>
<Shadows>
<DepthBias> 0.000005 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand All @@ -233,7 +233,7 @@
<Enabled>true</Enabled>
<Color>0.8 0.95 0.8</Color>
<Range> 350 </Range>
<Brightness> 16000 </Brightness>
<Brightness> 60 </Brightness>
<Shadows>
<DepthBias> 0.00005 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand All @@ -255,7 +255,7 @@
<Enabled>true</Enabled>
<Color>0.8 0.95 0.8</Color>
<Range> 170 </Range>
<Brightness> 4000 </Brightness>
<Brightness> 40 </Brightness>
<Shadows>
<DepthBias> 0.00008 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand All @@ -277,7 +277,7 @@
<Enabled>true</Enabled>
<Color>0.9 0.70 0.6</Color>
<Range> 170 </Range>
<Brightness> 800 </Brightness>
<Brightness> 8 </Brightness>
<Shadows>
<DepthBias> 0.000005 </DepthBias>
<NearPlane> 0.01 </NearPlane>
Expand Down Expand Up @@ -305,7 +305,7 @@
<Enabled>true</Enabled>
<Color>0.8 0.8 0.45</Color>
<Range> 60 </Range>
<Brightness> 350 </Brightness>
<Brightness> 35 </Brightness>
<Shadows>
<DepthBias> 0.1 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand All @@ -327,7 +327,7 @@
<Enabled>true</Enabled>
<Color>0.8 0.8 0.45</Color>
<Range> 120 </Range>
<Brightness> 2650 </Brightness>
<Brightness> 26 </Brightness>
<Shadows>
<DepthBias> 0.2 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand All @@ -349,7 +349,7 @@
<Enabled>true</Enabled>
<Color>0.65 0.65 0.65</Color>
<Range> 120 </Range>
<Brightness> 50 </Brightness>
<Brightness> 10 </Brightness>
<Shadows>
<DepthBias> 0.1 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand All @@ -371,7 +371,7 @@
<Enabled>true</Enabled>
<Color>0.1 0.05 0.45</Color>
<Range> 50 </Range>
<Brightness> 1650 </Brightness>
<Brightness> 16 </Brightness>
<Shadows>
<DepthBias> 0.1 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand All @@ -393,7 +393,7 @@
<Enabled>true</Enabled>
<Color>0.1 0.7 0.05</Color>
<Range> 70 </Range>
<Brightness> 1250 </Brightness>
<Brightness> 10 </Brightness>
<Shadows>
<DepthBias> 0.1 </DepthBias>
<NearPlane> 0.001 </NearPlane>
Expand Down
3 changes: 2 additions & 1 deletion Data/Scenes.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Default=0
Sponza=1
EnvironmentMapUnitTest=2
StressTest=3
Terrain=4
Terrain=4
LightingTest=5
2 changes: 1 addition & 1 deletion Shaders/BRDF.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ inline float3 F_LambertDiffuse(float3 kd)
return kd / PI;
}

float3 BRDF(in BRDF_Surface s, float3 Wi, float3 V)
float3 BRDF(in BRDF_Surface s, float3 Wi, float3 V/*Wo*/)
{
// vectors
const float3 Wo = normalize(V);
Expand Down
19 changes: 16 additions & 3 deletions Shaders/ForwardLighting.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

#include "Lighting.hlsl"



//---------------------------------------------------------------------------------------------------
//
// DATA
Expand Down Expand Up @@ -105,7 +103,8 @@ Texture2D texDirectionalLightShadowMap : register(t13);
Texture2DArray texSpotLightShadowMaps : register(t16);
TextureCubeArray texPointLightShadowMaps : register(t22);


Texture2D texLTC1 : register(t52);
Texture2D texLTC2 : register(t53);


//---------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -376,6 +375,20 @@ PSOutput PSMain(PSInput In)
}
}

// area lights
for (int ll = 0; ll < cbPerFrame.Lights.numLinearLights; ++ll)
{
I_total += CalculateLinearLightIllumination(cbPerFrame.Lights.linear_lights[ll], Surface, V, P, texLTC1, texLTC2, LinearSampler);
}
for (int cl = 0; cl < cbPerFrame.Lights.numCylinderLights; ++cl)
{
I_total += CalculateCylinderLightIllumination(cbPerFrame.Lights.cylinder_lights[cl], Surface, V, P);
}
for (int rl = 0; rl < cbPerFrame.Lights.numRectangularLights; ++rl)
{
I_total += ClaculateRectangularLightIllumination(cbPerFrame.Lights.rectangular_lights[rl], Surface, V, P, texLTC1, texLTC2, LinearSampler);
}

// write out
o.color = float4(I_total, Surface.roughness.r);

Expand Down
Loading