how to blend particle colors of different point clouds?

340 views
Skip to first unread message

Debdas Mohanty

unread,
Dec 25, 2011, 3:56:39 PM12/25/11
to soft...@listproc.autodesk.com
Hello Friends.

Merry  Merry Christmas. Sorry for disturbing you on holidays. I have a very basic question on ICE attribute transfer between different point clouds.

I have TWO cache point clouds with different colors .
Can anyone tell me how to blend two colors of different point clouds and generate a new color when particles come close to each other ?


regards

Debdas

Alok Gandhi

unread,
Dec 25, 2011, 4:32:34 PM12/25/11
to soft...@listproc.autodesk.com
Create a third point cloud emitting from  the position of the two cloud. Use locations to query the colors from the original point clouds. Use an if node to get distance between the points. If close enough blend the colors. To blend you will have to use color to rgb and then a blend node for each component, and compose back to color using rgb to color node and finally set data.

There might be other ways, I am not on a machine to suggest.

Merry xmas.

Sent from my iPhone

Debdas Mohanty

unread,
Dec 25, 2011, 5:27:04 PM12/25/11
to soft...@listproc.autodesk.com
Thanks Alok. 

blend color.JPG

By this way i am getting result but its taking a very long time to calculate. 

Is there any other way by which i can reduce the time??

regards
Debdas



--
Regards,

Debdas Mohanty
Fx Artist

blend color.JPG

Andy Moorer

unread,
Dec 25, 2011, 8:16:41 PM12/25/11
to soft...@listproc.autodesk.com
Also not on a machine, but assuming each point cloud has a uniform "base" color, my first thought would be to put a post sim tree in each of the two clouds that gets the distance to the closest point on the other cloud. That value, rescaled and clamped, would drive the weight on a blend node which blends between the two colors.

(If I recall right, get closest point on geometry works on point clouds.)

If you have many different colors of points on each cloud, you would have to also get the color of the closest point, and probably average several neighbors. Consider working with HSV color to keep things simpler/intuitive.

hope that helps (and is correct :) Happy holidays.

- AM

Debdas Mohanty

unread,
Dec 26, 2011, 1:10:29 AM12/26/11
to soft...@listproc.autodesk.com
hello Andy,

if possible snap shots of ice trees will be nice to understand. 

Andy Moorer

unread,
Dec 26, 2011, 10:45:33 PM12/26/11
to soft...@listproc.autodesk.com
Sure, I'll do a test when I get to my machine and let you know the results. Cheers - AM

Andy Moorer

unread,
Dec 27, 2011, 12:59:55 PM12/27/11
to soft...@listproc.autodesk.com
ice_simpleColorMixExample.jpg

Here you go. 2 point clouds, each with this simple tree as a post-sim operator. 

This works and is fast, but notice that it only queries the init_color, not the current color. This is because you run into an order-of-operations issue if you use 'curren't color. You can have any number of different emit colors, but the colors cant change over time in the sim or else you would need to use an approach like Alok is describing, using a workaround like a third point cloud to express the blend between the other two.

In general, I find the post-simulation stack to be a very handy place to change colors before render, to simulate lighting, or my personal favorite to delete particles (which are retained in the simulation deleting post-sim acts a bit like a visibility on/off... very, very useful.)
ice_simpleColorMixExample.jpg

Andy Moorer

unread,
Dec 27, 2011, 1:05:11 PM12/27/11
to soft...@listproc.autodesk.com
I spoke too fast, you can run into order of operation/cycling issues with this tree too. Experiment with it and you'll see what I mean. o_O

Debdas Mohanty

unread,
Dec 28, 2011, 3:24:51 AM12/28/11
to soft...@listproc.autodesk.com
Sorry Andy.. this not working for me.. as I told you I am not using a simulated ice tree. I am using cache point cloud. so there will be no post simulation. if some where i went wrong let me know.

blend color1.JPG


blend color1.JPG

Ciaran Moloney

unread,
Dec 28, 2011, 5:13:36 AM12/28/11
to soft...@listproc.autodesk.com
Looks like you're trying to get closest location on its own cloud. 'Get Green' is on Green's ICE Tree, 'Get Blue' is on Blue's ICE Tree. Try swapping those.
blend color1.JPG

peter boeykens

unread,
Dec 28, 2011, 6:43:42 AM12/28/11
to soft...@listproc.autodesk.com
If Im not mistaken on each cloud you are looking up the cloud itself (green on green and blue on blue) - you have to look up the other cloud...
blend color1.JPG

Andy Moorer

unread,
Dec 28, 2011, 9:47:58 AM12/28/11
to soft...@listproc.autodesk.com
Yep. :D

Also bear in mind, the post-simulation stack doesn't require simulation to be occurring, you can act on anything that appears prior to your tree, including information brought in via a cache. I suggest a post-sim simply for organization and clarity. In the case you show here, a second operator after your original is fine (you could also have the operator up in secondary shape modeling, or even create and delete a simulated tree to expose a post-sim slot.)

But you will find with the approach I show here that problems crop up... coloring one cloud based on the other works fine, coloring -both- clouds based on each other can cause some interesting issues. Hand me a mud sandwich, Alok. ;)

Debdas Mohanty

