Skip to content

Commit

Permalink
PopcornFX Gem 2.14.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ValPKFX committed Nov 14, 2022
1 parent 4a88ef7 commit ac83b88
Show file tree
Hide file tree
Showing 18 changed files with 133 additions and 160 deletions.
6 changes: 3 additions & 3 deletions Assets/passes/PKPassTemplates.azasset
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"AssetPaths": [
{
"Name": "DistortionParentTemplate",
"Path": "Passes/DistortionParent.pass"
"Path": "passes/DistortionParent.pass"
},
{
"Name": "DistortionPostProcessPassTemplate",
"Path": "Passes/DistortionPostProcess.pass"
"Path": "passes/DistortionPostProcess.pass"
},
{
"Name": "DistortionAccumulationPassTemplate",
"Path": "Passes/DistortionAccumulation.pass"
"Path": "passes/DistortionAccumulation.pass"
}
]
}
Expand Down
7 changes: 7 additions & 0 deletions Assets/shaders/Common/LightingHelper.azsli
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#endif

#include <Atom/Features/PBR/Lighting/StandardLighting.azsli>
#if PK_O3DE_NEW_PBR
#include <Atom/Features/PBR/Lights/IblForward.azsli>
#endif
#include <Atom/Features/PBR/Decals.azsli>
#include <Atom/Features/ColorManagement/TransformColor.azsli>

Expand Down Expand Up @@ -138,7 +141,11 @@ ForwardPassOutput ComputeParticleLighting(float3 worldPosition,
#endif

// Apply Image Based Lighting (IBL)
#if PK_O3DE_NEW_PBR
ApplyIblForward(surface, lightingData);
#else
ApplyIBL(surface, lightingData);
#endif

// Finalize Lighting
lightingData.FinalizeLighting();
Expand Down
2 changes: 1 addition & 1 deletion Code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://www.popcornfx.com/terms-and-conditions/
#----------------------------------------------------------------------------

set(POPCORNFX_VERSION 2.14.1)
set(POPCORNFX_VERSION 2.14.2)
set(POPCORNFX_LICENSE O3DE)

if (PK_O3DE_MAJOR_VERSION GREATER_EQUAL 2205)
Expand Down
12 changes: 12 additions & 0 deletions Code/Include/PopcornFX/PopcornFXBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,18 @@ namespace PopcornFX

// Change threadpool
virtual void SetBakingThreadpool() = 0;

// Extract Payloads
virtual AZStd::tuple<float, bool> ExtractPayloadFloat(const AZStd::string &payloadName) = 0;
virtual AZStd::tuple<AZ::Vector2, bool> ExtractPayloadFloat2(const AZStd::string &payloadName) = 0;
virtual AZStd::tuple<AZ::Vector3, bool> ExtractPayloadFloat3(const AZStd::string &payloadName) = 0;
virtual AZStd::tuple<AZ::Vector4, bool> ExtractPayloadFloat4(const AZStd::string &payloadName) = 0;
virtual AZStd::tuple<AZ::u32, bool> ExtractPayloadInt(const AZStd::string &payloadName) = 0;
virtual AZStd::tuple<AZ::Vector2, bool> ExtractPayloadInt2(const AZStd::string &payloadName) = 0;
virtual AZStd::tuple<AZ::Vector3, bool> ExtractPayloadInt3(const AZStd::string &payloadName) = 0;
virtual AZStd::tuple<AZ::Vector4, bool> ExtractPayloadInt4(const AZStd::string &payloadName) = 0;
virtual AZStd::tuple<bool, bool> ExtractPayloadBool(const AZStd::string &payloadName) = 0;
virtual AZStd::tuple<AZ::Quaternion, bool> ExtractPayloadOrientation(const AZStd::string &payloadName) = 0;
};
using PopcornFXRequestBus = AZ::EBus<PopcornFXRequests>;

Expand Down
2 changes: 1 addition & 1 deletion Code/Platform/Linux/PAL_linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
#----------------------------------------------------------------------------

