Hair - ShortCut rendering technique and pipeline with Marschner lighting model (#4871)

- This rendering technique reduces the memory required per pipeline by 750MB compared to the PPLL technique!!
- Using 3 screen buffers representing the closest 3 hair gragments depths.
- Going through second geometry pass that disqualify any fragment further than the third depth, the technique blends the three closes shaders hair fragments.
- Supports the Marschner lighting model (big change from the original TressFX 4.1 implementation)
- The current technique is almost twice the performance of the PPLL but not quite as advacned when come to final visual quality.

Remarks:
Unlike the PPLL, this technique is still lacking some of the advanced features added to the PPLL such as
1. Back lobe (TT) conseal by depth comparison
2. Thickness dependency in light transfer (mainly TT)
3. Allowing TT transfer for thin separated hair strands (might be supported by default with no distinction)

Signed-off-by: Adi-Amazon <Adi Bar-Lev 82479970+Adi-Amazon@users.noreply.github.com>
Signed-off-by: Adi-Amazon <Adi Bar-Lev barlev@amazon.com>
Signed-off-by: Adi-Amazon <Adi Bar-Lev 82479970+Adi-Amazon@users.noreply.github.com>
Signed-off-by: Adi-Amazon <Adi Bar-Lev barlev@amazon.com>

Co-authored-by: Adi-Amazon <Adi Bar-Lev 82479970+Adi-Amazon@users.noreply.github.com>
This commit is contained in:
Adi Bar-Lev
2021-10-21 14:29:53 -04:00
committed by GitHub
parent 546102077f
commit 64bbc700fa
40 changed files with 2055 additions and 225 deletions
@@ -165,6 +165,15 @@ namespace AZ
return true;
}
Data::Instance<RPI::Shader> HairGeometryRasterPass::GetShader()
{
if (!m_initialized || !m_shader)
{
AZ_Error("Hair Gem", LoadShaderAndPipelineState(), "HairGeometryRasterPass could not initialize pipeline or shader");
}
return m_shader;
}
void HairGeometryRasterPass::SchedulePacketBuild(HairRenderObject* hairObject)
{
m_newRenderObjects.insert(hairObject);
@@ -188,7 +197,7 @@ namespace AZ
// The PerPass is gathered through the RasterPass::m_shaderResourceGroup
AZStd::lock_guard<AZStd::mutex> lock(m_mutex);
return hairObject->BuildPPLLDrawPacket(drawRequest);
return hairObject->BuildDrawPacket(m_shader.get(), drawRequest);
}
bool HairGeometryRasterPass::AddDrawPackets(AZStd::list<Data::Instance<HairRenderObject>>& hairRenderObjects)
@@ -205,7 +214,7 @@ namespace AZ
for (auto& renderObject : hairRenderObjects)
{
const RHI::DrawPacket* drawPacket = renderObject->GetFillDrawPacket();
const RHI::DrawPacket* drawPacket = renderObject->GetGeometrylDrawPacket(m_shader.get());
if (!drawPacket)
{ // might not be an error - the object might have just been added and the DrawPacket is
// scheduled to be built when the render frame begins