From 761be5d9eb6e57b65baf442a25f01302a7585d8d Mon Sep 17 00:00:00 2001 From: Lightling Date: Sat, 9 Apr 2022 21:21:42 -0400 Subject: [PATCH] corrections to lighting --- Game.cpp | 16 ++++++++-------- LightsPBR.hlsli | 2 +- SimplePixelPBR.hlsl | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Game.cpp b/Game.cpp index 334dd26..39f9cb9 100644 --- a/Game.cpp +++ b/Game.cpp @@ -119,9 +119,9 @@ void Game::LoadTextures() materials[0]->PushSampler("BasicSampler", sampler); materials[0]->PushTexture(TEXTYPE_REFLECTION, demoCubemap); materials[0]->hasReflectionMap = true; - materials[0]->LoadTexture(L"Assets/Textures/HQGame/structure-endgame-deepfloor_albedo.png", TEXTYPE_ALBEDO, device.Get(), context.Get()); - materials[0]->LoadTexture(L"Assets/Textures/HQGame/structure-endgame-deepfloor_specular.png", TEXTYPE_SPECULAR, device.Get(), context.Get()); - materials[0]->LoadTexture(L"Assets/Textures/HQGame/structure-endgame-deepfloor_emissive.png", TEXTYPE_EMISSIVE, device.Get(), context.Get()); + materials[0]->LoadTexture(L"Assets/Textures/WithNormals/cobblestone.png", TEXTYPE_ALBEDO, device.Get(), context.Get()); + materials[0]->LoadTexture(L"Assets/Textures/WithNormals/cobblestone_normals.png", TEXTYPE_NORMAL, device.Get(), context.Get()); + materials[0]->LoadTexture(L"Assets/Textures/WithNormals/cobblestone_specular.png", TEXTYPE_SPECULAR, device.Get(), context.Get()); materials[1]->PushSampler("BasicSampler", sampler); materials[1]->LoadTexture(L"Assets/Textures/PBR/bronze_albedo.png", TEXTYPE_ALBEDO, device.Get(), context.Get()); @@ -174,13 +174,13 @@ void Game::LoadLighting() ambient = XMFLOAT3(0.1f, 0.1f, 0.15f); lights = { - Light::Directional(XMFLOAT3(1, 0.5f, 0.5f), XMFLOAT3(1, 1, 1), 2.00f), + Light::Directional(XMFLOAT3(1, 0.5f, -0.5f), XMFLOAT3(1, 1, 1), 1.0f), Light::Directional(XMFLOAT3(-0.25f, -1, 0.75f), XMFLOAT3(1, 1, 1), 0.25f), Light::Directional(XMFLOAT3(-1, 1, -0.5f), XMFLOAT3(1, 1, 1), 0.25f), - Light::Point(XMFLOAT3(-1.5f, 0, 0), XMFLOAT3(1, 1, 1), 0.25f, 10), - Light::Point(XMFLOAT3(1.5f, 0, 0), XMFLOAT3(1, 1, 1), 0.25f, 10), - Light::Point(XMFLOAT3(0, 2, 0), XMFLOAT3(1, 0, 0), 0.25f, 10), - Light::Point(XMFLOAT3(-27.5f, 0, 0), XMFLOAT3(1, 1, 0.5f), 0.25f, 20), + Light::Point(XMFLOAT3(-1.5f, 0, 0), XMFLOAT3(1, 1, 1), 0.35f, 10), + Light::Point(XMFLOAT3(1.5f, 0, 0), XMFLOAT3(1, 1, 1), 0.35f, 10), + Light::Point(XMFLOAT3(0, 2, 0), XMFLOAT3(1, 0, 0), 0.35f, 10), + Light::Point(XMFLOAT3(-27.5f, 0, 0), XMFLOAT3(1, 1, 0.5f), 0.35f, 20), }; } diff --git a/LightsPBR.hlsli b/LightsPBR.hlsli index 5acd89c..939c496 100644 --- a/LightsPBR.hlsli +++ b/LightsPBR.hlsli @@ -5,7 +5,7 @@ float3 directionalLightPBR(Light light, float3 normal, float3 view, float roughness, float metalness, float3 surfaceColor, float3 specularColor) { float3 lightDirection = normalize(light.Direction); - float diffuse = DiffusePBR(normal, -lightDirection); + float diffuse = DiffusePBR(normal, lightDirection); float3 specular = MicrofacetBRDF(normal, lightDirection, view, roughness, specularColor); float3 balancedDiff = DiffuseEnergyConserve(diffuse, specular, metalness); diff --git a/SimplePixelPBR.hlsl b/SimplePixelPBR.hlsl index 913f2fd..7bcfd8f 100644 --- a/SimplePixelPBR.hlsl +++ b/SimplePixelPBR.hlsl @@ -43,7 +43,7 @@ float4 main(VertexToPixel input) : SV_TARGET float metalness = Metalness.Sample(Sampler, input.uv).r; float3 specular = lerp(F0_NON_METAL.rrr, albedo.rgb, metalness); - float3 light = albedo; + float3 light = float3(0, 0, 0); for (int i = 0; i < lightCount; i++) { switch (lights[i].Type)