Fixed shiny highlight shaders

This commit is contained in:
Brandon Mak 2023-03-04 15:55:04 +08:00
parent 7eb4921b33
commit 13f28d6bdb
2 changed files with 23 additions and 17 deletions

View File

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

View File

@ -128,7 +128,7 @@ namespace SHADE
SHFreetypeInstance::Init(); 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/ShadowMap_FS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
@ -669,21 +669,21 @@ 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))
{
shadowAdded = true;
auto& lightComps = SHComponentManager::GetDense<SHLightComponent>();
//if (lightComps.size() > 2)
//{ //{
// lightComps[2].SetEnableShadow(true); // shadowAdded = true;
// auto& lightComps = SHComponentManager::GetDense<SHLightComponent>();
// //if (lightComps.size() > 2)
// //{
// // lightComps[2].SetEnableShadow(true);
// //}
// for (auto& comp : lightComps)
// {
// comp.SetEnableShadow(true);
// }
//} //}
for (auto& comp : lightComps)
{
comp.SetEnableShadow(true);
}
}
renderGraph->Begin(frameIndex); renderGraph->Begin(frameIndex);
auto cmdBuffer = renderGraph->GetCommandBuffer(frameIndex); auto cmdBuffer = renderGraph->GetCommandBuffer(frameIndex);