0% found this document useful (0 votes)
7 views6 pages

P Custom Certainly

Uploaded by

fastkilar29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views6 pages

P Custom Certainly

Uploaded by

fastkilar29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Certainly!

The pCustom node in DaVinci Resolve Fusion is a highly versatile and


advanced node that lets you manipulate particle systems in extremely creative ways using
expressions and scripts written in Lua.

Below is an extended explanation, diving deeper into pCustom's features, use cases,
workflows, and examples.

Advanced Guide to pCustom Node

1. Basic Structure of the pCustom Node

The pCustom node works by letting you write scripts in Lua to control particle attributes.
Attributes you can control include:

Attribute Description

px, py, pz Controls particle position in X, Y, Z space.

vx, vy, vz Controls particle velocity (movement speed/direction).

size Sets the particle's size.

red, green, blue Controls the particle's color components.

rotation Defines the rotation of the particle.

age Returns the current age of the particle. Starts at 0.

life Total lifespan of the particle.

id Unique identifier for each particle.

mass Sets the mass of the particle.

density Controls the particle's density, useful for simulations.

2. Workflow for Adding pCustom

1. Set Up the Particle System:

o Add a pEmitter node to emit particles.


o Connect the pEmitter to the pCustom node.

o Attach a pRender node to render the particles.

2. Access pCustom:

o Open the pCustom node Inspector panel.

o You’ll see separate fields for:

▪ Position

▪ Velocity

▪ Size

▪ Color

o These fields allow you to enter expressions for dynamic control.

3. Write Scripts:

o Use Lua scripting to define how each attribute changes over time or
interacts with the environment.

3. Lua Scripting in pCustom

In pCustom, you can define expressions in Lua to control behavior dynamically.

Here are some of the basic operations you can use:

• Basic Arithmetic: +, -, *, /, %

• Math Functions: sin(x), cos(x), tan(x), sqrt(x), abs(x)

• Random Functions:

• rand() -- Generates a random number between 0 and 1

• rand(min, max) -- Random number in the range [min, max]

• Time and Age:

o time: Total elapsed time in the composition.

o age: The current age of the particle.

o life: The total life of the particle.


• Logical Conditions:

• if condition then

• -- do something

• else

• -- do something else

• end

4. Example Scenarios

Here are practical examples of what you can achieve with the pCustom node.

Example 1: Circular Motion

Make particles move in a circular pattern over time.

px = cos(age * 2 * 3.14) * age

py = sin(age * 2 * 3.14) * age

pz = 0

• Explanation:

o Uses sine and cosine functions to generate X and Y positions.

o Multiplies age to increase the circle’s size as particles grow older.

Example 2: Dynamic Size

Make particles grow larger as they age.

size = age * 0.1

• Explanation:

o Increases size proportionally to the particle's age.

Example 3: Fading Particles

Fade the particles’ color to black over their lifespan.


red = 1 - age / life

green = 1 - age / life

blue = 1 - age / life

• Explanation:

o The color components reduce over time as the particle's age approaches its
life.

Example 4: Add Random Velocity

Add random movement to particles for a more chaotic effect.

vx = rand(-1, 1)

vy = rand(-1, 1)

vz = rand(-1, 1)

• Explanation:

o Adds random velocity values between -1 and 1 in all three axes.

Example 5: Gravity Effect

Simulate particles falling down like under gravity.

vy = vy - 0.05 * time

• Explanation:

o Decreases the Y-velocity over time to simulate the downward pull of gravity.

5. Combining pCustom with Other Nodes

You can use the pCustom node alongside other particle nodes to create even more
complex effects:

• pTurbulence: Add turbulence for a chaotic look.

• pFriction: Reduce velocity over time, slowing particles down.

• pKill: Remove particles that meet specific conditions (e.g., too old).
• pCollision: Make particles interact with surfaces.

6. Advanced Techniques

1. Layering pCustom Nodes:

o Use multiple pCustom nodes in a chain for advanced effects:

▪ One for position.

▪ Another for color.

▪ Another for velocity.

2. Conditional Changes: Change behavior based on the particle’s age:

3. if age < life / 2 then

4. size = age * 0.2

5. else

6. size = (life - age) * 0.2

7. end

8. Use id for Unique Particle Control:

9. if id % 2 == 0 then

10. red = 1

11. green = 0

12. blue = 0

13. else

14. red = 0

15. green = 1

16. blue = 0

17. end

o Even IDs get red particles, odd IDs get green particles.
7. Tips for Using pCustom

1. Start Small: Begin with simple scripts to understand attribute changes.

2. Preview Iteratively: Make small changes and preview frequently.

3. Debugging: Use print() statements in expressions to check values:

4. print(age, life, px, py)

5. Combine Math and Randomness: Mixing math functions and randomness creates
natural-looking effects.

Conclusion

The pCustom node is an incredibly versatile tool in Fusion's particle system. It allows for
complete creative control over particles using Lua scripting. By combining math, logic,
and randomness, you can create effects that range from simple animations to highly
advanced procedural particle systems.

You might also like