itriix Posted February 24, 2009 Share Posted February 24, 2009 Hi all, in simple form, i'm trying to get one red sphere and one blue sphere to BLEND their colors together when close to eachother. i played around with the attribute transfer sop but it only seems like i can get each sphere to CHANGE the other sphere's color, but not actually MIX the two spheres colors in the "close proximity" areas. Any ideas? Thanks, itriix Quote Link to comment Share on other sites More sharing options...
mic Posted February 24, 2009 Share Posted February 24, 2009 Hi all,in simple form, i'm trying to get one red sphere and one blue sphere to BLEND their colors together when close to eachother. i played around with the attribute transfer sop but it only seems like i can get each sphere to CHANGE the other sphere's color, but not actually MIX the two spheres colors in the "close proximity" areas. Any ideas? Thanks, itriix Hi, itriix! please look the file.. this was quick-done, so i think not very good the main thing is the vex sop, i copy it's code here: (some variables are useless..) sop mix_colors(float threshold = 0.25;) { int npt_sop1 = 0, npt_sop2 = 0; npt_sop1 = npoints(0); npt_sop2 = npoints(1); float min_dist = 100; float min_dist = 100; int i = 0, j = 0; vector c2 = {0, 0, 0}; vector p2 = {0, 0, 0}; vector qqq = Cd; float alpha = 0; for (i = 0; i < npt_sop1; i ++) { import("Cd",c2, 1, i); import("P", p2, 1, i); if (min_dist > distance(P, p2)) { min_dist = distance(P, p2); alpha = clamp(min_dist/threshold, 0, 1); Cd = (qqq + (c2*(1 - alpha) + alpha*qqq))/2; } } } mix_colors.rar Quote Link to comment Share on other sites More sharing options...
stevenong Posted February 24, 2009 Share Posted February 24, 2009 Here's a version with just SOPs. Type Enter in the viewport and adjust the HUD sliders to translate the spheres. Cheers! steven blending_colours.zip Quote Link to comment Share on other sites More sharing options...
mic Posted February 24, 2009 Share Posted February 24, 2009 Here's a version with just SOPs. Type Enter in the viewport and adjust the HUD sliders to translate the spheres.Cheers! steven elegant solution, Steven, thank you ) Quote Link to comment Share on other sites More sharing options...
itriix Posted February 25, 2009 Author Share Posted February 25, 2009 (edited) wow thank you mic and stevenong! this is EXACTLY what i wanted!... I wanted to start simple for my question but now if you don't mind, i have another question... Is there a way to get this to work with COPIES? example... say i have a popnet with some particles being emitted, and then i want to copy a sphere to the particles. and i want the copies COLORS to be able to blend with each other. When I tried this earlier, it wasn't working. Any ideas? Oh and by the way, the colors won't just be red and blue.... in this instance, what i was trying to do was uvproject a texture onto the original sphere, and i want those colors to mix... what i'm actually trying to do is: make a blobby looking substance with SUPER low sim times... when i used metaballs, times went very high, and so, i made a sphere, used a mountain on it, animated it's offset to give the sphere some weird distortion over time, then copied this to my particles. this would give me multiple distorting spheres, interesecting eachother, but not having to run through the whole "metaball" process. but then, to make up for the intersecting and weirdness, because it was just "SPHERES" and not actually metaballs, that's why i began trying to get the colors to mix. I felt that i could get some interesting effect and for way cheaper sim time. and again, thank u so much for your quick reply. i appreciate very much Edited February 25, 2009 by itriix Quote Link to comment Share on other sites More sharing options...
mic Posted February 25, 2009 Share Posted February 25, 2009 wow thank you mic and stevenong!this is EXACTLY what i wanted!... I wanted to start simple for my question but now if you don't mind, i have another question... Is there a way to get this to work with COPIES? example... say i have a popnet with some particles being emitted, and then i want to copy a sphere to the particles. and i want the copies COLORS to be able to blend with each other. When I tried this earlier, it wasn't working. Any ideas? Oh and by the way, the colors won't just be red and blue.... in this instance, what i was trying to do was uvproject a texture onto the original sphere, and i want those colors to mix... what i'm actually trying to do is: make a blobby looking substance with SUPER low sim times... when i used metaballs, times went very high, and so, i made a sphere, used a mountain on it, animated it's offset to give the sphere some weird distortion over time, then copied this to my particles. this would give me multiple distorting spheres, interesecting eachother, but not having to run through the whole "metaball" process. but then, to make up for the intersecting and weirdness, because it was just "SPHERES" and not actually metaballs, that's why i began trying to get the colors to mix. I felt that i could get some interesting effect and for way cheaper sim time. and again, thank u so much for your quick reply. i appreciate very much Hi, itriix, look my example, sorry right now i can't finish up the scene, but maybe the idea will help you. you should use Proximity POP in the popnet to calculate the 'nearest' attribute of the current point. then the standard trick - delete all except one current point and his neighbour, then Steven's method to calculate colours, then copy to all points.. Quote Link to comment Share on other sites More sharing options...
mic Posted February 25, 2009 Share Posted February 25, 2009 wow thank you mic and stevenong!this is EXACTLY what i wanted!... I wanted to start simple for my question but now if you don't mind, i have another question... Is there a way to get this to work with COPIES? example... say i have a popnet with some particles being emitted, and then i want to copy a sphere to the particles. and i want the copies COLORS to be able to blend with each other. When I tried this earlier, it wasn't working. Any ideas? Oh and by the way, the colors won't just be red and blue.... in this instance, what i was trying to do was uvproject a texture onto the original sphere, and i want those colors to mix... what i'm actually trying to do is: make a blobby looking substance with SUPER low sim times... when i used metaballs, times went very high, and so, i made a sphere, used a mountain on it, animated it's offset to give the sphere some weird distortion over time, then copied this to my particles. this would give me multiple distorting spheres, interesecting eachother, but not having to run through the whole "metaball" process. but then, to make up for the intersecting and weirdness, because it was just "SPHERES" and not actually metaballs, that's why i began trying to get the colors to mix. I felt that i could get some interesting effect and for way cheaper sim time. and again, thank u so much for your quick reply. i appreciate very much Hi, itriix, look my example, sorry right now i can't finish up the scene, but maybe the idea will help you. you should use Proximity POP in the popnet to calculate the 'nearest' attribute of the current point. then the standard trick - delete all except one current point and his neighbour, then Steven's method to calculate colours, then copy to all points.. blending_colours_popnet.rar Quote Link to comment Share on other sites More sharing options...
itriix Posted February 26, 2009 Author Share Posted February 26, 2009 Thanks Mic, I noticed that the color is transfering but not blending... any thoughts? meaning the colors just POP from one sphere to another sphere. they don't transition. And it's weird because you still have the same setup essentially that Stevenong has. Thanks! Quote Link to comment Share on other sites More sharing options...
mic Posted February 26, 2009 Share Posted February 26, 2009 Thanks Mic,I noticed that the color is transfering but not blending... any thoughts? meaning the colors just POP from one sphere to another sphere. they don't transition. And it's weird because you still have the same setup essentially that Stevenong has. Thanks! nothing strange, that's cause of the type of the sphere - it's a primitive, not polygon. so only 1 point and 1 primitive. i was in a hurry that time..) Quote Link to comment Share on other sites More sharing options...
mic Posted February 26, 2009 Share Posted February 26, 2009 uploaded the new version, with spheres as polygons.. it blends colors, but it is also resource-intensive.. i think it can be a little bit optimized (by deleting some attributes anr rewriting some expressions in a less-complex manner) blending_colours_popnet_update.rar Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.