From 166e13a33916222b77d2b36dda5abf1e819015fb Mon Sep 17 00:00:00 2001 From: Brandon Mak Date: Fri, 3 Mar 2023 22:01:34 +0800 Subject: [PATCH] Shadows WIP - Light direction in 2nd level changed --- Assets/Scenes/Level2.shade | 10 ++++++- Assets/Scenes/Scene2.shade | 19 +++++++----- Assets/Shaders/DeferredComposite_CS.glsl | 8 +++-- Assets/Shaders/DeferredComposite_CS.shshaderb | Bin 9949 -> 10101 bytes .../MiddleEnd/Interface/SHGraphicsSystem.cpp | 28 +++++++++--------- .../MiddleEnd/Lights/SHLightingSubSystem.cpp | 5 +++- .../MiddleEnd/Lights/SHLightingSubSystem.h | 4 +-- .../src/Graphics/RenderGraph/SHSubpass.cpp | 23 ++++++++------ 8 files changed, 61 insertions(+), 36 deletions(-) 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 e5a0a7303892bd790d631d8261d5fe2977587f76..a5197b3bb424b07718a21240adc9134a72f08195 100644 GIT binary patch literal 10101 zcmZ{n36xw_5r$uqnVt{=ggp_6lLRC}hzSM)1PEDR2u?_1AcQq^W_l(KJ<~%^&m;j9 zP*Ggi6px}FIfu;!RKOiKKycspecy3K7DWNS@Aa+t=%beu_19l@tLol&?|VJnwS%*K zOqw{SE6XNiQ?gyMODD9r-Lr`>S*Biy-Z?Afc2Dp6-ua`={`rfJSYYI?*(6o&+l`n` za0fC}t`5t;6PX4tw|kDYTk(^aI}!W&6=Lx6F2pZjBFZhZm(4~)vCjl zP5sqIrLS2XuNXJE5LX@UtBv&+13HN)*6+-^vZ>VQtq!kmRz~IyEL_t12iHmcozUau zT8^iHYxS+*4%VAxTdIRwP}ozl8R!+|THpFD<^KBC4dvQcW$x(V3zv)!ELt)&uxQbe zJgzg_2R)j{tS*n_TvxU)dTYH=>t8=o?yH>CC=af!kLJFPY&yC|o#xsN)G1{?l7Uu4 zZ%(g~@5~N^@2d}wR~pSqf0}zNdZ<2B8E%deF)4GyTQxhgCV0HusFsKO*tOPLFGI)N zE5ReH%iCJMj_exka-%$icKz43+1E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ics/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 } + ); + } } /***************************************************************************/