set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages")
ly_associate_package(PACKAGE_NAME PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-linux TARGETS PopcornFX PACKAGE_HASH 0b1c22603a9dadd5f59ed949ef8fcfdbb6c4ab013caf9d879276991a7b5dc307)
ly_associate_package(PACKAGE_NAME PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-linux TARGETS PopcornFX PACKAGE_HASH 7d68c9e8116e37e2fcb2c4895ce6069c510ffb0bef9e265c63a8acae1051bd54)
set(PAL_TRAIT_POPCORNFX_SUPPORTED TRUE)
2 changes: 1 addition & 1 deletion Code/Platform/Mac/PAL_mac.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
#----------------------------------------------------------------------------

set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages")
ly_associate_package(PACKAGE_NAME PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-mac TARGETS PopcornFX PACKAGE_HASH 663694a31ab72ffa1876c8e6c0112c3b6e2dc033e0bf53f83d1db0ce48ac06e0)
ly_associate_package(PACKAGE_NAME PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-mac TARGETS PopcornFX PACKAGE_HASH cf4b4398414b2e54ac10006b2eb020cf5f46df96c141f0b6fe470e27b9df5d38)
set(PAL_TRAIT_POPCORNFX_SUPPORTED TRUE)
2 changes: 1 addition & 1 deletion Code/Platform/Windows/PAL_windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
#----------------------------------------------------------------------------

set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages")
ly_associate_package(PACKAGE_NAME PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-windows TARGETS PopcornFX PACKAGE_HASH b39c280d68428e54eaf0ccfe27faac87fc8875f82b6b1ebaacba6e2753777545)
ly_associate_package(PACKAGE_NAME PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-windows TARGETS PopcornFX PACKAGE_HASH 719e3d6b3f1fe25c53ec80e6b274fd064f6077af232fa4d1baccd587b5f52e0f)
set(PAL_TRAIT_POPCORNFX_SUPPORTED TRUE)
5 changes: 5 additions & 0 deletions Code/Source/Integration/Editor/PackLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <AzFramework/IO/LocalFileIO.h>
#include <AzFramework/FileFunc/FileFunc.h>
#include <AzCore/std/function/function_template.h>
#include <AzCore/std/string/conversions.h>

#include <pk_kernel/include/kr_file.h>
#include <pk_kernel/include/kr_resources.h>
Expand Down Expand Up @@ -101,6 +102,8 @@ namespace PopcornFX
if (!GetProjectSettings(path, rootPath, dummy))
return "";

AZStd::to_lower(rootPath.begin(), rootPath.end());
AZStd::to_lower(folderPath.begin(), folderPath.end());
const AZ::IO::PathView pathView(folderPath);
if (pathView.IsRelativeTo(AZ::IO::PathView(rootPath)))
return path;
Expand Down Expand Up @@ -260,6 +263,8 @@ namespace PopcornFX
AZ::StringFunc::Path::Normalize(folderPath);
folderPath = CFilePath::Relativize(projectPath.c_str(), folderPath.c_str()).Data();

AZStd::to_lower(rootPath.begin(), rootPath.end());
AZStd::to_lower(folderPath.begin(), folderPath.end());
const AZ::IO::PathView pathView(folderPath);
if (pathView.IsRelativeTo(AZ::IO::PathView(rootPath)))
return false;
Expand Down
73 changes: 73 additions & 0 deletions Code/Source/Integration/PopcornFXIntegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,79 @@ void PopcornFXIntegration::SetBakingThreadpool()
Scheduler::SetThreadPool(pool);
}

#define EXTRACT_PAYLOAD_IMPLEM(TYPE_NAME, TYPE, DEFAULT_VALUE, VALUE)\
AZStd::tuple<TYPE, bool> PopcornFXIntegration::ExtractPayload##TYPE_NAME(const AZStd::string &payloadName)\
{\
const PopcornFX::SPayloadValue *payloadValue;\
PopcornFX::PopcornFXIntegrationBus::BroadcastResult(payloadValue, &PopcornFX::PopcornFXIntegrationBus::Handler::GetCurrentPayloadValue, payloadName);\
if (payloadValue == null)\
{\
AZ_Warning("PopcornFX", false, "Payload %s not found", payloadName.c_str());\
return AZStd::tuple<TYPE, bool>(DEFAULT_VALUE, false);\
}\
return AZStd::tuple<TYPE, bool>(VALUE, true);\
}\

EXTRACT_PAYLOAD_IMPLEM(
Float,
float,
0.0f,
payloadValue->m_ValueFloat[0]);

