Merge pull request #393 from SHADE-DP/SP3-1-Rendering
Fixed publish rendering errors and improved shiny highlight shaders
This commit is contained in:
commit
e75b20f36b
|
@ -17,7 +17,7 @@
|
||||||
Light Component:
|
Light Component:
|
||||||
Position: {x: 0, y: 0, z: 0}
|
Position: {x: 0, y: 0, z: 0}
|
||||||
Type: Directional
|
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}
|
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
Layer: 4294967295
|
Layer: 4294967295
|
||||||
Strength: 1
|
Strength: 1
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
Yaw: 0
|
Yaw: 0
|
||||||
Roll: 0
|
Roll: 0
|
||||||
Width: 1200
|
Width: 1200
|
||||||
Height: 1080
|
|
||||||
Near: 0.00999999978
|
Near: 0.00999999978
|
||||||
Far: 10000
|
Far: 10000
|
||||||
Perspective: true
|
Perspective: true
|
||||||
|
FOV: 90
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 1
|
- EID: 1
|
||||||
|
@ -26,9 +26,9 @@
|
||||||
NumberOfChildren: 1
|
NumberOfChildren: 1
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: -1.86388135, y: 0.0544953719, z: 0}
|
Translate: {x: 0, y: 0.189419448, z: 0}
|
||||||
Rotate: {x: -0, y: 0, z: -0}
|
Rotate: {x: 0.00523597933, y: -2.96353412, z: -6.40293041e-10}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1.00000191, y: 1, z: 1.00000191}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 149697411
|
Mesh: 149697411
|
||||||
|
@ -55,10 +55,15 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components:
|
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:
|
Light Component:
|
||||||
Position: {x: 3, y: 4.5, z: 7}
|
Position: {x: 3, y: 4.5, z: 7}
|
||||||
Type: Directional
|
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}
|
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
Layer: 4294967295
|
Layer: 4294967295
|
||||||
Strength: 0
|
Strength: 0
|
||||||
|
@ -85,8 +90,8 @@
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 0, y: 0.0810000002, z: 0}
|
Translate: {x: 0, y: 0.0810000002, z: 0}
|
||||||
Rotate: {x: -1.57079637, y: 0, z: 0}
|
Rotate: {x: -1.57079625, y: 0, z: -0}
|
||||||
Scale: {x: 50, y: 50, z: 50}
|
Scale: {x: 50, y: 49.9999924, z: 49.9999924}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 141771688
|
Mesh: 141771688
|
||||||
|
|
|
@ -78,8 +78,12 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV
|
||||||
float pMax = LinStep (variance / (variance + (d * d)), 0.9f, 1.0f);
|
float pMax = LinStep (variance / (variance + (d * d)), 0.9f, 1.0f);
|
||||||
return min (max (p, pMax), 1.0f);
|
return min (max (p, pMax), 1.0f);
|
||||||
}
|
}
|
||||||
|
else if (fragPosLightPOV.z > 1.0f)
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return 1.0f;
|
return 0.3f;
|
||||||
// return step (fragPosLightPOV.z, );
|
// return step (fragPosLightPOV.z, );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +129,7 @@ void main()
|
||||||
vec3 dLightNormalized = normalize (DirLightData.dLightData[i].direction);
|
vec3 dLightNormalized = normalize (DirLightData.dLightData[i].direction);
|
||||||
|
|
||||||
// Get diffuse strength
|
// Get diffuse strength
|
||||||
float diffuseStrength = max (0, dot (dLightNormalized, normalView));
|
float diffuseStrength = max (0, dot (-dLightNormalized, normalView));
|
||||||
|
|
||||||
// Calculate the fragment color
|
// Calculate the fragment color
|
||||||
fragColor += DirLightData.dLightData[i].diffuseColor.rgb * diffuseStrength.rrr * pixelDiffuse;
|
fragColor += DirLightData.dLightData[i].diffuseColor.rgb * diffuseStrength.rrr * pixelDiffuse;
|
||||||
|
|
Binary file not shown.
|
@ -78,8 +78,14 @@ void main()
|
||||||
outEntityID = In2.eid;
|
outEntityID = In2.eid;
|
||||||
lightLayerIndices = In2.lightLayerIndex;
|
lightLayerIndices = In2.lightLayerIndex;
|
||||||
|
|
||||||
float vpHeight = float (In2.screenSpacePos.y) - MatProp.data[In2.materialIndex].highlightPosition;
|
// float vpHeight = float (In2.screenSpacePos.y) - MatProp.data[In2.materialIndex].highlightPosition;
|
||||||
vpHeight = float (int (vpHeight) % genericDataBuffer.data.viewportHeight);
|
// bring the frame of reference to the object's screen space pos
|
||||||
|
int scale = 470;
|
||||||
|
float vpHeight = float (In2.screenSpacePos.y);
|
||||||
|
float relativePos = float(int (-MatProp.data[In2.materialIndex].highlightPosition) % scale) - float (scale / 2);
|
||||||
|
vpHeight += relativePos;
|
||||||
|
|
||||||
|
// vpHeight = float (int (vpHeight) % genericDataBuffer.data.viewportHeight);
|
||||||
float scanlineScale = MatProp.data[In2.materialIndex].thickness * (1.0f - In2.screenSpacePos.z) * 100.0f;
|
float scanlineScale = MatProp.data[In2.materialIndex].thickness * (1.0f - In2.screenSpacePos.z) * 100.0f;
|
||||||
|
|
||||||
float lowerLimit = vpHeight - scanlineScale;
|
float lowerLimit = vpHeight - scanlineScale;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#extension GL_ARB_shading_language_420pack : enable
|
#extension GL_ARB_shading_language_420pack : enable
|
||||||
#extension GL_EXT_nonuniform_qualifier : require
|
#extension GL_EXT_nonuniform_qualifier : require
|
||||||
|
|
||||||
layout (input_attachment_index = 0, set = 3, binding = 0) uniform subpassInput sceneTexture;
|
layout (input_attachment_index = 0, set = 0, binding = 0) uniform subpassInput sceneTexture;
|
||||||
|
|
||||||
|
|
||||||
layout(location = 0) out vec4 fragColor;
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
Binary file not shown.
|
@ -669,7 +669,7 @@ namespace SHADE
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool shadowAdded = false;
|
//static bool shadowAdded = false;
|
||||||
|
|
||||||
//if (shadowAdded == false && SHInputManager::GetKey(SHInputManager::SH_KEYCODE::B))
|
//if (shadowAdded == false && SHInputManager::GetKey(SHInputManager::SH_KEYCODE::B))
|
||||||
//{
|
//{
|
||||||
|
|
|
@ -398,7 +398,10 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
SHTransformComponent* transform = SHComponentManager::GetComponent<SHTransformComponent>(lightComp->GetEID());
|
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)));
|
//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:
|
case SH_LIGHT_TYPE::POINT:
|
||||||
|
|
|
@ -73,8 +73,8 @@ namespace SHADE
|
||||||
public:
|
public:
|
||||||
using DynamicOffsetArray = std::array<std::vector<uint32_t>, static_cast<uint32_t>(SHGraphicsConstants::NUM_FRAME_BUFFERS)>;
|
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 MAX_SHADOWS = 200;
|
||||||
static constexpr uint32_t SHADOW_MAP_WIDTH = 1024;
|
static constexpr uint32_t SHADOW_MAP_WIDTH = 2048;
|
||||||
static constexpr uint32_t SHADOW_MAP_HEIGHT = 1024;
|
static constexpr uint32_t SHADOW_MAP_HEIGHT = 2048;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class PerTypeData
|
class PerTypeData
|
||||||
|
|
|
@ -512,9 +512,9 @@ namespace SHADE
|
||||||
uint32_t h = static_cast<uint32_t>(resource->GetHeight());
|
uint32_t h = static_cast<uint32_t>(resource->GetHeight());
|
||||||
cmdBuffer->SetViewportScissor(static_cast<float>(w), static_cast<float>(h), w, h);
|
cmdBuffer->SetViewportScissor(static_cast<float>(w), static_cast<float>(h), w, h);
|
||||||
|
|
||||||
//static constexpr uint32_t INPUT_IMAGE_SET_INDEX = 0;
|
static constexpr uint32_t INPUT_IMAGE_SET_INDEX = 0;
|
||||||
auto const& mappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
//auto const& mappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
||||||
newSubpass->BindInputDescriptorSets (cmdBuffer, mappings.at(SHPredefinedDescriptorTypes::RENDER_GRAPH_RESOURCE), frameIndex);
|
newSubpass->BindInputDescriptorSets (cmdBuffer, INPUT_IMAGE_SET_INDEX, frameIndex);
|
||||||
|
|
||||||
// draw a quad.
|
// draw a quad.
|
||||||
cmdBuffer->DrawArrays(4, 1, 0, 0);
|
cmdBuffer->DrawArrays(4, 1, 0, 0);
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace SHADE
|
||||||
|
|
||||||
void SHRenderToSwapchainImageSystem::ConstructPipelines(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
void SHRenderToSwapchainImageSystem::ConstructPipelines(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
||||||
{
|
{
|
||||||
auto pipelineLayout = logicalDevice->CreatePipelineLayout(SHPipelineLayoutParams
|
pipelineLayout = logicalDevice->CreatePipelineLayout(SHPipelineLayoutParams
|
||||||
{
|
{
|
||||||
.shaderModules = {shaderModules.first, shaderModules.second},
|
.shaderModules = {shaderModules.first, shaderModules.second},
|
||||||
.predefinedDescSetLayouts = {}
|
.predefinedDescSetLayouts = {}
|
||||||
|
|
|
@ -78,6 +78,7 @@ namespace SHADE
|
||||||
, viewport {rhs.viewport}
|
, viewport {rhs.viewport}
|
||||||
, renderer {rhs.renderer}
|
, renderer {rhs.renderer}
|
||||||
, companionSubpass {rhs.companionSubpass}
|
, companionSubpass {rhs.companionSubpass}
|
||||||
|
, dummyPipelineLayout{rhs.dummyPipelineLayout}
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -115,6 +116,7 @@ namespace SHADE
|
||||||
renderer = rhs.renderer;
|
renderer = rhs.renderer;
|
||||||
viewport = rhs.viewport;
|
viewport = rhs.viewport;
|
||||||
companionSubpass = rhs.companionSubpass;
|
companionSubpass = rhs.companionSubpass;
|
||||||
|
dummyPipelineLayout = rhs.dummyPipelineLayout;
|
||||||
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -457,17 +459,20 @@ namespace SHADE
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
void SHSubpass::GenerateDummyPipielineLayout(void) noexcept
|
void SHSubpass::GenerateDummyPipielineLayout(void) noexcept
|
||||||
{
|
{
|
||||||
auto const& batchingSystemData = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING);
|
if (!dummyPipelineLayout)
|
||||||
std::vector newLayouts = batchingSystemData.descSetLayouts;
|
|
||||||
if (inputDescriptorLayout)
|
|
||||||
{
|
{
|
||||||
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
|
dummyPipelineLayout = graphStorage->logicalDevice->CreatePipelineLayoutDummy
|
||||||
(
|
(
|
||||||
SHPipelineLayoutParamsDummy{ newLayouts }
|
SHPipelineLayoutParamsDummy{ newLayouts }
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue