Fixed publish rendering errors and improved shiny highlight shaders #393

Merged
Xenosas1337 merged 5 commits from SP3-1-Rendering into main 2023-03-04 16:01:18 +08:00
8 changed files with 61 additions and 36 deletions
Showing only changes of commit 166e13a339 - Show all commits

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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<SHLightComponent>();
// //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<SHLightComponent>();
//if (lightComps.size() > 2)
//{
// lightComps[2].SetEnableShadow(true);
//}
for (auto& comp : lightComps)
{
comp.SetEnableShadow(true);
}
}
renderGraph->Begin(frameIndex);
auto cmdBuffer = renderGraph->GetCommandBuffer(frameIndex);

View File

@ -398,7 +398,10 @@ namespace SHADE
{
SHTransformComponent* transform = SHComponentManager::GetComponent<SHTransformComponent>(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:

View File

@ -73,8 +73,8 @@ namespace SHADE
public:
using DynamicOffsetArray = std::array<std::vector<uint32_t>, static_cast<uint32_t>(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

View File

@ -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 }
);
}
}
/***************************************************************************/