Skip to content

Commit

Permalink
PopcornFX Plugin v2.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PopcornFX Bot committed Mar 29, 2024
1 parent 4da01c2 commit 3ba9cad
Show file tree
Hide file tree
Showing 70 changed files with 1,842 additions and 438 deletions.
2 changes: 1 addition & 1 deletion Download_SDK_Desktop.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ setlocal

bitsadmin /reset
bitsadmin /create third_party_download_desktop
bitsadmin /addfile third_party_download_desktop https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.18.6_Win64_Linux64_Mac64.7z "%~dp0\_PopcornFX_Runtime_SDK_Desktop.7z"
bitsadmin /addfile third_party_download_desktop https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.19.0_Win64_Linux64_Mac64.7z "%~dp0\_PopcornFX_Runtime_SDK_Desktop.7z"
bitsadmin /setpriority third_party_download_desktop "FOREGROUND"
bitsadmin /resume third_party_download_desktop

Expand Down
2 changes: 1 addition & 1 deletion Download_SDK_Mobile.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ setlocal

bitsadmin /reset
bitsadmin /create third_party_download_mobile
bitsadmin /addfile third_party_download_mobile https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.18.6_iOS_Android.7z "%~dp0\_PopcornFX_Runtime_SDK_Mobile.7z"
bitsadmin /addfile third_party_download_mobile https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.19.0_iOS_Android.7z "%~dp0\_PopcornFX_Runtime_SDK_Mobile.7z"
bitsadmin /setpriority third_party_download_mobile "FOREGROUND"
bitsadmin /resume third_party_download_mobile

Expand Down
4 changes: 2 additions & 2 deletions PopcornFX.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 21806,
"VersionName": "2.18.6",
"Version": 21900,
"VersionName": "2.19.0",
"FriendlyName": "PopcornFX",
"Description": "PopcornFX Realtime Particle Solution integration into Unreal Engine",
"Category": "PopcornFX",
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Unreal Engine PopcornFX Plugin

Integrates the **PopcornFX Runtime SDK** into **Unreal Engine 4** and **Unreal Engine 5** as a Plugin.
* **Version:** `v2.18.6`
* **Unreal Engine:** `4.27`, `5.1`, `5.2` and `5.3`
Integrates the **PopcornFX Runtime SDK** into **Unreal Engine 5** as a Plugin.
* **Version:** `v2.19.0`
* **Unreal Engine:** `5.1`, `5.2` and `5.3`
* **Supported platforms:** `Windows`, `MacOS`, `Linux`, `iOS`, `Android`, `PS4`, `PS5`, `XboxOne`, `Xbox Series`, `Switch`

