2
$\begingroup$

I'm trying to find the most simple way to put a spherical gradient texture on a plane (square) so that the circle of the gradient and the plane are aligned center to center and the circle fits the plane.

I can do it with the gradient texture but the circle of the gradient just never fits the plane. I read somewhere that the center of the gradient will be where the origin of the geometry is, but I have the origin of the plane in its center, yet the gradient is always off. I could play with the mapping node settings and scale and translate until it more or less fits, but I just can't imagine I need to do it manually, that there isn't a more simple and exact way? I'm using cycles render.

Using the node setup posted by LukeD in his answer, I do get the desired result starting from scratch, using the startup blend file. But with my project file, using the same node setup, the plane remains just black. Then I noticed a tiny little dot of a gradient circle in the middle of the plane, when rendered close up. It's very tiny and even pushing the colour ramp handles extreme to the edge just barely makes it bigger. I have my units setting on metric, with a scale of 0,01 because I work with centimeters. Changing the units to "none" and the scale to "1" did not seem to have any effect on the result. (see screenshot)

I added a mapping node with the "texture" tab clicked and a scale of x1000 to all 3 axes and this fixed the problem, giving the expected result (see screenshot)

So is this a bug? Why is a x1000 scale factor needed (not x100) to make up for a 0,01 scaling?

gradient texture not working as expected

Scaling up with a Mapping node fixes the problem

$\endgroup$
2
$\begingroup$

Connect Texture > Gradient Texture (spherical) to Diffuse color node, as a vector choose Object and add Color Ramp to play with colors and color blends.

gradient

Edit:

For transparency you can choose Color Ramp as factor for Mix Shader.

gradient_2

Edit 2:

I have created scene with the same unit settings as yours and here is what we have:

Plane, scaled to 2x2m.

gradient_3

And this very same setup but with applied scale (CTRL + A).

gradient_4

Edit 3:

I have checked it in Blender 2.77a and 2.78 RC1 and it looks all the same. So my guess (as Blender docs doesn't cover much about Texture Coordinates > Object) it's not a bug but this is how those calculations works. Other textures behave the same. You can 'fix' texture scaling in Texture tab without setting Mapping node and calculations there are correct - scale 100.

Gradient 5

Edit 4:

Good catch with other dimensions. Now I'm totally stuned about it. But here is a method that is working with every dimension scale (applied or not). Don't ask me why it is working, but it is working :)

You need to change Texture Coordinates to Generated then in Texture tab change Location to X > 5mm and Y > 5mm (this is part that I don't know why 5mm is ok for 2, 20 and 200m, this was my lucky guess) and Scale to 0.5.

gradient_6

$\endgroup$
  • $\begingroup$ I have tried the same node setup before. I tried it again, copying it from your image, in a clean, new .blend scene and it didn't seem to work. Then I noticed a tiny little dot of a gradient circle in the middle of the plane, when rendered close up. It's very tiny and even pushing the colour ramp handles extreme to the edge just barely makes it bigger. Now this is a mystery! I have made a screenshot but not sure how can I post it in a comment. $\endgroup$ – Booth Sep 7 '16 at 15:28
  • $\begingroup$ Check this blend file and tell me how it's working: blend-exchange.giantcowfilms.com/b/1928 Tell me also which Blender version are you using and what GPU do you have, and maybe units used in project. $\endgroup$ – cgslav Sep 7 '16 at 17:49
  • $\begingroup$ Thank you: works perfectly well with your .blend file on my computer. I have the same node setup and it doesn't work in my file. I have checked the units setup: you use none but when I changed to metric with a 0.01 scale, it still works. In my file I use metric with a 0.01 scale and it doesn't work even if I change over to "non". I use Blender 2.76 b , I have NVIDIA GeForce GTX 750 Ti $\endgroup$ – Booth Sep 7 '16 at 20:12
  • $\begingroup$ I just tried again, from scratch, using the startup blend file, and it works there too. Must be something interfering in the specific blend file that I use? $\endgroup$ – Booth Sep 7 '16 at 20:33
  • $\begingroup$ Could be some settings. Upload your blend file to blend-exchange.giantcowfilms.com and I'll give it a look. $\endgroup$ – cgslav Sep 8 '16 at 6:24

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.