View Full Version : Particle painter : how to implement

05-30-2004, 09:45 AM
I've seen many people ask for a particle painting system, and must admit, it would be handy. I've been thinking about how, and believe this could be implemented fairly easily...

Currently in LW, it's possible to set up the procedural "Value" shader with a spherical falloff around the texture's center position. This creates a sphere of colour in 3D space which "projects" onto a surface wherever a polygon and the "sphere of opacity" intersect however the current Value shader is only a single texture layer. My idea is to expand the Value shader to use a dynamic number of layers, each created, controlled, and destroyed by a particle.

But let's go a bit further than just a multi-layer value shader... ;) At the moment, all we've got is something that paints a fixed blob of colour around each particle. To be truly useful, you need to be able to control and animate the falloff, opacity, and colour based on particle interaction and age.

Falloff and opacity should have at least two methods of control : one linked directly to particle age, and a second controlled by a combination of envelope and particle interaction. The first method is self explanatory, so I'll move on to the envelope notion... ;) Let' say we want each particle-shaded region to "pop" onto a surface when our particles hit it, expanding rapidly, then contracting slightly. So, we create an envelope as follows (keyframe0,value0; keyframe5,value150; keyframe10,value100) then set the envelope's end behaviour to "constant" so that a particle's layer will continue to shade at 100% of the particle's size for the lifetime of the particle. Now, when we animate particles sticking to a surface, our procedural shader creates a new layer each time a particle impacts, and for each layer the envelopes controlling animation of the particle's falloff/opacity are shifted in time by (time/fps).

Okay, so now you want to paint something more complex than a single colour? Put the particle painter in the bump channel, and shade that with a gradient based on the bump channel. Better yet, put the particle painter over additional texutre layers and change the blend mode to "alpha" to do an animated reveal.

Just some thoughts.... :)


Actually... :) Another really neat notion is that if you treat the vertices of an object as particle group A initially, and then set up an event so that collision with another object changes them to particle group B, you could end up with a way to interactively "paint" on an object in Layout... As particles are moved from group A to group B, they're "born" in group B, and get shaded. ;)