[Contact-us](http://www.popcornfx.com/contact-us/) to request access to the plugin for consoles.
Expand Down
15 changes: 15 additions & 0 deletions Shaders/Private/PopcornFXGPUBillboard.ush
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct FVertexFactoryIntermediates
{
float3 ParticleWorldPosition; // UE units
float3 VertexWorldPosition; // UE units
float3 VertexPrevWorldPosition; // UE units
float4 VertexTexCoords;

//float ParticleLifeRatio; TODO
Expand Down Expand Up @@ -167,6 +168,9 @@ void PopcornFXGPUBillboard(uint instanceID, float2 texCoords, out FVertexFactory
else
radius = PKSimData_Load2f(particleID, PopcornFXGPUBillboardVSUniforms.InSize2sOffset);

if (PopcornFXGPUBillboardVSUniforms.InEnabledOffset != -1)
radius *= PKSimData_Loadi(particleID, PopcornFXGPUBillboardVSUniforms.InEnabledOffset) != 0 ? 1.0f : 0.0f;

float rotation = 0.0f;

float3 xAxis = float3(0.0f, 0.0f, 0.0f);
Expand Down Expand Up @@ -293,6 +297,17 @@ void PopcornFXGPUBillboard(uint instanceID, float2 texCoords, out FVertexFactory
intermediates.VertexWorldPosition += ResolvedView.PreViewTranslation;
#endif // (ENGINE_MAJOR_VERSION == 5)

BRANCH
if (PopcornFXGPUBillboardVSUniforms.InPreviousPositionOffset != -1)
intermediates.VertexPrevWorldPosition = (PKSimData_Load3f(particleID, PopcornFXGPUBillboardVSUniforms.InPreviousPositionOffset) + bbCorner) * GLOBAL_SCALE;
else
intermediates.VertexPrevWorldPosition = (worldPos + bbCorner) * GLOBAL_SCALE; // no velocity
#if (ENGINE_MAJOR_VERSION == 5)
intermediates.VertexPrevWorldPosition += LWCToFloat(ResolvedView.PrevPreViewTranslation);
#else
intermediates.VertexPrevWorldPosition += ResolvedView.PrevPreViewTranslation;
#endif // (ENGINE_MAJOR_VERSION == 5)

#if USE_PARTICLE_POSITION
const float particleRadius = min(radius.x, radius.y) * GLOBAL_SCALE;
# if (ENGINE_MAJOR_VERSION == 5)
Expand Down
6 changes: 3 additions & 3 deletions Shaders/Private/PopcornFXGPUVertexFactory.ush
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input,
VertexParameters.PreSkinnedPosition = Intermediates.ParticleWorldPosition.xyz;
VertexParameters.PreSkinnedNormal = TangentToLocal[2].xyz;
#if (ENGINE_MAJOR_VERSION == 5)
VertexParameters.PrevFrameLocalToWorld = GetPrimitiveDataFromUniformBuffer().LocalToWorld; // No velocity
VertexParameters.PrevFrameLocalToWorld = GetPrimitiveDataFromUniformBuffer().PreviousLocalToWorld;
#else
VertexParameters.PrevFrameLocalToWorld = Primitive.LocalToWorld; // No velocity
VertexParameters.PrevFrameLocalToWorld = Primitive.PreviousLocalToWorld;
#endif // (ENGINE_MAJOR_VERSION == 5)

#if (DYNAMIC_PARAMETERS_MASK != 0)
Expand Down Expand Up @@ -431,7 +431,7 @@ float3x3 VertexFactoryGetTangentToLocal(FVertexFactoryInput Input, FVertexFactor

float4 VertexFactoryGetPreviousWorldPosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{
return VertexFactoryGetWorldPosition(Input, Intermediates); // TODO
return float4(Intermediates.VertexPrevWorldPosition, 1.f);
}

float4 VertexFactoryGetTranslatedPrimitiveVolumeBounds(FVertexFactoryInterpolantsVSToPS Interpolants)
Expand Down
26 changes: 23 additions & 3 deletions Shaders/Private/PopcornFXMeshVertexFactory.ush
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ struct FVertexFactoryIntermediates
float4x4 ParticleToWorld;
float4x4 WorldToParticle;

float4 PreviousPosition;

#if (ENGINE_MAJOR_VERSION == 5)
/** Cached primitive and instance data */
FSceneDataIntermediates SceneData;
Expand Down Expand Up @@ -233,7 +235,7 @@ FMaterialPixelParameters GetMaterialPixelParameters(FVertexFactoryInterpolantsVS
# if USE_PARTICLE_WORLD_TO_LOCAL
Result.Particle.WorldToParticle = LWCPromoteInverse(transpose(float4x4(Interpolants.WorldToParticle[0], Interpolants.WorldToParticle[1], Interpolants.WorldToParticle[2], float4(0.0f, 0.0f, 0.0f, 1.0f))));
# if NEEDS_INSTANCE_WORLD_TO_LOCAL_PS
Result.InstanceWorldtoLocal = Result.Particle.WorldToParticle;
Result.InstanceWorldToLocal = Result.Particle.WorldToParticle;
# endif // NEEDS_INSTANCE_WORLD_TO_LOCAL_PS
# endif // USE_PARTICLE_WORLD_TO_LOCAL
#else
Expand Down Expand Up @@ -395,6 +397,19 @@ float4 CalcWorldPosition(FVertexFactoryInput Input)
return float4(WorldPosition, Input.Position.w);
}

float4 CalcPreviousWorldPosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{
// FIXME only offsets the particle position, properly store the previous rotation transforms as well.
float4x4 Transform = float4x4(Input.Transform1, Input.Transform2, Input.Transform3, Intermediates.PreviousPosition);

#if (ENGINE_MAJOR_VERSION == 5)
float3 WorldPosition = mul(Input.Position, Transform).xyz + LWCHackToFloat(ResolvedView.PrevPreViewTranslation);
#else
float3 WorldPosition = mul(Input.Position, Transform).xyz + ResolvedView.PrevPreViewTranslation;
#endif // (ENGINE_MAJOR_VERSION == 5)
return float4(WorldPosition, Input.Position.w);
}

FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput Input)
{
FVertexFactoryIntermediates Intermediates = (FVertexFactoryIntermediates)0;
Expand Down Expand Up @@ -429,6 +444,12 @@ FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput In
if (PopcornFXMeshVSUniforms.InEmissiveColorsOffset != -1)
Intermediates.EmissiveColor = PKSimData_Load4f(particleID, PopcornFXMeshVSUniforms.InEmissiveColorsOffset);

BRANCH
if (PopcornFXMeshVSUniforms.InPreviousPositionOffset != -1)
Intermediates.PreviousPosition = float4(PKSimData_Load3f(particleID, PopcornFXMeshVSUniforms.InPreviousPositionOffset), Input.Transform4.w);
else
Intermediates.PreviousPosition = Input.Transform4;

// Cursor sent through RelativeTime (either one)
BRANCH
if (PopcornFXMeshVSUniforms.InVATCursorsOffset != -1)
Expand Down Expand Up @@ -632,8 +653,7 @@ FVertexFactoryInterpolantsVSToPS VertexFactoryGetInterpolantsVSToPS(FVertexFacto
// @return previous translated world position
float4 VertexFactoryGetPreviousWorldPosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{
// The previous local to world instance transform isn't available.
return CalcWorldPosition(Input);
return CalcPreviousWorldPosition(Input, Intermediates);
}

#if USING_TESSELLATION
Expand Down
2 changes: 1 addition & 1 deletion Shaders/Private/PopcornFXSkeletalMeshVertexFactory.ush
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ FMaterialPixelParameters GetMaterialPixelParameters(FVertexFactoryInterpolantsVS
# if USE_PARTICLE_WORLD_TO_LOCAL
Result.Particle.WorldToParticle = LWCPromoteInverse(transpose(float4x4(Interpolants.WorldToParticle[0], Interpolants.WorldToParticle[1], Interpolants.WorldToParticle[2], float4(0.0f, 0.0f, 0.0f, 1.0f))));
# if NEEDS_INSTANCE_WORLD_TO_LOCAL_PS
Result.InstanceWorldtoLocal = Result.Particle.WorldToParticle;
Result.InstanceWorldToLocal = Result.Particle.WorldToParticle;
# endif // NEEDS_INSTANCE_WORLD_TO_LOCAL_PS
# endif // USE_PARTICLE_WORLD_TO_LOCAL
#else
Expand Down
25 changes: 24 additions & 1 deletion Shaders/Private/PopcornFXVertexFactory.ush
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct FVertexFactoryInput
struct FVertexFactoryIntermediates
{
float3 Position;
float3 PrevPosition;

float4 ParticleColor;
float3 ParticleEmissiveColor;
Expand Down Expand Up @@ -229,6 +230,12 @@ FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input,
VertexParameters.PreSkinnedPosition = Input.Position.xyz;
VertexParameters.PreSkinnedNormal = TangentToLocal[2].xyz;

#if (ENGINE_MAJOR_VERSION == 5)
VertexParameters.PrevFrameLocalToWorld = GetPrimitiveDataFromUniformBuffer().PreviousLocalToWorld;
#else
VertexParameters.PrevFrameLocalToWorld = Primitive.PreviousLocalToWorld;
#endif // (ENGINE_MAJOR_VERSION == 5)

#if NEEDS_PARTICLE_COLOR
VertexParameters.Particle.Color = Intermediates.ParticleColor;
#endif
Expand Down Expand Up @@ -316,6 +323,22 @@ FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput In

Intermediates.Position = worldVertexPosition;

float3 prevVertexPosition = vertexPosition;

BRANCH
if (PopcornFXBillboardVSUniforms.InPreviousPositionOffset != -1)
prevVertexPosition = PKSimData_Load3f(particleID, PopcornFXBillboardVSUniforms.InPreviousPositionOffset);

#if (ENGINE_MAJOR_VERSION == 5)
float3 prevWorldVertexPosition = mul(float4(prevVertexPosition,1), LWCToFloat(GetPrimitiveDataFromUniformBuffer().PreviousLocalToWorld)).xyz;
prevWorldVertexPosition += LWCToFloat(ResolvedView.PrevPreViewTranslation);
#else
float3 prevWorldVertexPosition = mul(float4(prevVertexPosition,1), Primitive.PreviousLocalToWorld).xyz;
prevWorldVertexPosition += ResolvedView.PrevPreViewTranslation;
#endif // (ENGINE_MAJOR_VERSION == 5)

Intermediates.PrevPosition = prevWorldVertexPosition;

BRANCH
if (PopcornFXBillboardVSUniforms.InColorsOffset != -1)
Intermediates.ParticleColor = PKSimData_Load4f(particleID, PopcornFXBillboardVSUniforms.InColorsOffset);
Expand Down Expand Up @@ -427,7 +450,7 @@ float3x3 VertexFactoryGetTangentToLocal(FVertexFactoryInput Input, FVertexFactor

float4 VertexFactoryGetPreviousWorldPosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{
return VertexFactoryGetWorldPosition(Input, Intermediates);
return float4(Intermediates.PrevPosition, 1);
}

float4 VertexFactoryGetTranslatedPrimitiveVolumeBounds(FVertexFactoryInterpolantsVSToPS Interpolants)
Expand Down
16 changes: 8 additions & 8 deletions Source/PopcornFX/PopcornFX.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,15 @@ private bool SetupPopcornFX(TargetInfo Target)
#if !UE_5_0_OR_LATER // Support dropped with UE5
if (Target.Platform == UnrealTargetPlatform.Win32)
{
libPrefix = clientLibDir + "vs2017_Win32/";
libPrefix = clientLibDir + "vs2019_Win32/";
libExt = ".lib";
}
else
#endif // !UE_5_0_OR_LATER // Support dropped with UE5
if (Target.Platform == UnrealTargetPlatform.Win64 ||
isWinUNKNOWN) // Win32 UNKNOWN (WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP), just link with the same libs as Win64
{
libPrefix = clientLibDir + "vs2017_x64/";
libPrefix = clientLibDir + "vs2019_x64/";
libExt = ".lib";
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
Expand All @@ -248,31 +248,31 @@ private bool SetupPopcornFX(TargetInfo Target)
#if !UE_5_0_OR_LATER // Support dropped with UE5
else if (Target.Platform == UnrealTargetPlatform.XboxOne)
{
libPrefix = clientLibDir + "vs2017_Durango/";
libPrefix = clientLibDir + "vs2019_Durango/";
libExt = ".lib";
}
#endif // !UE_5_0_OR_LATER
else if (isXboxOneUNKNOWN)
{
libPrefix = clientLibDir + "vs2017_UNKNOWN.x64/";
libPrefix = clientLibDir + "vs2019_UNKNOWN.x64/";
libExt = ".lib";
}
else if (isUNKNOWN)
{
libPrefix = clientLibDir + "vs2017_UNKNOWN.x64/";
libPrefix = clientLibDir + "vs2019_UNKNOWN.x64/";
libExt = ".lib";
}
#if !UE_5_0_OR_LATER // Support dropped with UE5
else if (Target.Platform == UnrealTargetPlatform.PS4)
{
libPrefix = clientLibDir + "vs2017_ORBIS/";
libPrefix = clientLibDir + "vs2019_ORBIS/";
// "vs" + WindowsPlatform.GetVisualStudioCompilerVersionName(); // error (exception) on >= 4.16
libExt = ".a";
}
#endif // !UE_5_0_OR_LATER
else if (isUNKNOWN2)
{
libPrefix = clientLibDir + "vs2017_UNKNOWN2/";
libPrefix = clientLibDir + "vs2019_UNKNOWN2/";
libExt = ".a";
}
else if (Target.Platform == UnrealTargetPlatform.IOS)
Expand All @@ -294,7 +294,7 @@ private bool SetupPopcornFX(TargetInfo Target)
#if !UE_5_0_OR_LATER // Support dropped with UE5
else if (Target.Platform == UnrealTargetPlatform.Switch)
{
libPrefix = clientLibDir + "vs2017_NX64/";
libPrefix = clientLibDir + "vs2019_NX64/";
libExt = ".a";
}
#endif // !UE_5_0_OR_LATER
Expand Down
Loading

0 comments on commit 3ba9cad

Please sign in to comment.