diff --git a/Assets/Textures/HQGame/structure-endgame-deepfloor_emissive.png b/Assets/Textures/HQGame/structure-endgame-deepfloor_emissive.png
new file mode 100644
index 0000000..9500c43
Binary files /dev/null and b/Assets/Textures/HQGame/structure-endgame-deepfloor_emissive.png differ
diff --git a/Assets/Textures/HQGame/structure-endgame-floor_emissive.png b/Assets/Textures/HQGame/structure-endgame-floor_emissive.png
new file mode 100644
index 0000000..8ff9ebd
Binary files /dev/null and b/Assets/Textures/HQGame/structure-endgame-floor_emissive.png differ
diff --git a/DX11Starter.vcxproj b/DX11Starter.vcxproj
index 2de5d16..5d29ec5 100644
--- a/DX11Starter.vcxproj
+++ b/DX11Starter.vcxproj
@@ -655,6 +655,36 @@
$(OutDir)/Assets/Textures/HQGame
+
+
+ false
+ true
+ false
+ true
+ false
+ true
+ false
+ true
+ $(OutDir)/Assets/Textures/HQGame
+ $(OutDir)/Assets/Textures/HQGame
+ $(OutDir)/Assets/Textures/HQGame
+ $(OutDir)/Assets/Textures/HQGame
+
+
+ false
+ true
+ false
+ true
+ false
+ true
+ false
+ true
+ $(OutDir)/Assets/Textures/HQGame
+ $(OutDir)/Assets/Textures/HQGame
+ $(OutDir)/Assets/Textures/HQGame
+ $(OutDir)/Assets/Textures/HQGame
+
+
diff --git a/DX11Starter.vcxproj.filters b/DX11Starter.vcxproj.filters
index a0e215d..ba641ac 100644
--- a/DX11Starter.vcxproj.filters
+++ b/DX11Starter.vcxproj.filters
@@ -204,6 +204,12 @@
Assets\Textures\HQGame
+
+ Assets\Textures\HQGame
+
+
+ Assets\Textures\HQGame
+
diff --git a/Game.cpp b/Game.cpp
index 59baf18..3cfb69f 100644
--- a/Game.cpp
+++ b/Game.cpp
@@ -106,61 +106,67 @@ void Game::LoadTextures()
device->CreateSamplerState(&sampDesc, sampler.GetAddressOf());
Microsoft::WRL::ComPtr
+ deepFloorEmissive,
deepFloorSpecular,
deepFloorAlbedo,
+ floorEmissive,
floorSpecular,
floorAlbedo;
// taking the preprocessor macro from the demo because I don't like typing
#define GetTex(pathToTexture, shaderResourceView) CreateWICTextureFromFile(device.Get(), context.Get(), GetFullPathTo_Wide(pathToTexture).c_str(), 0, shaderResourceView.GetAddressOf());
+ GetTex(L"Assets/Textures/HQGame/structure-endgame-deepfloor_emissive.png", deepFloorEmissive);
GetTex(L"Assets/Textures/HQGame/structure-endgame-deepfloor_specular.png", deepFloorSpecular);
GetTex(L"Assets/Textures/HQGame/structure-endgame-deepfloor_albedo.png", deepFloorAlbedo);
+ GetTex(L"Assets/Textures/HQGame/structure-endgame-floor_emissive.png", floorEmissive);
GetTex(L"Assets/Textures/HQGame/structure-endgame-floor_specular.png", floorSpecular);
GetTex(L"Assets/Textures/HQGame/structure-endgame-floor_albedo.png", floorAlbedo);
materials[0]->PushSampler("BasicSampler", sampler);
materials[0]->PushTexture("Albedo", deepFloorAlbedo);
materials[0]->PushTexture("Specular", deepFloorSpecular);
+ materials[0]->PushTexture("Emissive", deepFloorEmissive);
materials[1]->PushSampler("BasicSampler", sampler);
materials[1]->PushTexture("Albedo", floorAlbedo);
materials[1]->PushTexture("Specular", floorSpecular);
+ materials[1]->PushTexture("Emissive", floorEmissive);
}
void Game::LoadLighting()
{
- ambient = XMFLOAT3(0.1f, 0.1f, 0.25f);
+ ambient = XMFLOAT3(0.1f, 0.1f, 0.15f);
Light directionalLight0 = {};
directionalLight0.Type = LIGHT_TYPE_DIRECTIONAL;
directionalLight0.Direction = XMFLOAT3(1, 0.5f, 0.5f);
directionalLight0.Color = XMFLOAT3(1, 1, 1);
- directionalLight0.Intensity = 1.0f;
+ directionalLight0.Intensity = 0.5f;
Light directionalLight1 = {};
directionalLight1.Type = LIGHT_TYPE_DIRECTIONAL;
directionalLight1.Direction = XMFLOAT3(-0.25f, -1, 0.75f);
directionalLight1.Color = XMFLOAT3(1, 1, 1);
- directionalLight1.Intensity = 1.0f;
+ directionalLight1.Intensity = 0.5f;
Light directionalLight2 = {};
directionalLight2.Type = LIGHT_TYPE_DIRECTIONAL;
directionalLight2.Direction = XMFLOAT3(-1, 1, -0.5f);
directionalLight2.Color = XMFLOAT3(1, 1, 1);
- directionalLight2.Intensity = 1.0f;
+ directionalLight2.Intensity = 0.5f;
Light pointLight0 = {};
pointLight0.Type = LIGHT_TYPE_POINT;
pointLight0.Position = XMFLOAT3(-1.5f, 0, 0);
pointLight0.Color = XMFLOAT3(1, 1, 1);
- pointLight0.Intensity = 1.0f;
+ pointLight0.Intensity = 0.5f;
pointLight0.Range = 10;
Light pointLight1 = {};
pointLight1.Type = LIGHT_TYPE_POINT;
pointLight1.Position = XMFLOAT3(1.5f, 0, 0);
pointLight1.Color = XMFLOAT3(1, 1, 1);
- pointLight1.Intensity = 0.5f;
+ pointLight1.Intensity = 0.25f;
pointLight1.Range = 10;
lights = {
@@ -248,6 +254,7 @@ void Game::Update(float deltaTime, float totalTime)
entities[i]->GetMaterial()->SetRoughness(sin(totalTime) * 0.5f + 0.49f);
entities[i]->GetMaterial()->SetUVOffset(DirectX::XMFLOAT2(cos(totalTime * 4) * 0.5f + 0.49f, cos(totalTime * 4) * 0.5f + 0.49f));
entities[i]->GetMaterial()->SetUVScale(DirectX::XMFLOAT2(sin(totalTime) * 0.5f + 0.49f, sin(totalTime) * 0.5f + 0.49f));
+ entities[i]->GetMaterial()->SetEmitAmount(cos(totalTime) * 0.5f + 0.49f);
}
}
diff --git a/Material.cpp b/Material.cpp
index 587c5ba..25a2bfd 100644
--- a/Material.cpp
+++ b/Material.cpp
@@ -31,8 +31,9 @@ void Material::Activate(Transform* _transform, std::shared_ptr _camera,
pixelShader->SetFloat("roughness", GetRoughness());
pixelShader->SetFloat2("scale", GetUVScale());
pixelShader->SetFloat2("offset", GetUVOffset());
- pixelShader->SetFloat3("tint", GetTint());
pixelShader->SetFloat3("ambient", _ambient);
+ pixelShader->SetFloat("emitAmount", GetEmitAmount());
+ pixelShader->SetFloat3("tint", GetTint());
pixelShader->SetData("lights", &_lights[0], sizeof(Light) * (int)_lights.size());
pixelShader->CopyAllBufferData();
pixelShader->SetShader();
@@ -67,6 +68,11 @@ float Material::GetRoughness()
return roughness;
}
+float Material::GetEmitAmount()
+{
+ return emitAmount;
+}
+
std::shared_ptr Material::GetVertexShader()
{
return vertexShader;
@@ -108,6 +114,11 @@ void Material::SetRoughness(float _roughness)
}
}
+void Material::SetEmitAmount(float _emit)
+{
+ emitAmount = _emit;
+}
+
void Material::SetVertexShader(std::shared_ptr _vertexShader)
{
vertexShader = _vertexShader;
diff --git a/Material.h b/Material.h
index 6f23a1a..c3df313 100644
--- a/Material.h
+++ b/Material.h
@@ -27,6 +27,7 @@ public:
DirectX::XMFLOAT2 GetUVScale();
DirectX::XMFLOAT2 GetUVOffset();
float GetRoughness();
+ float GetEmitAmount();
std::shared_ptr GetVertexShader();
std::shared_ptr GetPixelShader();
@@ -34,6 +35,7 @@ public:
void SetUVScale(DirectX::XMFLOAT2 _scale);
void SetUVOffset(DirectX::XMFLOAT2 _offset);
void SetRoughness(float _roughness);
+ void SetEmitAmount(float _emit);
void SetVertexShader(std::shared_ptr _vertexShader);
void SetPixelShader(std::shared_ptr _pixelShader);
@@ -43,6 +45,7 @@ public:
private:
DirectX::XMFLOAT3 tint;
float roughness;
+ float emitAmount;
DirectX::XMFLOAT2 uvScale;
DirectX::XMFLOAT2 uvOffset;
std::shared_ptr vertexShader;
diff --git a/SimplePixelShader.hlsl b/SimplePixelShader.hlsl
index 9493ca6..7fa6b0b 100644
--- a/SimplePixelShader.hlsl
+++ b/SimplePixelShader.hlsl
@@ -12,12 +12,14 @@ cbuffer ExternalData : register(b0)
float2 offset;
float2 scale;
float3 ambient;
+ float emitAmount;
float3 tint;
Light lights[LIGHT_COUNT];
}
Texture2D Albedo : register(t0);
Texture2D Specular : register(t1);
+Texture2D Emissive : register(t2);
SamplerState BasicSampler : register(s0);
// Gets the specular value for any light
@@ -63,6 +65,7 @@ float4 main(VertexToPixel input) : SV_TARGET
float4 albedo = Albedo.Sample(BasicSampler, input.uv).rgba;
float specular = Specular.Sample(BasicSampler, input.uv).r;
+ float3 emit = Emissive.Sample(BasicSampler, input.uv).rgb;
float3 surface = albedo.rgb * tint;
float3 light = ambient * surface;
@@ -80,5 +83,5 @@ float4 main(VertexToPixel input) : SV_TARGET
}
}
- return float4(light, albedo.a);
+ return float4(light + (emit * emitAmount), albedo.a);
}