EXTRACT_PAYLOAD_IMPLEM(
Float2,
AZ::Vector2,
AZ::Vector2(0.0f),
AZ::Vector2(payloadValue->m_ValueFloat[0], payloadValue->m_ValueFloat[1]));

EXTRACT_PAYLOAD_IMPLEM(
Float3,
AZ::Vector3,
AZ::Vector3(0.0f),
AZ::Vector3(payloadValue->m_ValueFloat[0], payloadValue->m_ValueFloat[1], payloadValue->m_ValueFloat[2]));

EXTRACT_PAYLOAD_IMPLEM(
Float4,
AZ::Vector4,
AZ::Vector4(0.0f),
AZ::Vector4(payloadValue->m_ValueFloat[0], payloadValue->m_ValueFloat[1], payloadValue->m_ValueFloat[2], payloadValue->m_ValueFloat[3]));

EXTRACT_PAYLOAD_IMPLEM(
Int,
AZ::u32,
0,
payloadValue->m_ValueInt[0]);

EXTRACT_PAYLOAD_IMPLEM(
Int2,
AZ::Vector2,
AZ::Vector2(0.0f),
AZ::Vector2(static_cast<float>(payloadValue->m_ValueInt[0]), static_cast<float>(payloadValue->m_ValueInt[1])));

EXTRACT_PAYLOAD_IMPLEM(
Int3,
AZ::Vector3,
AZ::Vector3(0.0f),
AZ::Vector3(static_cast<float>(payloadValue->m_ValueInt[0]), static_cast<float>(payloadValue->m_ValueInt[1]), static_cast<float>(payloadValue->m_ValueInt[2])));

EXTRACT_PAYLOAD_IMPLEM(
Int4,
AZ::Vector4,
AZ::Vector4(0.0f),
AZ::Vector4(static_cast<float>(payloadValue->m_ValueInt[0]), static_cast<float>(payloadValue->m_ValueInt[1]), static_cast<float>(payloadValue->m_ValueInt[2]), static_cast<float>(payloadValue->m_ValueInt[3])));

EXTRACT_PAYLOAD_IMPLEM(
Bool,
bool,
false,
payloadValue->m_ValueBool[0]);

EXTRACT_PAYLOAD_IMPLEM(
Orientation,
AZ::Quaternion,
AZ::Quaternion::CreateIdentity(),
AZ::Quaternion(payloadValue->m_ValueFloat[0], payloadValue->m_ValueFloat[1], payloadValue->m_ValueFloat[2], payloadValue->m_ValueFloat[3]));

}

