Skip to content

Commit

Permalink
PopcornFX Gem 2.19.7
Browse files Browse the repository at this point in the history
  • Loading branch information
PopcornFX Bot committed Aug 22, 2024
1 parent 6601fcb commit f8e4e6c
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 19 deletions.
33 changes: 29 additions & 4 deletions Assets/shaders/Common/RibbonSrg.azsli
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ ShaderResourceGroup RendererSrg : SRG_PerDraw
{
// Draw call flags:
uint m_rendererFlags;
uint m_particleCount;
uint m_tubesPlanesOffset;
uint m_vpp;
uint m_particleCount;
// Material:
StructuredBuffer<float4> m_diffuseColors;
StructuredBuffer<float> m_emissiveColors;
Expand All @@ -21,9 +23,32 @@ ShaderResourceGroup RendererSrg : SRG_PerDraw

uint GetParticleIdx(uint vertexIdx)
{
uint particleIdx = vertexIdx / 4;
if (vertexIdx % 4 > 1)
particleIdx = min(particleIdx + 1, RendererSrg::m_particleCount - 1);
const int vpp = RendererSrg::m_vpp; // Note: if tube/multiplane with differing vertex count end up being batched, this won't work.
const int vppHalf = vpp / 2 - 1;


uint particleIdx = 0;
if (vertexIdx < RendererSrg::m_tubesPlanesOffset * 4) // No tube/multiplane batching yet with quad bb modes, but this might come.
{
// First two vertices within a quad: grab the current particle, last two: grab the next one
// Clamps to the total particle count to avoid overflowing the GPU sim buffers
//particleIdx = min(vertexIdx / 4 + saturate(vertexIdx % 4 - 1), RendererSrg::m_particleCount - 1);
particleIdx = vertexIdx / 4;
if (vertexIdx % 4 > 1)
particleIdx = min(particleIdx + 1, RendererSrg::m_particleCount - 1);
}
else
{
// First n (n being segmentCount/planeCount + 1) vertices: grab the current particle, last n: grab the next one
// Clamps to the total particle count to avoid overflowing the GPU sim buffers
//particleIdx = min(RendererSrg::m_tubesPlanesOffset + (vertexIdx - (RendererSrg::m_tubesPlanesOffset * 4)) / vpp +
// saturate(vertexIdx % vpp - vppHalf),
// RendererSrg::m_particleCount - 1);
particleIdx = RendererSrg::m_tubesPlanesOffset + (vertexIdx - (RendererSrg::m_tubesPlanesOffset * 4)) / vpp;
if (vertexIdx % vpp > vppHalf)
particleIdx = min(particleIdx + 1, RendererSrg::m_particleCount - 1);
}

return particleIdx;
}

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.19.6)
set(POPCORNFX_VERSION 2.19.7)
set(POPCORNFX_LICENSE O3DE)

o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_name}")
Expand Down
8 changes: 4 additions & 4 deletions Code/Platform/Linux/PAL_linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages")
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-linux)
set(pk_package_hash 2112123d081402998b91b22b8c652126d7012fbaa3720dce85220ab9a410a837)
set(pk_package_id i8MZ5vNtezYGK7CE)
set(pk_package_hash f443ddb42b335f2fe90783a68ac36d6a43464ee2a7fef627a07d25009d0e3059)
set(pk_package_id JSDb9nAxnaGksduz)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-linux-aarch64)
set(pk_package_hash 2112123d081402998b91b22b8c652126d7012fbaa3720dce85220ab9a410a837_ARM64)
set(pk_package_id i8MZ5vNtezYGK7CE_ARM64)
set(pk_package_hash f443ddb42b335f2fe90783a68ac36d6a43464ee2a7fef627a07d25009d0e3059_ARM64)
set(pk_package_id JSDb9nAxnaGksduz_ARM64)
else()
message(FATAL_ERROR "Unsupported linux architecture ${CMAKE_SYSTEM_PROCESSOR}")
endif()
Expand Down
4 changes: 2 additions & 2 deletions Code/Platform/Mac/PAL_mac.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages")
set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-mac)
set(pk_package_hash 11024c36ee4f18c9f166acddbc2ceb17c78d700a1eae9a3fb08a3b51d91fa0fa)
set(pk_package_id aAclANkhYKZ0RnQR)
set(pk_package_hash 1e720bcb429c7e3b6a42ff7b74ba5dfcbe377d92bced9d3b62a16ce2ea017979)
set(pk_package_id GTqdTuQ1VmyZIm3f)

