### Vector Swizzling Examples Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/language-syntax.html Shows various ways to access and reorder vector components (swizzling) to create new vectors. Includes examples with different vector types and dimensions. ```popcornfx int4 vec4(5,6,7,8); float3 vec3(0.5,0.6,0.7); int2 vec2(0); int vec(1); ``` ```popcornfx int2 a = vec4.xz; int4 b = vec4.xxzy; int4 c = vec.xxxx; float2 d = vec3.zx; int3 e = vec2.xyx; float2 f = vec3.wx; // error: 'w' isn't valid because 'vec3' is a float3, not a float4. float3 g = float3(vec3.xy, vec4.w); float2 h = float3(vec4.x, vec3.z); ``` -------------------------------- ### Emitter Setup Functions Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/emitter-component-requests.html Functions to set up the effect asset on the emitter component. ```APIDOC ## SetupEmitterById ### Description Sets up the pkfx asset on this emitter component using its asset ID. Returns `true` if successful. ### Parameters - **assetId** (AZ::Data::AssetId) - The identifier corresponding to the ".pkfx" effect asset. - **enable** (bool) - Enables or disables the current emitter. ### Signature `bool SetupEmitterById(const AZ::Data::AssetId &assetId, bool enable)` ## SetupEmitterByName ### Description Sets up the pkfx asset on this emitter component using its path. Returns `true` if successful. ### Parameters - **path** (AZStd::string) - The path to the ".pkfx" effect asset. - **enable** (bool) - Enables or disables the current emitter. ### Signature `bool SetupEmitterByName(const AZStd::string &path, bool enable)` ``` -------------------------------- ### EffectStart Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/popcornfx-requests.html Starts a standalone emitter. This is equivalent to the Start() function in the emitter component requests bus. ```APIDOC ## EffectStart ### Description Starts a standalone emitter. ### Signature `bool EffectStart(StandaloneEmitter *emitter)` ### Parameters * **emitter** (StandaloneEmitter *) - The standalone emitter to start. ``` -------------------------------- ### Install Python Packages with Pip Source: https://documentation.popcornfx.com/PopcornFX/v2.24/baking/asset-generators/texture/python.html Example command to install Python packages into the PopcornFX editor's embedded Python environment. Ensure 'pip' is available and use PYTHONNOUSERSITE=1 for correct installation location. ```bash PYTHONNOUSERSITE=1 /c/Program\ Files/Persistant\ Studios/PopcornFX-2.23.0/bin/python/python.exe -m pip install numpy ``` -------------------------------- ### Spawn-time Script Example Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/namespaces/eval.html This script node runs entirely at spawn time. Expressions like rand() will only be evaluated once when the particle is born. ```csharp float sizeVar = rand(0.5, 1.0); float t = 1 - self.lifeRatio; // self.lifeRatio evaluates to 0 at spawn Size = sizeVar * pow(t, 0.5) * 0.1; ``` -------------------------------- ### Lerp Example Usage Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/builtin-functions.html An example of using the lerp function with float3 vectors to interpolate between two points. ```PopcornFX lerp(float3(0), float3(1,2,3), 0.5); ``` -------------------------------- ### Type Promotion Example Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/language-syntax.html Demonstrates implicit type promotion where floats combined with integers result in floats, and vectors combined with scalars result in vectors of the same dimension. ```popcornfx 123.4 + int3(5,6,7) ``` ```popcornfx float3(128.4, 129.4, 130.4) ``` -------------------------------- ### Scene Namespace Example: Raycasting Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/language-syntax.html Demonstrates using the 'scene' namespace to get the upward axis and perform a raycast intersection. ```PopcornFX float3 raycastDir = -scene.axisUp(); float4 raycastResult = scene.intersect(Position, -raycastDir, 100.0f); // raycast 100 units downwards ``` -------------------------------- ### UE Mesh Material Example Source: https://documentation.popcornfx.com/PopcornFX/v2.24/rendering/materials/material.html Demonstrates how a mesh material in Unreal Engine accesses specular and normal textures, and utilizes static switches for their availability. ```hlsl 1. Specular texture, retrieved in the material via a Texture2D parameter "SpecularTexture" 2. Normal texture, retrieved in the material via a Texture2D parameter "NormalTexture" 3. Static switch set from c++ when a valid specular map is available 4. Static switch set from c++ when a valid normal map is available ``` -------------------------------- ### SmoothLerp Example Usage Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/builtin-functions.html An example of using the smoothlerp function with float3 vectors to smoothly interpolate between two points. ```PopcornFX smoothlerp(float3(0), float3(1,2,3), 0.5); ``` -------------------------------- ### pkfx Module: Get Format by Name Source: https://documentation.popcornfx.com/PopcornFX/v2.24/baking/asset-generators/texture/python.html Use this function from the provided 'pkfx' module to get an image format integer by its string name. Valid names correspond to the 'Format' options in the UI. ```python get_format_by_name(name: str) → int | None ``` -------------------------------- ### Spawn Emitter (Fire and Forget) Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/ue-plugin/emitters.html Example of spawning a PopcornFX emitter using a 'fire and forget' approach in Blueprint. ```blueprint SpawnEmitterAtLocation(Effect, Location, Rotation, Scale) ``` -------------------------------- ### Optimized Shape Sampling Script Example Source: https://documentation.popcornfx.com/PopcornFX/v2.24/nodegraph/templates/examples.html Demonstrates how the nodegraph optimizer can simplify script calls when outputs are unused. This version shows the transformation from explicit PCoord sampling to a fully-random sampling function call. ```csharp OutPosition = Sampler.SamplePosition(); ``` -------------------------------- ### Emitter Properties Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/unity-plugin/unity_28_03-emitters.html Configuration properties for emitters, controlling their behavior on start, destruction, and event handling. ```APIDOC ## Emitter Properties ### Property: `m_PlayOnStart` - **Type**: `bool` - **Description**: If `true`, starts the emitter when the MonoBehavior `Start()` method is called, so as soon as the component is enabled in the scene. - **Default value**: `true` ### Property: `m_TriggerAndForget` - **Type**: `bool` - **Description**: If `true`, the emitter will not be attached to the GameObject and you will be able to immediately call `StartEffect()` on the emitter even if the previous effect instance is still running. - **Default value**: `false` ### Property: `m_KillEffectOnDestroy` - **Type**: `bool` - **Description**: If `true`, the emitter will be killed when the MonoBehavior `OnDestroy()` method is called. - **Default value**: `false` ### Property: `m_OnFxStopped` - **Type**: `OnFxStoppedDelegate` - **Description**: You can set a delegate to be called when the effect has stopped playing. - **Default value**: `null` ### Property: `PreWarm` - **Type**: `float` - **Description**: Sets the prewarm time. If prewarm is enabled, the effect will look like it was simulated during `PreWarm` seconds as soon as it is started. - **Default value**: `0` ``` -------------------------------- ### Attribute Node Example Source: https://documentation.popcornfx.com/PopcornFX/v2.24/nodegraph/effect-interface.html Demonstrates how attributes are retrieved using an 'input' node of type 'attribute' in a nodegraph. Ensure attributes are properly named and typed. ```plaintext input "attribute" "myAttribute" ``` -------------------------------- ### Evolve-time Expression Evaluation with eval.full Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/namespaces/eval.html This example uses eval.full() to ensure self.lifeRatio is evaluated every frame, allowing dynamic Size calculations while keeping other parts of the script at spawn rate. ```csharp float sizeVar = rand(0.5, 1.0); // evaluated at spawn float t = 1 - eval.full(self.lifeRatio); // self.lifeRatio will be evaluated every frame Size = sizeVar * pow(t, 0.5) * 0.1; // sizeVar * 0.1 evaluated at spawn, the rest which depend on 't' at evolve ``` -------------------------------- ### Basic Shape Sampling Script Example Source: https://documentation.popcornfx.com/PopcornFX/v2.24/nodegraph/templates/examples.html This script node samples a new random parametric-coordinate on a shape and then uses it to sample the position. This is a common pattern when PCoords are needed for sampling. ```csharp PCoords = Sampler.samplePCoords(); OutPosition = Sampler.SamplePosition(PCoords); ``` -------------------------------- ### Shape Sampling Script Example Source: https://documentation.popcornfx.com/PopcornFX/v2.24/nodegraph/templates/examples.html This script node samples a new random parametric-coordinate on a shape. It provides a default value if no PCoords are plugged into the template. ```csharp PCoords = Sampler.samplePCoords(); ``` -------------------------------- ### Emitter Lifecycle Control Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/unity-plugin/unity_28_03-emitters.html Methods to start, stop, and terminate emitters, with options for specifying delta time. ```APIDOC ## Emitter Lifecycle Methods ### `StartEffect()` Starts the emitter. ### `StartEffectWithDt(float dt)` Starts the emitter with a specific `dt` in the current frame. Warning: The dt value cannot be greater than `Time.smoothDeltaTime` * `PKFxManager.TimeMultiplier`. ### `TerminateEffect()` Stops the particle emission on the current emitter. Particles that are still alive will not get the parent game object transforms anymore. ### `TerminateEffectWithDt(float dt)` Stops the particle emission on the current emitter at a specific `dt` in the current frame. Warning: The dt value cannot be greater than `Time.smoothDeltaTime` * `PKFxManager.TimeMultiplier`. ### `StopEffect()` Stops the particle emission on the current emitter. Particles that are still alive will continue to follow the parent game object transforms. `StartEffect` cannot be called until the last particle has died. ### `StopEffectWithDt(float dt)` Stops the particle emission on the current emitter at a specific `dt` in the current frame. Warning: The dt value cannot be greater than `Time.smoothDeltaTime` * `PKFxManager.TimeMultiplier`. ### `KillEffect()` Stops the particle emission on the current emitter and kills all emitted particles. ### `KillEffectWithDt(float dt)` Stops the particle emission on the current emitter at a specific `dt` in the current frame and kills all emitted particles. Warning: The dt value cannot be greater than `Time.smoothDeltaTime` * `PKFxManager.TimeMultiplier`. ``` -------------------------------- ### Configure Compiler Switches for Baking Source: https://documentation.popcornfx.com/PopcornFX/v2.24/baking/resource-ovens/oven-particle/compiler-messages.html Use these switches in the asset-baker command line to control compiler behavior. This example turns all warnings into errors and disables specific warnings by their IDs. ```bash -Werror -Wdisable=1332 -Wdisable=1334 ``` -------------------------------- ### Direct Position Sampling Script Example Source: https://documentation.popcornfx.com/PopcornFX/v2.24/nodegraph/templates/examples.html This script node directly samples the position from a sampler without explicitly sampling PCoords first. This is an optimization that the nodegraph optimizer can achieve. ```csharp OutPosition = Sampler.samplePosition(Pcoord); ``` -------------------------------- ### Get Rendering Plugin and Set in ECS System Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/unity-plugin/unity_28_01-basic-usage.html Retrieve the PKFxRenderingPlugin during game initialization using ECS's World.GetOrCreateSystem and reference it within the custom PKFxSystem. ```csharp var rp = FindObjectOfType(typeof(PKFxRenderingPlugin)); World.GetOrCreateSystem().SetRenderingPlugin(rp); ``` -------------------------------- ### Conditional Logic with version Keyword (Mobile vs. Desktop) Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/language-syntax.html Uses the `version` keyword for compile-time conditional logic. This example applies different wind strength calculations based on target platform tags. ```PopcornFX float3 windStrength = 0.0f; version (android, ios) { windStrength = float3suf(10, 0, 0); // 10 units/s along the side axis } else { float turbFadeOff = MyFadingCurve.sample(eval.full(self.lifeRatio)); // Fade the tubulence over life (moderately expensive) float3 turb = MyTurbulence.sample(Position); // Sample the turbulence vector-field (very expensive) windStrength = float3suf(10, 0, 0) + turb * turbFadeOff; // 10 units/s along the side axis, plus the faded turbulence } ``` -------------------------------- ### Wings Renderer Script Example Source: https://documentation.popcornfx.com/PopcornFX/v2.24/nodegraph/templates/examples.html This script computes the billboard axis and position for wing rendering within a template. It takes various inputs like position, direction, wing angle, size, color, and wing-type. ```csharp // Computes the wing billboards axis and position // Inputs: Position, Direction, WingAngle, Size, Color, WingType // Outputs: BillboardAxis, BillboardPosition ``` -------------------------------- ### UE Billboard Material Example Source: https://documentation.popcornfx.com/PopcornFX/v2.24/rendering/materials/material.html Illustrates how a billboard material in Unreal Engine retrieves diffuse texture, particle color, and handles atlas blending using specific nodes and parameters. ```hlsl 1. Diffuse texture, retrieved in the material via a Texture2D parameter named "DiffuseTexture" 2. Particle color, retrieved using the "VertexColor" node 3. Having an atlas provides the correct sub-UVs in the Texcoord node, ready for sampling. 4. Linear atlas blending is enabled, another set of UVs is filled for the material 5. Static switch set from c++ when linear atlas blending is enabled 6. Lerp cursor is passed into DynamicParameter.x ``` -------------------------------- ### Call Member Function samplePosition() Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/language-syntax.html Member functions are called using the object name followed by the dot operator and the function name. This example calls `samplePosition` on a `MyShape` object. ```PopcornFX Output = MyShape.samplePosition(); // member function taking no arguments ``` -------------------------------- ### 2x2 Texture Atlas Definition (.pkat) Source: https://documentation.popcornfx.com/PopcornFX/v2.24/rendering/texture-atlases.html Example of a .pkat file defining a 2x2 texture atlas. Each line represents a sub-texture with normalized coordinates: left, top, right, bottom. ```text 0, 0, 0.5, 0.5 0.5, 0, 1, 0.5 0, 0.5, 0.5, 1 0.5, 0.5, 1, 1 ``` -------------------------------- ### Get Attribute Value Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/ue-plugin/emitters.html Example of retrieving an attribute's value from a PopcornFX emitter in Blueprint. ```blueprint GetAttribute(AttributeName) ``` -------------------------------- ### Static Version Switch Node Example Source: https://documentation.popcornfx.com/PopcornFX/v2.24/nodegraph/build-versions.html Demonstrates using two 'static version switch' nodes to select between different physics and color outputs based on build version tags. The first node selects between a turbulent and a non-turbulent physics simulation, while the second selects between two colors. Note that in v2.4, the input order of version nodes is reversed. ```plaintext version-switch("desktop", "mobile") // Output: turbulent physics physics-turbulence() // Output: non-turbulent physics (cheaper) physics-simple() version-switch("desktop", "mobile") // Output: red color color(1,0,0) // Output: blue color color(0,0,1) ``` -------------------------------- ### Project Settings for Build Version Preview Source: https://documentation.popcornfx.com/PopcornFX/v2.24/nodegraph/build-versions.html Shows how to configure build versions in the project settings for in-editor previewing. Each version has a name and a comma-separated list of tags. These settings are for preview only and do not affect baking. ```plaintext Phone: android, ios PC: desktop, windows, linux, macos Console: ps4, xboxone ``` -------------------------------- ### Absolute Value and Sign Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/builtin-functions.html Functions to get the absolute value and sign of a number or vector. ```APIDOC ## abs(x) ### Description Returns the absolute value of `x`. ### Parameters - **x** (#) - The input number or vector. ### Return Type `#` ``` ```APIDOC ## sign(x) ### Description Returns the sign of `x`. Returns -1.0 or -1 for negative values, and +1.0 or +1 for non-negative values, depending on the type of `x`. ### Parameters - **x** (#) - The input number or vector. ### Return Type `#` ``` -------------------------------- ### Bake Multiple Packs with Multiple Architectures Source: https://documentation.popcornfx.com/PopcornFX/v2.24/baking/using-the-command-line-tool.html This batch script demonstrates chaining multiple PK-AssetBaker.exe commands to bake several different packs ('Game1_Spells', 'Game1_Atmospheric', 'Game1_WildLife') simultaneously. Each pack is baked for both x32 and x64 architectures. ```batch @echo off echo Launching Popcorn-Fx asset ovens... PK-AssetBaker.exe -p="Packs\Game1_Spells" -o=x32:"..\builds\Game1Resources_x32\Particles\Spells" -o=x64:"..\builds\Game1Resources_x64\Particles\Spells" -I="Particles/*.pkfx" PK-AssetBaker.exe -p="Packs\Game1_Atmospheric" -o=x32:"..\builds\Game1Resources_x32\Particles\Atmospheric" -o=x64:"..\builds\Game1Resources_x64\Particles\Atmospheric" -I="Particles/*.pkfx" PK-AssetBaker.exe -p="Packs\Game1_WildLife" -o=x32:"..\builds\Game1Resources_x32\Particles\WildLife" -o=x64:"..\builds\Game1Resources_x64\Particles\WildLife" -I="Particles/*.pkfx" pause ``` -------------------------------- ### Texture Baking Configuration with Command-Line Overrides Source: https://documentation.popcornfx.com/PopcornFX/v2.24/baking/resource-ovens/oven-texture.html Configure texture baking with custom command-line arguments for different operating systems. Use 'OverrideDefaultBakeWithCmdline' to replace default baking with your specified commands. 'AlsoCopyOriginalFile' controls whether the original texture is also copied. ```bnf COvenBakeConfig_Texture $D734A95F { CommandLine_Windows = ""%DXSDK_DIR%\\Utilities\\bin\\x86\\texconv.exe" -o \"$(TargetDir)\" \"$(InputPath)\"" CommandLine_Linux = "cp \"$(InputPath)\" \"$(TargetPath)\"" CommandLine_MacOsX = "cp \"$(InputPath)\" \"$(TargetPath)\"" AlsoCopyOriginalFile = false OverrideDefaultBakeWithCmdline = true AlwaysMkdirTarget = true } ``` -------------------------------- ### Set Attribute Value Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/ue-plugin/emitters.html Example of modifying an attribute's value for a PopcornFX emitter in Blueprint. ```blueprint SetAttribute(AttributeName, Value) ``` -------------------------------- ### Version Keyword in Scripts Source: https://documentation.popcornfx.com/PopcornFX/v2.24/nodegraph/build-versions.html Illustrates how to use the 'version' keyword within scripts to perform conditional logic, similar to an if/else statement, based on the active build version tags. ```csharp if (version("mobile")) { // Code for mobile platforms } else { // Code for other platforms } ``` -------------------------------- ### Get Integer Y Component Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/emitter-component-requests.html Retrieves the Y component of an integer attribute. Returns -1 if the attribute ID is invalid. ```APIDOC ## GetAttributeYAsInt ### Description Returns the value of the second attribute component at index `attribId` or `-1` if `attribId` is invalid. ### Signature `AZ::s32 GetAttributeYAsInt(AZ::u32 attribId)` ``` -------------------------------- ### pkfx Module: Format Info Helpers Source: https://documentation.popcornfx.com/PopcornFX/v2.24/baking/asset-generators/texture/python.html These helper functions provide information about image formats. Use them to check if a format is floating-point, gamma-corrected, its channel count, pixel size, or its name. ```python format_is_fp(format: int) → bool | None ``` ```python format_is_gamma_corrected(format: int) → bool | None ``` ```python format_channel_count(format: int) → int | None ``` ```python format_pixel_size(format: int) → int | None ``` ```python format_name(format: int) → str | None ``` -------------------------------- ### Get Float Attribute Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/emitter-component-requests.html Retrieves the value of a floating-point attribute. Returns 0.0f if the attribute ID is invalid. ```APIDOC ## GetAttributeAsFloat ### Description Returns the value of the attribute at index `attribId` or `0.0f` if `attribId` is invalid. ### Signature `float GetAttributeAsFloat(AZ::u32 attribId)` ``` -------------------------------- ### scene.time Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/namespaces/scene.html Retrieves the time elapsed since the start of the simulation, typically since the beginning of the whole scene or level. ```APIDOC ## scene.time ### Description Time elapsed since the start of the simulation. This is usually since the start of the whole scene / level. ### Return type `float` ### See also effect.age() ``` -------------------------------- ### SpawnEmitterAtLocation Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/popcornfx-requests.html Spawns an emitter at a specified location and transform without creating an emitter component. The emitter starts automatically. ```APIDOC ## SpawnEmitterAtLocation ### Description Spawns an emitter with the specified transform without creating any emitter component. The emitter is started automatically. Note that there is no way to manipulate the emitter properties once it has been created with this method. ### Parameters #### Path Parameters - **path** (AZStd::string) - Required - The path to the ".pkfx" effect asset. - **transform** (AZ::Transform) - Required - The transform at which to spawn the emitter. ``` -------------------------------- ### Angle Unit Conversion with Namespaces Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/language-syntax.html Illustrates how to use 'degrees' and 'radians' namespaces for trigonometric functions, showing default degree behavior and explicit radian usage. ```PopcornFX float angleInDegrees = x; float a = sin(angleInDegrees); float b = degrees.sin(angleInDegrees); float c = radians.sin(deg2rad(angleInDegrees)); float d = radians.sin(pi / 3.0); // equal to 'sin(60)' ``` -------------------------------- ### GetAttributesCount Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/popcornfx-requests.html Gets the number of attributes for a standalone emitter. This is equivalent to the GetAttributesCount() function in the emitter component requests bus. ```APIDOC ## GetAttributesCount ### Description Gets the number of attributes for a standalone emitter. ### Signature `AZ::u32 GetAttributesCount(StandaloneEmitter *emitter)` ### Parameters * **emitter** (StandaloneEmitter *) - The standalone emitter to query. ### Returns The number of attributes. ``` -------------------------------- ### EffectGetPrewarmTime Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/popcornfx-requests.html Gets the prewarming time of a standalone emitter. This is equivalent to the EffecGetPrewarmTime() function in the emitter component requests bus. ```APIDOC ## EffectGetPrewarmTime ### Description Gets the prewarming time of a standalone emitter. ### Signature `float EffectGetPrewarmTime(StandaloneEmitter *emitter)` ### Parameters * **emitter** (StandaloneEmitter *) - The standalone emitter to query. ### Returns The prewarming time in seconds. ``` -------------------------------- ### EffectGetPrewarmEnable Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/popcornfx-requests.html Gets the prewarming state of a standalone emitter. This is equivalent to the EffectGetPrewarmEnable() function in the emitter component requests bus. ```APIDOC ## EffectGetPrewarmEnable ### Description Gets the prewarming state of a standalone emitter. ### Signature `bool EffectGetPrewarmEnable(StandaloneEmitter *emitter)` ### Parameters * **emitter** (StandaloneEmitter *) - The standalone emitter to query. ### Returns `true` if prewarming is enabled, `false` otherwise. ``` -------------------------------- ### EffectGetTimeScale Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/popcornfx-requests.html Gets the time scale of a standalone emitter. This is equivalent to the GetTimeScale() function in the emitter component requests bus. ```APIDOC ## EffectGetTimeScale ### Description Gets the time scale of a standalone emitter. ### Signature `float EffectGetTimeScale(StandaloneEmitter *emitter)` ### Parameters * **emitter** (StandaloneEmitter *) - The standalone emitter to query. ### Returns The current time scale of the emitter. ``` -------------------------------- ### EffectGetVisible Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/popcornfx-requests.html Gets the visibility state of a standalone emitter. This is equivalent to the GetVisible() function in the emitter component requests bus. ```APIDOC ## EffectGetVisible ### Description Gets the visibility state of a standalone emitter. ### Signature `bool EffectGetVisible(StandaloneEmitter *emitter)` ### Parameters * **emitter** (StandaloneEmitter *) - The standalone emitter to query. ### Returns `true` if the emitter is visible, `false` otherwise. ``` -------------------------------- ### Get Integer X Component Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/emitter-component-requests.html Retrieves the X component of an integer attribute. Returns -1 if the attribute ID is invalid. ```APIDOC ## GetAttributeXAsInt ### Description Returns the value of the first attribute component at index `attribId` or `-1` if `attribId` is invalid. ### Signature `AZ::s32 GetAttributeXAsInt(AZ::u32 attribId)` ``` -------------------------------- ### Audio Sampler Sampling Functions Source: https://documentation.popcornfx.com/PopcornFX/v2.24/scripting-reference/samplers/audio-sampler.html Provides details on how to sample audio data using the `SamplerName.sample` functions. It covers basic sampling and sampling with convolution, along with explanations of the `cursor`, `convolution`, and `sampleFilter` parameters. ```APIDOC ## Audio Sampler Sampling Functions ### `spectrumFilter` Enumeration This enumeration defines the interpolation methods for sampling audio data. - `spectrumFilter.Point`: No interpolation (nearest sample). - `spectrumFilter.Linear`: Linear interpolation between the 2 nearest samples. - `spectrumFilter.Cubic`: Cubic interpolation between the 4 nearest samples. ### `SamplerName.sample(float cursor, int sampleFilter)` **Description**: Samples the audio data at a given `cursor` coordinate on the horizontal axis, normalized in the `[0, 1]` range. The `sampleFilter` parameter determines the interpolation method used. **Parameters**: - `cursor` (float): The horizontal coordinate for sampling, normalized between 0 and 1. - `sampleFilter` (int): One of the `spectrumFilter` values, specifying the interpolation method. **Return Type**: `float` - The sampled audio data value. **Usage Notes**: - If sampling the spectrum, `cursor` represents a bass-to-treble range. - If sampling the waveform, `cursor` represents a time cursor within the current audio stream waveform window. ### `SamplerName.sample(float cursor, float convolution, int sampleFilter, int convolutionFilter)` **Description**: Samples the audio data at a given `cursor` coordinate with an additional `convolution` level for blurring. It also allows specifying interpolation filters for both the sample and the convolution. **Parameters**: - `cursor` (float): The horizontal coordinate for sampling, normalized between 0 and 1. - `convolution` (float): The convolution level (blur), normalized between 0 and 1. - `sampleFilter` (int): One of the `spectrumFilter` values, specifying the interpolation method for the sample. - `convolutionFilter` (int): One of the `spectrumFilter` values, specifying the interpolation method for the convolution mipmaps. **Return Type**: `float` - The sampled audio data value with convolution applied. **Usage Notes**: - If sampling the spectrum, `cursor` represents a bass-to-treble range. - If sampling the waveform, `cursor` represents a time cursor within the current audio stream waveform window. **Note**: The behavior of these functions may vary when using attribute samplers, depending on the game engine's implementation. ``` -------------------------------- ### Get Float4 Attribute Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/emitter-component-requests.html Retrieves the value of a Vector4 float attribute. Returns an uninitialized Vector4 if the attribute ID is invalid. ```APIDOC ## GetAttributeAsFloat4 ### Description Returns the value of the attribute at index `attribId` or an uninitialized `AZ::Vector4` if `attribId` is invalid. ### Signature `AZ::Vector4 GetAttributeAsFloat4(AZ::u32 attribId)` ``` -------------------------------- ### Get Float3 Attribute Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/emitter-component-requests.html Retrieves the value of a Vector3 float attribute. Returns an uninitialized Vector3 if the attribute ID is invalid. ```APIDOC ## GetAttributeAsFloat3 ### Description Returns the value of the attribute at index `attribId` or an uninitialized `AZ::Vector3` if `attribId` is invalid. ### Signature `AZ::Vector3 GetAttributeAsFloat3(AZ::u32 attribId)` ``` -------------------------------- ### Initializing All Output Values in Fragment Shader Source: https://documentation.popcornfx.com/PopcornFX/v2.24/rendering/materials/custom-materials.html This code snippet shows how to ensure all output values are initialized in a fragment shader. This is necessary for opaque draw calls, as the generated .frag files may not automatically handle this. ```glsl void main() { // Initialize all output values FragColor = vec4(0.0); // ... other outputs if any } ``` -------------------------------- ### Get Float2 Attribute Source: https://documentation.popcornfx.com/PopcornFX/v2.24/plugins/o3de-gem/event-buses/emitter-component-requests.html Retrieves the value of a Vector2 float attribute. Returns an uninitialized Vector2 if the attribute ID is invalid. ```APIDOC ## GetAttributeAsFloat2 ### Description Returns the value of the attribute at index `attribId` or an uninitialized `AZ::Vector2` if `attribId` is invalid. ### Signature `AZ::Vector2 GetAttributeAsFloat2(AZ::u32 attribId)` ```