The following example uses a Script Operator to assign a single letter to each particle based on a scene text objects. You can type in any text you want, define the font and change the appearance of the text using modifiers like Extrude and Bevel and let Particle Flow generate a stream of letters showing the text.
Can Be Used With:
The scripts should be used inside a Script_Operator.
The example uses a unique scene text object (with any modifiers on top) as instanced source.
The script makes copies of the source text and replaces the original text with a single letter from the text.This means that you can create any appearance (like for example adding custom Bevel to the source) and the particle system will inherit these settings.
Changing the Text of the Font of the Source and scrubbing the time back will automatically update the particle system.
Deleted letters from the scene will be detected and the particle system will regenerate to bring them back.
If the source object was removed, a new default text with extrude modifier will be created in the scene with the string "Enter Text Here" and renderable flag set to false. This means that you can start from scratch using this text object and edit its font,text and stack to get the look you want.
The source object must be a text object with some meshing modifier on top. Do not collapse the stack to EMesh as the script needs access to the text baseobject's font and text properties!
You have to disable any Caches when changing the appearance in order to see the new look.
You can change the timing of the Birth operator to get more particles if your text is longer than the default
You can use any other PFlow operators to affect the particles. The Script is only responsible for the shape of the particles.
If you need multiple particle systems using the script, you should change the unique naming throughout the whole script to keep them apart.
--The ChannelsUsed handler defines the channels
--to be made available to the script.
--For the list of all channels, see
--The parameter pCont passed to the handler
--contains the Particle Container the script is applied to
on ChannelsUsed pCont do(
pCont.useShape = true --enable changes to the shape
--The Init hander is called on initialization.
--In this case, it is used to define the string, font name
--and create the text objects for every letter
on Init pCont do
--Define a global variable to store the array of letter objects
--Use different unique ID if reusing the code
--multiple times in the same scene
local text_source = $PFlowText17b02b680
--If the unique source is missing...
if not isValidNode text_source do
--Create new text source object
text_source = text text:"Enter Text Here"
--Give it the unique name - use a different ID
--throughout the script if you need to use multiple
--scripts in the same scene
text_source.name = "PFlowText17b02b680"
--Add an extrude modifier to the text object
addmodifier text_source (extrude amount:10)
--make the source invisible to the renderer
text_source.renderable = false
--If the array has been initialized before...
if pflow_letter_array17b02b680 != undefined do
txtpos = 0
--Go through all elements of the array
for i in pflow_letter_array17b02b680 do
txtpos += 1
--If any of the array nodes is invalid (deleted),
--or the font does not match the source's font name,
--or a letter does not match the letter in the source text,
--reset the whole array so it can be reinitialized
if not (isValidNode i) or i.font != text_source.font or i.text != (substring text_source.text txtpos 1) do
pflow_letter_array = undefined
--If the array is newly created or reset (see above)
if pflow_letter_array17b02b680 == undefined do
--Initialize to empty array
pflow_letter_array17b02b680 = #()
--Get the string to display by the particle system from the
--source text object in the scene. You can edit the
--text's source to display any text you want!
--Moving the time slider will update all letters!
local str = text_source.text
--Delete all possibly existing letter objects by name
--Loop from 1 to the number of letters in the string
for i = 1 to str.count do
--Create a copy of the source object with
--the i-th letter from the string
letter = copy text_source
letter.text = (substring str i 1)
--Give the object a unique name
letter.name = (uniquename "PFlow_Letter_17b02b680_")
--Set the font to the font of the source
letter.font = text_source.font
--Append the new text object to the array
append pflow_letter_array17b02b680 letter
--Hide the text object
--In the Proceed handler, we will assign the letters to the
on Proceed pCont do
--Get the current particle count
count = pCont.numParticles()
--Get the number of text objects in the global array
maxcount = pflow_letter_array17b02b680.count
--Create an empty mesh
empty_mesh = triMesh()
--Repeat for all particles
for i = 1 to count do
--Set the current particle index
pCont.particleIndex = i
--If the particle index is less than the number of letters
if i <= maxcount then
--If the node is not deleted, set the particle shape
--to the mesh of the i-th text object
if isValidNode pflow_letter_array17b02b680[i] do
pCont.particleShape = pflow_letter_array17b02b680[i].mesh
--If there is no letter for this particle,
--set the shape to an empty mesh
pCont.particleShape = empty_mesh
--The Release handler is used to do cleanup work.
--Not used in this case.
on Release pCont do
Using MAXScript in Script Actions
Particle Flow Sample Scripts