diff --git a/Assets/Scenes/Level2.shade b/Assets/Scenes/Level2.shade index e3de1671..fec79fec 100644 --- a/Assets/Scenes/Level2.shade +++ b/Assets/Scenes/Level2.shade @@ -17,7 +17,7 @@ Light Component: Position: {x: 0, y: 0, z: 0} Type: Directional - Direction: {x: 15, y: 90, z: 15} + Direction: {x: 15, y: -90, z: 15} Color: {x: 1, y: 1, z: 1, w: 1} Layer: 4294967295 Strength: 1 @@ -2251,6 +2251,8 @@ Text Renderer Component: Text: My name is Brandon. Font: 174412429 + Color: {x: 1, y: 1, z: 1, w: 1} + Text Size: {x: 1, y: 1, z: 1} IsActive: true UI Component: Canvas ID: 199 @@ -2291,6 +2293,8 @@ Text Renderer Component: Text: My name is Brandon. Font: 176667660 + Color: {x: 1, y: 1, z: 1, w: 1} + Text Size: {x: 1, y: 1, z: 1} IsActive: true UI Component: Canvas ID: 199 @@ -2311,6 +2315,8 @@ Text Renderer Component: Text: X2 Font: 174412429 + Color: {x: 1, y: 1, z: 1, w: 1} + Text Size: {x: 1, y: 1, z: 1} IsActive: true UI Component: Canvas ID: 199 @@ -4954,6 +4960,8 @@ Text Renderer Component: Text: Game Pause Font: 176667660 + Color: {x: 1, y: 1, z: 1, w: 1} + Text Size: {x: 1, y: 1, z: 1} IsActive: false UI Component: Canvas ID: 10 diff --git a/Assets/Scenes/Scene2.shade b/Assets/Scenes/Scene2.shade index de902c55..891c9664 100644 --- a/Assets/Scenes/Scene2.shade +++ b/Assets/Scenes/Scene2.shade @@ -14,10 +14,10 @@ Yaw: 0 Roll: 0 Width: 1200 - Height: 1080 Near: 0.00999999978 Far: 10000 Perspective: true + FOV: 90 IsActive: true Scripts: ~ - EID: 1 @@ -26,9 +26,9 @@ NumberOfChildren: 1 Components: Transform Component: - Translate: {x: -1.86388135, y: 0.0544953719, z: 0} - Rotate: {x: -0, y: 0, z: -0} - Scale: {x: 1, y: 1, z: 1} + Translate: {x: 0, y: 0.189419448, z: 0} + Rotate: {x: 0.00523597933, y: -2.96353412, z: -6.40293041e-10} + Scale: {x: 1.00000191, y: 1, z: 1.00000191} IsActive: true Renderable Component: Mesh: 149697411 @@ -55,10 +55,15 @@ IsActive: true NumberOfChildren: 0 Components: + Transform Component: + Translate: {x: 0, y: 1.82978272, z: -3.28967047} + Rotate: {x: -0, y: 0, z: -0} + Scale: {x: 1, y: 1, z: 1} + IsActive: true Light Component: Position: {x: 3, y: 4.5, z: 7} Type: Directional - Direction: {x: -0.298000008, y: 0.522498012, z: 0.798600018} + Direction: {x: 0, y: 0, z: 1} Color: {x: 1, y: 1, z: 1, w: 1} Layer: 4294967295 Strength: 0 @@ -85,8 +90,8 @@ Components: Transform Component: Translate: {x: 0, y: 0.0810000002, z: 0} - Rotate: {x: -1.57079637, y: 0, z: 0} - Scale: {x: 50, y: 50, z: 50} + Rotate: {x: -1.57079625, y: 0, z: -0} + Scale: {x: 50, y: 49.9999924, z: 49.9999924} IsActive: true Renderable Component: Mesh: 141771688 diff --git a/Assets/Shaders/DeferredComposite_CS.glsl b/Assets/Shaders/DeferredComposite_CS.glsl index f17c9d84..12352d4d 100644 --- a/Assets/Shaders/DeferredComposite_CS.glsl +++ b/Assets/Shaders/DeferredComposite_CS.glsl @@ -78,8 +78,12 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV float pMax = LinStep (variance / (variance + (d * d)), 0.9f, 1.0f); return min (max (p, pMax), 1.0f); } + else if (fragPosLightPOV.z > 1.0f) + { + return 0.0f; + } else - return 1.0f; + return 0.3f; // return step (fragPosLightPOV.z, ); } @@ -125,7 +129,7 @@ void main() vec3 dLightNormalized = normalize (DirLightData.dLightData[i].direction); // Get diffuse strength - float diffuseStrength = max (0, dot (dLightNormalized, normalView)); + float diffuseStrength = max (0, dot (-dLightNormalized, normalView)); // Calculate the fragment color fragColor += DirLightData.dLightData[i].diffuseColor.rgb * diffuseStrength.rrr * pixelDiffuse; diff --git a/Assets/Shaders/DeferredComposite_CS.shshaderb b/Assets/Shaders/DeferredComposite_CS.shshaderb index e5a0a730..a5197b3b 100644 Binary files a/Assets/Shaders/DeferredComposite_CS.shshaderb and b/Assets/Shaders/DeferredComposite_CS.shshaderb differ diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp index e7f1ae68..e3d30812 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp @@ -128,7 +128,7 @@ namespace SHADE SHFreetypeInstance::Init(); - //SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false); + SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false); @@ -671,19 +671,19 @@ namespace SHADE static bool shadowAdded = false; - //if (shadowAdded == false && SHInputManager::GetKey(SHInputManager::SH_KEYCODE::B)) - //{ - // shadowAdded = true; - // auto& lightComps = SHComponentManager::GetDense(); - // //if (lightComps.size() > 2) - // //{ - // // lightComps[2].SetEnableShadow(true); - // //} - // for (auto& comp : lightComps) - // { - // comp.SetEnableShadow(true); - // } - //} + if (shadowAdded == false && SHInputManager::GetKey(SHInputManager::SH_KEYCODE::B)) + { + shadowAdded = true; + auto& lightComps = SHComponentManager::GetDense(); + //if (lightComps.size() > 2) + //{ + // lightComps[2].SetEnableShadow(true); + //} + for (auto& comp : lightComps) + { + comp.SetEnableShadow(true); + } + } renderGraph->Begin(frameIndex); auto cmdBuffer = renderGraph->GetCommandBuffer(frameIndex); diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.cpp index 6f8a9030..cace495c 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.cpp @@ -398,7 +398,10 @@ namespace SHADE { SHTransformComponent* transform = SHComponentManager::GetComponent(lightComp->GetEID()); - return SHMatrix::Transpose(SHMatrix::LookAtLH(transform->GetWorldPosition(), SHVec3::Normalise(lightComp->GetLightData().direction), SHVec3(0.0f, -1.0f, 0.0f))); + if (transform) + return SHMatrix::Transpose(SHMatrix::LookAtLH(transform->GetWorldPosition(), SHVec3::Normalise(lightComp->GetLightData().direction), SHVec3(0.0f, -1.0f, 0.0f))); + else + return{}; } //return SHMatrix::Transpose(SHMatrix::LookAtLH(/*lightComp->GetLightData().position*/SHVec3(1.27862f, 4.78952f, 4.12811f), SHVec3(-0.280564f, -0.66262f, -0.69422f), SHVec3(0.0f, -1.0f, 0.0f))); case SH_LIGHT_TYPE::POINT: diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.h b/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.h index 7794a2fb..69b00f2c 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Lights/SHLightingSubSystem.h @@ -73,8 +73,8 @@ namespace SHADE public: using DynamicOffsetArray = std::array, static_cast(SHGraphicsConstants::NUM_FRAME_BUFFERS)>; static constexpr uint32_t MAX_SHADOWS = 200; - static constexpr uint32_t SHADOW_MAP_WIDTH = 1024; - static constexpr uint32_t SHADOW_MAP_HEIGHT = 1024; + static constexpr uint32_t SHADOW_MAP_WIDTH = 2048; + static constexpr uint32_t SHADOW_MAP_HEIGHT = 2048; private: class PerTypeData diff --git a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp index d45789ce..14a5d864 100644 --- a/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp +++ b/SHADE_Engine/src/Graphics/RenderGraph/SHSubpass.cpp @@ -78,6 +78,7 @@ namespace SHADE , viewport {rhs.viewport} , renderer {rhs.renderer} , companionSubpass {rhs.companionSubpass} + , dummyPipelineLayout{rhs.dummyPipelineLayout} { } @@ -115,6 +116,7 @@ namespace SHADE renderer = rhs.renderer; viewport = rhs.viewport; companionSubpass = rhs.companionSubpass; + dummyPipelineLayout = rhs.dummyPipelineLayout; return *this; @@ -457,17 +459,20 @@ namespace SHADE /***************************************************************************/ void SHSubpass::GenerateDummyPipielineLayout(void) noexcept { - auto const& batchingSystemData = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING); - std::vector newLayouts = batchingSystemData.descSetLayouts; - if (inputDescriptorLayout) + if (!dummyPipelineLayout) { - newLayouts.push_back(inputDescriptorLayout); - } + auto const& batchingSystemData = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING); + std::vector newLayouts = batchingSystemData.descSetLayouts; + if (inputDescriptorLayout) + { + newLayouts.push_back(inputDescriptorLayout); + } - dummyPipelineLayout = graphStorage->logicalDevice->CreatePipelineLayoutDummy - ( - SHPipelineLayoutParamsDummy{ newLayouts } - ); + dummyPipelineLayout = graphStorage->logicalDevice->CreatePipelineLayoutDummy + ( + SHPipelineLayoutParamsDummy{ newLayouts } + ); + } } /***************************************************************************/