8
$\begingroup$

Uncolored sphere

Varying colored tubes

I have a series of tubes that were inputted as VRMLs with varying colors. I have made a path out of them and have the sphere following the tubes. I want to link the color of the sphere to be the same as the tube while the sphere is traveling in time over the tubes. How can I link the colors? I also want the sphere to glow with the color of the tube.

$\endgroup$
  • $\begingroup$ With textures it is not too hard, just make the mapping based off of an object, and put the same material on the sphere. As is, I'm not sure . . . $\endgroup$ – VRM Jan 14 '15 at 15:46
  • $\begingroup$ What defines the color of the tubes? $\endgroup$ – PGmath Jan 14 '15 at 16:27
  • $\begingroup$ @PGmath His nodes have an Attribute node with a Col value. I would assume that it is what is influencing the color. $\endgroup$ – VRM Jan 14 '15 at 16:40
  • $\begingroup$ @NoviceInDisguise I currently have the material on the sphere the same as the tubes. Can you explain more on how to map the sphere with the object being the tube or provide a link for mapping based on an object? $\endgroup$ – rwinfree Jan 14 '15 at 17:15
  • $\begingroup$ @PGmath NoviceInDisguise is correct. I am using an Attribute node which contains the tubes coloring based on settings from an external program. $\endgroup$ – rwinfree Jan 14 '15 at 17:17
7
$\begingroup$

I found a way to do this using translucency and some node tricks to make the tube emit light when it is under the ball, it isn't perfect but it works fairly well.

First give the ball a pure white transparent shader mixed with a translucent shader based on the is camera ray output of the light path node:
enter image description here
This will make the ball invisible to everything but the camera, this isn't necessary but will reduce noise, artifacts, and rendering time.

Next give the tubes a diffuse shader mixed with an emission shader (with a very high strength) based on the is transmission ray output of the light path node and plug the vertex colors into both the diffuse and emission shaders:
enter image description here
This will make the tube emit light when a ray is traveling through an object (such as a translucent object), but the tube will look like normal (the diffuse shader) elsewhere.

This is the result:

enter image description here
enter image description here
enter image description here

$\endgroup$
  • $\begingroup$ This was a very creative idea! It worked well enough for me. Thank you! $\endgroup$ – rwinfree Jan 20 '15 at 20:51
5
$\begingroup$

A new 2.74 feature allows controlling texture mapping by object, which may also be a choice:

  • Use Object coordinate for mapping, an empty object as the coordinate controller;
  • Assign the same material to both tube and sphere.

enter image description here

enter image description here

NOTE: Since this is a new feature that will be officially released with the coming 2.74 version, you may have to compile your own build, or download any of the daily builds from here.

$\endgroup$
  • $\begingroup$ Very nice! Once this makes it into the official build, this could be great! $\endgroup$ – VRM Feb 21 '15 at 20:14
  • $\begingroup$ Awesome! I have been wanting that for sooo long! The problem for this application though is that the tube colors are defined by vertex colors, and can't really be put into a color ramp. $\endgroup$ – PGmath Feb 24 '15 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.