Obi Official Forum
Coloring each particle separately - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html)
+--- Thread: Coloring each particle separately (/thread-2146.html)



Coloring each particle separately - tr5414 - 06-04-2020

Hi, new Obi User here. This is a great tool really liking it so far! What I am trying to do at the moment is to color each particle individually based off an image. Its for project I am making where users can make their colors/image. So lets say I have a picture, like that of a rainbow, I would like to color the fluid being emitted to that of the picture, so that like, there were different bands of color within the fluid based off the picture. I guess how would I start doing this then? Also, I dont have much experience making my own sharers but I am learning.


RE: Coloring each particle separately - josemendez - 07-04-2020

(06-04-2020, 11:57 PM)tr5414 Wrote: Hi, new Obi User here. This is a great tool really liking it so far! What I am trying to do at the moment is to color each particle individually based off an image. Its for project I am making where users can make their colors/image. So lets say I have a picture, like that of a rainbow, I would like to color the fluid being emitted to that of the picture, so that like, there were different bands of color within the fluid based off the picture. I guess how would I start doing this then? Also, I dont have much experience making my own sharers but I am learning.

The solver has a "colors" array containing the color of each individual particle. You could set your own colors here. See:
http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html

However, there's an undocumented emitter shape (ObiEmitterShapeImage) that lets you specify a texture as the emission surface, and sets each particle color according to the texture. Note that your source texture must be readable (have Read/Write enabled) and use a format compatible with GetPixels, for instance RGBA32.


RE: Coloring each particle separately - tr5414 - 07-04-2020

(07-04-2020, 08:30 AM)josemendez Wrote: The solver has a "colors" array containing the color of each individual particle. You could set your own colors here. See:
http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html

However, there's an undocumented emitter shape (ObiEmitterShapeImage) that lets you specify a texture as the emission surface, and sets each particle color according to the texture. Note that your source texture must be readable (have Read/Write enabled) and use a format compatible with GetPixels, for instance RGBA32.

Thank you very much, this helps! Ive got one more question, is there a way to make the colors more vibrant? Just experimenting with a rainbow pride flag, Ive noticed that the fluid colors are pretty muted compared to the original image.