#endif //O3DE_USE_PK
12 changes: 12 additions & 0 deletions Code/Source/Integration/PopcornFXIntegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,18 @@ namespace PopcornFX {
virtual float GetLODBias() override;
virtual void SetLODBias(float bias) override;
virtual void SetBakingThreadpool() override;

virtual AZStd::tuple<float, bool> ExtractPayloadFloat(const AZStd::string &payloadName) override;
virtual AZStd::tuple<AZ::Vector2, bool> ExtractPayloadFloat2(const AZStd::string &payloadName) override;
virtual AZStd::tuple<AZ::Vector3, bool> ExtractPayloadFloat3(const AZStd::string &payloadName) override;
virtual AZStd::tuple<AZ::Vector4, bool> ExtractPayloadFloat4(const AZStd::string &payloadName) override;
virtual AZStd::tuple<AZ::u32, bool> ExtractPayloadInt(const AZStd::string &payloadName) override;
virtual AZStd::tuple<AZ::Vector2, bool> ExtractPayloadInt2(const AZStd::string &payloadName) override;
virtual AZStd::tuple<AZ::Vector3, bool> ExtractPayloadInt3(const AZStd::string &payloadName) override;
virtual AZStd::tuple<AZ::Vector4, bool> ExtractPayloadInt4(const AZStd::string &payloadName) override;
virtual AZStd::tuple<bool, bool> ExtractPayloadBool(const AZStd::string &payloadName) override;
virtual AZStd::tuple<AZ::Quaternion, bool> ExtractPayloadOrientation(const AZStd::string &payloadName) override;

////////////////////////////////////////////////////////////////////////
void _LoadPassTemplateMappings();
AZ::RPI::PassSystemInterface::OnReadyLoadTemplatesEvent::Handler m_LoadTemplatesHandler;
Expand Down
4 changes: 2 additions & 2 deletions Code/Source/Integration/Preloader/PopcornFXRendererLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ void PopcornFXRendererLoader::_OnShaderVariantsReloaded(const AZ::Data::AssetId
return;
}

bool variantFound = false;
//bool variantFound = false;

for (const SAssetDependencies::SCaches &cache : dependencies->m_Caches)
{
Expand Down Expand Up @@ -539,7 +539,7 @@ void PopcornFXRendererLoader::_OnShaderVariantsReloaded(const AZ::Data::AssetId
AZ::RHI::ConstPtr<AZ::RHI::PipelineState> &pipelineStateSlot = _GetPipelineStateSlot(cache.m_Type, *pipelineStateCache);
pipelineStateSlot = _CreatePipelineStateCache(*shader, shaderVariant, cache.m_Type, cache.m_PipelineStateKey);
(*pipelineStateCache)->m_Modified = true;
variantFound = true;
//variantFound = true;
}
}
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void *CMeshResourceHandler::Load( const CResourceManager *resourceManager,
{
dstNormals = vstream.Normals();
PK_RELEASE_ASSERT(!dstNormals.Empty());
PK_RELEASE_ASSERT(Mem::IsAligned<0x10>(dstNormals.Data()) & Mem::IsAligned<0x10>(dstNormals.Stride()));
PK_RELEASE_ASSERT(Mem::IsAligned<0x10>(dstNormals.Data()) && Mem::IsAligned<0x10>(dstNormals.Stride()));
}

TStridedMemoryView<CFloat2> dstUvs;
Expand All @@ -175,7 +175,7 @@ void *CMeshResourceHandler::Load( const CResourceManager *resourceManager,
{
dstTangents = vstream.Tangents();
PK_RELEASE_ASSERT(!dstTangents.Empty());
PK_RELEASE_ASSERT(Mem::IsAligned<0x10>(dstTangents.Data()) & Mem::IsAligned<0x10>(dstTangents.Stride()));
PK_RELEASE_ASSERT(Mem::IsAligned<0x10>(dstTangents.Data()) && Mem::IsAligned<0x10>(dstTangents.Stride()));
}

TStridedMemoryView<CFloat4> dstColors;
Expand Down
10 changes: 10 additions & 0 deletions Code/Source/PopcornFXSystemComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ namespace PopcornFX {
->Event("IsEffectsPreloadingDone", &PopcornFXRequestBus::Events::IsEffectsPreloadingDone)
->Event("SpawnEmitterAtLocation", &PopcornFXRequestBus::Events::SpawnEmitterAtLocation)
->Event("SpawnEmitterEntityAtLocation", &PopcornFXRequestBus::Events::SpawnEmitterEntityAtLocation)
->Event("ExtractPayloadFloat", &PopcornFXRequestBus::Events::ExtractPayloadFloat)
->Event("ExtractPayloadFloat2", &PopcornFXRequestBus::Events::ExtractPayloadFloat2)
->Event("ExtractPayloadFloat3", &PopcornFXRequestBus::Events::ExtractPayloadFloat3)
->Event("ExtractPayloadFloat4", &PopcornFXRequestBus::Events::ExtractPayloadFloat4)
->Event("ExtractPayloadInt", &PopcornFXRequestBus::Events::ExtractPayloadInt)
->Event("ExtractPayloadInt2", &PopcornFXRequestBus::Events::ExtractPayloadInt2)
->Event("ExtractPayloadInt3", &PopcornFXRequestBus::Events::ExtractPayloadInt3)
->Event("ExtractPayloadInt4", &PopcornFXRequestBus::Events::ExtractPayloadInt4)
->Event("ExtractPayloadBool", &PopcornFXRequestBus::Events::ExtractPayloadBool)
->Event("ExtractPayloadOrientation", &PopcornFXRequestBus::Events::ExtractPayloadOrientation)
;

behaviorContext->EBus<PopcornFXProfilerRequestBus>("PopcornFXProfilerRequestBus")
Expand Down
Loading

0 comments on commit ac83b88

Please sign in to comment.