Jump to content

blending colors


itriix

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by itriix
Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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..)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...