Page 1 of 1

ParticlePainter

Posted: Tue Dec 10, 2019 11:20 pm
by u3dreal
Hi this is my new coding challenge.

It's an addon for Blender 2.8+ that bakes the particle color or uv or image pixels or any value into
Blender Particles during birth. They can be retrieved via the ParticleInfoNode.

Image

Would someone like to betatest it ?? Unfortunately it only works with cycles and not LuxCore.:(

Here is a demo with audio used.
http://q3de.com/wp-content/uploads/2019 ... _small.mp4

cheers u3dreal

Re: ParticlePainter

Posted: Wed Dec 11, 2019 12:16 pm
by FarbigeWelt
Hi u3dreal

I have some interest in what you presented here. I wonder if there is a way to use Material ID with particles. If there is a way a material can setup to use material id as color output. This means an image read linearly could contain a color palette, pixel0 to pixeln would define n+1 rgb colors. Each color leads to a specific material id wich defines with one material the color of all particles, every particle with its own color.

Can material id be set individually for particles?

Re: ParticlePainter

Posted: Wed Dec 11, 2019 1:04 pm
by u3dreal
Hi Farbigewelt !

I'll explain a little more. Particle color is set during birth. (It is written to the angular_velocity slot in the particle .. 3 Values.)

You can either use the diffuse value of a Pricipled BSDF ... mode 1
or write the UV's and use the same texture on the particles ... mode 2
or get the actual pixel RGB from a texture. ... mode 3
or get 3 Values from the Emitter material ... just a Value Node or three ... mode 4

So why would you like to have a list with mat id's for 500000 particles ??? Just asking.

Re: ParticlePainter

Posted: Wed Dec 11, 2019 1:55 pm
by FarbigeWelt
u3dreal wrote: Wed Dec 11, 2019 1:04 pm or get the actual pixel RGB from a texture. ... mode 3

So why would you like to have a list with mat id's for 500000 particles ??? Just asking.
Thank you for the feedback.

Actually, I did not mean any list.
But
a) A how ever drawn colorful image (e.g. png) as source for the n+1 colors where each pixel i defines the color of a particle i.
b) A photo image to color particles placed i as volume grid, where particle position x,z meets the color of an image pixel x,y.

This will only work in LuxCoreRender (requires specific python scripts) if particles are similar to objects, meaning if they already have the property material id.

Re: ParticlePainter

Posted: Wed Dec 11, 2019 2:04 pm
by u3dreal
OK ... that is essentially what i do ... get the rgb color of the texture on the nearest point on the emitter object.

But how could this be feed into luxcore ?

Re: ParticlePainter

Posted: Wed Dec 11, 2019 4:04 pm
by FarbigeWelt
u3dreal wrote: Wed Dec 11, 2019 2:04 pm OK ... that is essentially what i do ... get the rgb color of the texture on the nearest point on the emitter object.

But how could this be feed into luxcore ?
As mentioned, if particles have the property material id, you have only to change its value in the kind I did for objects.
Check the add-on's python script. If you search for color or material id then you should easily find the relevant parts.
Rainbow Chains V0.9, the addon version

Re: ParticlePainter: ObjectID

Posted: Wed Dec 11, 2019 6:35 pm
by FarbigeWelt
I made a few tests with LuxCoreRender's material. I found a mistake in my last posts. It is not the material id. The correct node is object id.

Check the following screenshots cutouts. As you can see the particles' color can be changed individually. I tried with an image texture too but it did not work. The texture colored each particle the same way (as expected due to UV map).
Particle Material
Particle Material
Matte.ObjectID - ObjectID
Matte.ObjectID - ObjectID
ViewPort Particles - ObjectID
ViewPort Particles - ObjectID
Matte.ObjectID - VectorPosition x VectorPosition
Matte.ObjectID - VectorPosition x VectorPosition
ViewPort Particles - VectorPosition x VectorPosition
ViewPort Particles - VectorPosition x VectorPosition
Position vector is multiplied with itself to get values above 0. You may instead add a constant value of 1 to the vector position with the vector math.

Conclusion: Particle color can be changed individually.

Re: ParticlePainter

Posted: Wed Dec 11, 2019 7:00 pm
by u3dreal
Well kind of ... but can you can't set color directly during birth ... ah i think i got an idea ... Nope ...

we can not access angular_velocity from within lux nodes ... or do we ???

How could this be added ? and where ?? I'm willing to give it a try on the exporter.

So we need a particleInfo node.