# Make Gradient between two gradient spheres

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

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:

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

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:

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.

• 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. Apr 28, 2021 at 11:16

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

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

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

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:

Sphere material:

Hope this is what you wanted.

This is the node group:

Here's the result:

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

• Reply if it solves your issue. Mar 24, 2021 at 9:23
• 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. Mar 28, 2021 at 1:02
• 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. Mar 28, 2021 at 5:01
• 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! Mar 28, 2021 at 18:08