ly_associate_package(PACKAGE_NAME ${package_name} TARGETS PopcornFX PACKAGE_HASH ${pk_package_hash})
pk_download_package_ifn(${package_name} ${pk_package_id})
Expand Down
4 changes: 2 additions & 2 deletions Code/Platform/Windows/PAL_windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages")
set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-windows)
set(pk_package_hash e5cad8a35b8310d08b0064fc3f02326aa1062cf513a649729ef74dd686b11dab)
set(pk_package_id qpAwLC9YjMCnh3XJ)
set(pk_package_hash 9b1d3358d7a9da07e6c3ff230e79acff853de78351105773f379b7855959dc82)
set(pk_package_id CjtFjAonhAZRd3gZ)

ly_associate_package(PACKAGE_NAME ${package_name} TARGETS PopcornFX PACKAGE_HASH ${pk_package_hash})
pk_download_package_ifn(${package_name} ${pk_package_id})
Expand Down
3 changes: 2 additions & 1 deletion Code/Source/Integration/Managers/RenderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ void CRenderManager::Activate(CParticleMediumCollection *mediumCollection, const
dynamicPoolDescriptor.m_largestPooledAllocationSizeInBytes = 0x100000;

#if O3DE_VERSION_MAJOR >= 4 && O3DE_VERSION_MINOR >= 2
dynamicPoolDescriptor.m_deviceMask = AZ::RHI::MultiDevice::DefaultDevice;
m_BufferPool = aznew AZ::RHI::BufferPool;
AZ::RHI::ResultCode resultCode = m_BufferPool->Init(AZ::RHI::MultiDevice::DefaultDevice, dynamicPoolDescriptor);
AZ::RHI::ResultCode resultCode = m_BufferPool->Init(dynamicPoolDescriptor);
#else
m_BufferPool = AZ::RHI::Factory::Get().CreateBufferPool();
AZ::RHI::ResultCode resultCode = m_BufferPool->Init(*AZ::RHI::RHISystemInterface::Get()->GetDevice(), dynamicPoolDescriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ void CAtomPipelineCache::_FillRibbonSrgBindIndices(const CAtomRendererCache *ren
AZ::Name constantNames[RibbonSrg::__Max_ConstantsSemantic] =
{
AZ::Name("m_rendererFlags"),
AZ::Name("m_tubesPlanesOffset"),
AZ::Name("m_vpp"),
AZ::Name("m_particleCount"),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ namespace RibbonSrg
enum EConstantsSemantic
{
RendererFlags_ShaderRead,
TubesPlanesOffset_ShaderRead,
VPP_ShaderRead,
ParticleCount_ShaderRead,

__Max_ConstantsSemantic,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ CRibbonBatchDrawer::~CRibbonBatchDrawer()

//----------------------------------------------------------------------------

bool CRibbonBatchDrawer::Setup(const CRendererDataBase *renderer, const CParticleRenderMedium *owner, const CFrameCollector *fc, const CStringId &storageClass)
{
if (!Super::Setup(renderer, owner, fc, storageClass))
return false;

const ERibbonMode mode = renderer->m_Declaration.GetPropertyValue_Enum<ERibbonMode>(BasicRendererProperties::SID_BillboardingMode(), RibbonMode_ViewposAligned);
if (mode == RibbonMode_SideAxisAlignedTube)
m_VPP = (u8)(renderer->m_Declaration.GetPropertyValue_I1(BasicRendererProperties::SID_GeometryRibbon_SegmentCount(), 8) + 1) * 2;
else if (mode == RibbonMode_SideAxisAlignedMultiPlane)
m_VPP = (u8)renderer->m_Declaration.GetPropertyValue_I1(BasicRendererProperties::SID_GeometryRibbon_PlaneCount(), 2) * 4;

return true;
}

//----------------------------------------------------------------------------

bool CRibbonBatchDrawer::AreRenderersCompatible(const CRendererDataBase *rendererA, const CRendererDataBase *rendererB) const
{
if (!Super::AreRenderersCompatible(rendererA, rendererB))
Expand Down Expand Up @@ -334,6 +350,8 @@ bool CRibbonBatchDrawer::EmitDrawCall(SRenderContext &ctx, const SRendererBatchD
}

m_PipelineCaches[0].SetRibbonSrgConstantValue(RibbonSrg::RendererFlags_ShaderRead, rendererCache->m_BasicDescription.m_RendererFlags);
m_PipelineCaches[0].SetRibbonSrgConstantValue(RibbonSrg::TubesPlanesOffset_ShaderRead, m_VPP > 0 ? 0 : particleCount); // For now, no batching of tube/multiplane ribbons with quad bb modes
m_PipelineCaches[0].SetRibbonSrgConstantValue(RibbonSrg::VPP_ShaderRead, m_VPP);
m_PipelineCaches[0].SetRibbonSrgConstantValue(RibbonSrg::ParticleCount_ShaderRead, particleCount);

// Additional field buffers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CRibbonBatchDrawer : public CRendererBatchJobs_Ribbon_CPUBB,
CRibbonBatchDrawer();
virtual ~CRibbonBatchDrawer();

virtual bool Setup(const CRendererDataBase *renderer, const CParticleRenderMedium *owner, const CFrameCollector *fc, const CStringId &storageClass) override;
virtual bool AreRenderersCompatible(const CRendererDataBase *rendererA, const CRendererDataBase *rendererB) const override;
virtual bool AllocBuffers(SRenderContext &ctx, const SRendererBatchDrawPass &drawPass) override;
virtual bool MapBuffers(SRenderContext &ctx, const SRendererBatchDrawPass &drawPass) override;
Expand All @@ -36,6 +37,7 @@ class CRibbonBatchDrawer : public CRendererBatchJobs_Ribbon_CPUBB,
// Atlas definition buffer:
AZ::RHI::Ptr<AZ::RHI::Buffer> m_AtlasDefinition = null;
u32 m_AtlasSubRectsCount = 0;
u8 m_VPP = 0;
};

//----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# O3DE PopcornFX Plugin

Integrates the **PopcornFX Runtime SDK** into **O3DE** as a Gem.
* **Version:** `v2.19.6`
* **Version:** `v2.19.7`
* **O3DE:** `23.05`, `23.10`
* **Supported platforms:** `Windows`, `MacOS`, `Linux`, `iOS`, `Android`

Expand Down
8 changes: 4 additions & 4 deletions gem.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"gem_name": "PopcornFX",
"display_name": "PopcornFX 2.19.6",
"display_name": "PopcornFX 2.19.7",
"license": "Community",
"license_url": "https://www.popcornfx.com/popcornfx-community-license",
"origin": "Persistant Studios - popcornfx.com",
"repo_uri": "https://downloads.popcornfx.com/o3de-repo",
"origin_uri": "https://downloads.popcornfx.com/o3de-repo/PopcornFX-2.19/O3DE_PopcornFXGem_v2.19.6_Win64_Linux64_LinuxARM64_Mac64.zip",
"version": "2.19.6",
"last_updated": "2024-07-25",
"origin_uri": "https://downloads.popcornfx.com/o3de-repo/PopcornFX-2.19/O3DE_PopcornFXGem_v2.19.7_Win64_Linux64_LinuxARM64_Mac64.zip",
"version": "2.19.7",
"last_updated": "2024-08-22",
"type": "Code",
"summary": "The PopcornFX Gem provides real-time FX solution for particle effects.",
"canonical_tags": [
Expand Down

0 comments on commit f8e4e6c

Please sign in to comment.