AWS Thinkbox Discussion Forums

Particle Age - Colour

Hi guys,

I’m an XMesh noob but I’ve received an XMeshed particle system which is working perfectly except for one thing - we want to change the colour of some of the particles based on age. In the original pflow system, the particles have a particle age map applied in material which drives the colour change over time, but this doesn’t appear to work once it’s XMeshed.
Is there any way of getting this to work or is there anything that can be done prior to xmeshing to make this work (or any other workaround)?

Thanks,
Rob

Hi Rob,

The Particle Age map is notoriously hacky. It was designed to work with the old-style legacy particles in 3ds Max, so it actually has a limit of 64K particles even when used with Particle Flow. What it does is looking at the object it is assigned to and trying to find a particle system to read the Age and LifeSpan from. The moment you assign that map to an object that is not a particle system, it stops working.
So it does not work with the Compound > Mesher of 3ds Max, and does not work with XMesh either.

A workaround would be to use a Gradient Ramp instead, based on mapping coordinates generated using the Age and LifeSpan channels. This would be quite simple using the DataOps in Box #3 that were added to 3ds Max 2014. Simply divide the Age by LifeSpan, convert to Vector and output as Mapping channel 2. Add a Material with a Gradient Ramp map set to Mapping channel 2 to the particle system and it will map the gradient to the life of the particles. Since XMesh can save all mapping channels, this setup would bake correctly to XMesh and would render the same using the same Material with Gradient Ramp.

A slower approach but using the same principle would be to use a Script Operator to generate the Mapping 2 channel:

[code]on ChannelsUsed pCont do
(
pCont.useAge = true
pCont.useLifeSpan = true
pCont.useMapping = true
)

on Init pCont do ()

on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
pCont.setParticleMapping i 2 ([1,1,1]*(pCont.particleAge.frame/pCont.particleLifeSpan.frame))
)
)

on Release pCont do ()[/code]

This will make a Mapping 2 channel which XMesh and the Max Mesher compound object can handle, and the Gradient Ramp will map the left side of the gradient to the newborn particles, the right side to the dying ones. I feel this is better than the Particle Age map since you get arbitrary colors and not just 3 colors to map…

Remember that the Script Operator will be orders of magnitude slower than the Box #3 / DataOps solution, but they are equivalent.

Thanks for the reply Bobo

Privacy | Site terms | Cookie preferences