unread,
Dec 28, 2011, 10:04:30 AM12/28/11
to soft...@listproc.autodesk.com
Thanks Ciaran,

Ya that is what Andy suggested me to do and i was confused for that. with swapping those cloud names, its only affecting only one particle cloud.  its not affecting the other one at all.

For me RED particles affecting White Particles and changing those colors to different colors. At the same time White particles have no effect on  Red particles.
With this its not blending colors rather it is changing colors.

I am looking for blending colors between two point cache point clouds.
for instance if i am blending milk with chocolate then result liquid color should be milky chocolate not green red chocolate.. :(

with one point cloud with 2 colors of particles it blends perfectly. but takes very long time to calculate.

Any better way to do it please let me know.blend color2.JPG
blend color2.JPG
Message has been deleted

Andy Moorer

unread,
Dec 28, 2011, 10:48:19 AM12/28/11
to soft...@listproc.autodesk.com
The unexpected color shifts are because the example I give you only effects hue, to deal with a milk/chocolate scenario you also need to deal with saturation and value. You can use additional linear interpolate nodes just like how the hue is set up, or replace the entire HSV portion with a blend color node.

The other issue is why I'm eating this mud sandwich :) Trying to adjust color of both trees in relation to each other results in order of operation errors and only the first tree to evaluate changes - You would need to introduce a third tree per aloks suggestion to avoid the cycle.

Alokgandhi

unread,
Dec 28, 2011, 12:25:55 PM12/28/11
to soft...@listproc.autodesk.com
That might be the case Andy, I suggested the third tree because it came to natural thought process. You have two separate inputs and you create a third output from it, keeping it all logical.

Sent from my iPad

Rob Chapman

unread,
Dec 30, 2011, 11:01:35 AM12/30/11
to soft...@listproc.autodesk.com
woops, in my haste I sent you an ill configured scene. rather than send the scene again I'll try and save some bandwidth and tell you how to change it so it works correctly and explain what the tree is meant to do. have a look at the attached image and set these values on both clouds. 

the rescales are what you would alter on each cloud if you wanted a certain pointcloud to be weaker or stronger mix, and the integer on its own there is a throttle on max neighbours, obviously the more searched for on each particle, the slower it would be, I found 9 to be a reasonable amount for this scene.

hope that helps?





paintmix.png

Debdas Mohanty

unread,
Dec 30, 2011, 3:03:48 PM12/30/11
to soft...@listproc.autodesk.com
Hello Rob,

Thanks.. Nice job.. this is working great if i am simulating 2  particle clouds and intersecting particles with each other.

But when i am applying the same setting to the my both point cache clouds, only one point cloud is changing color and other one keeping its original color.
i am not finding any logic behind it. if the ice tree is working for one point cloud then it should work for the other but its not working..

I m using very heavy Realflow point cache scene file otherwise i would have sent that.

Do you have any idea, why it has the problem??? 


regards

debdas

Debdas Mohanty

unread,
Jan 7, 2012, 7:21:58 AM1/7/12
to soft...@listproc.autodesk.com
Hello
  
 Still i have not get a perfect solution for the blending issue of .. 

@Rob:  Thanks for the scene and compound but its not working for me.. because i have particles from RF. so i cant use a simulated ice tree.

@Alok: as you said to create a 3rd point cloud from the cache point cloud. I did that but latter i realized that 3rd point cloud is flickering a lot. Also this 3rd point cloud not generating points at the same point as in the cache point cloud. but in this way the my problem for blending colors is solved.


any more solutions???????????????

Regards,

Debdas Mohanty

Rob Chapman

unread,
Jan 7, 2012, 8:00:31 AM1/7/12
to soft...@listproc.autodesk.com
oh! thought I'd sent you a scene off list that mixes two cached pointcloud colors, maybe it got eaten by some spam filters or file size limit. here it is anyways attached again.

Its a bit of a hack and uses the 'cache on file' node to load the caches rather than the cache manager. this is so that you can uses the simulation stack to add up data incrementally rather than set it explicitly, also Im assuming that their is no unique ID's or Age attribute data for each cache so am recreating Age from element index and having to reset it if, like the example caches that I made, the element index is reused.

theres some more things in the compound as well like having the option for directly setting the collision color and also a gradient over time.  maybe this will work for you.

Best regards,

Rob
mix_colors_on_cache_on_file_working.zip

Debdas Mohanty

unread,
Jan 7, 2012, 9:19:56 AM1/7/12
to soft...@listproc.autodesk.com
@ Rob: As i mentioned, i am using realflow .bin files as cache.. those are not Ice cache file. So if i will use a simulated ice tree on that, then it will spoil the whole flow.
sure I will try your compound with ice cache file once I finish my present work..


@ Alok.. sorry. it was  my mistake instead of using "add points" node i used "emit from position" in hurry.. with "Add points" its working superb..


Thank you all guys...

regards,
Debdas

Rob Chapman

unread,
Jan 7, 2012, 11:38:52 AM1/7/12
to soft...@listproc.autodesk.com
ah my mistake, Ive not used realflow bin files much and had assumed that there was a node that I think Steven Carron wrote that you could load them in like the cache on file node. ah well , at least you got there in the end.

Best

Rob
Reply all
Reply to author
Forward
0 new messages