7
$\begingroup$

I have two Empty Objects. They are both Scale 1, but have different Sizes set in properties: enter image description here

They are each used as Object Texture Coordinates for a Spherical Gradient Texture. The smaller one is scaled down via a Mapping Node. The big one is in Blue, the small in Black: enter image description here enter image description here

I want to somehow get a gradient between the edges of these spheres. Here's a mockup of what it should look like (made by color ramping the big sphere): enter image description here

Note that its hit full White by the inner circle. Here's another ramp from black to white to black to make it more clear: enter image description here

The idea is that whatever I scale the Objects by, I'd always have a linear gradient from the edge of the outer sphere to the edge of the inner sphere.

Is this possible? I can think of some ways to do it with drivers (and a lot of setup), but I'm looking for a method using only nodes.

$\endgroup$
1
  • $\begingroup$ Just for clarification: the two empties you are talking of, you say spheres but they are circles, aren't they? My answer uses circles, I hope that's okay. $\endgroup$ Apr 28, 2021 at 11:16

3 Answers 3

6
+50
$\begingroup$

You can deduce the scales, and therefore the radii, of your Empties, by dividing the shaded object's Object-Space length to the shading-point, by the same length, in the Empty's spaces. (The Empties are set to display at 1 unit, and are at the object's origin in XY):

enter image description here

..The range between the radii can be mapped to (1->0), and clamped, using a Map Range node.

Here illustrated by putting the range through a color-ramp, and scaling the Empties:

enter image description here

.. Sorry, I can't get the Empties to show up very well in the .gif, but they are at the bounds of the gradation.

$\endgroup$
3
$\begingroup$

Maybe this might help you. It uses a Gradient Texture set to Spherical and drivers connected to 2 Empties which drive the mapping of the 0 to 1 values. Together they create the gradient from black outside to black inside, with white in the middle between them. Of course you could change the gradient to red and blue instead of black and white with a Color Ramp. This can also be used to sharpen the the gradient or put more colors inbetween. To get it on the plane I've used Texture Coordinate > Object.

The material of the sphere is a bit different. To set different colors for the outside and the inside, there are 2 Color Ramps combined with another method than in the plane material. Also the Texture Coordinate I use there is UV, with the sphere unwrapped from top view with UV Mapping > Project from View (Bounds).

The sphere material works on the plane material, too, but depending on what you need the plane material is a bit simpler and might work on other objects as well (but not on the sphere).

Plane material: plane material

Sphere material: sphere material

$\endgroup$
1
$\begingroup$

Hope this is what you wanted.

This is the node group: enter image description here

Here's the result: enter image description here

Location_X and Location_Y define the location, Scale_Bigger is the scale of the overall circle and the black value of the color ramp can be moved to change the size of the smaller circle, the proportions will be the same if you scale the plane. Also, it is an even gradient from 0 to 1 from the edge of the inner circle to the edge of the outer circle

Blend File: https://drive.google.com/file/d/1KJET89vjk2gglEclgz--hqDZDkGAduYz/view?usp=sharing

$\endgroup$
4
  • $\begingroup$ Reply if it solves your issue. $\endgroup$ Mar 24, 2021 at 9:23
  • $\begingroup$ Thanks, but I'm afraid the setup needs to work with 2 separate Object Coordinate projected spherical textures. Ramping one texture into 2 spheres is not sufficient. $\endgroup$
    – Ascalon
    Mar 28, 2021 at 1:02
  • $\begingroup$ Hey, The thing is that this node setup is the easiest way to get an even gradient between two circles(That I know of). To use two texture coordinates would require a lot of complex math(Which is beyond my skillset) and the result be will almost(if not completely) the same. $\endgroup$ Mar 28, 2021 at 5:01
  • $\begingroup$ Yes, I understand. The issue is that the two circles are rigged (this is for an eye texture) and are going to be changing in scale. So that's what I'm trying to solve this for. Thank you for trying though! $\endgroup$
    – Ascalon
    Mar 28, 2021 at 18:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .