8
$\begingroup$

If I mix two shaders together, like the diffuse and glossy shaders, I understand that I can change the factor slider between 0 - 1.

diffuse and glossy

and that having 0.5 factor will show a 50% mix of blue diffuse and green glossy.

enter image description here

What isn't clear to me is what is going on when something else is plugged into the fac input, if I plug in a checker texture for example, with white and black as its two color values.

enter image description here

This now clearly seperates the two shaders based on the checker texture, I understand its doing that but how does it get away with not just supplying 0 - 1?

enter image description here

If I am only allowed to supply 0 - 1 using the slider, what is the checker doing to the factor that I can't do with my slider? Can you explain what can be plugged in to the fac input and how it differs from the user control slider.

$\endgroup$
7
$\begingroup$

Using the slider will just give one value for the entire surface (or volume, now that we have volume rendering :)

Using a texture will give multiple values mapped to different locations (the depends on the texture mapping of course):

enter image description here

Basically the texture is supplying a value between 0-1 per ray.

Think of it this way: Each "light ray" cast from the camera by cycles that hits your object will test to see if the mix shader is resulting in shader 1 or shader 2. If the texture controlling the factor is black (0) where the ray hit, it will bounce off the diffuse part of the shader. If it is white (1) where the ray hit, it will bounce off the glossy part of the shader.

So, you can use anything which results in a value (which is pretty much anything). However that's not to say that everything will give a meaningful or useful result.

Note that even if the factor is somewhere between 0-1, the ray will only sample one shader at a time (if you are using the progressive integrator), but with many rays sampling the same point it will converge to a pixel which is a mix between the two shaders.

$\endgroup$
  • $\begingroup$ So when I set the control to 0.5, that is for every single ray? But the checker texture controls 0 - 1 for every pixel of its generated texture? $\endgroup$ – Neil May 21 '14 at 21:08
  • 3
    $\begingroup$ Exactly. Using the slider is like using a solid color. $\endgroup$ – gandalf3 May 21 '14 at 21:13
  • $\begingroup$ The checker texture is sampled for each pixel on the screen, and each sampling might give a different result. Different pixels on the screen are going to "see" different parts of the checker texture, giving different factors. $\endgroup$ – R. Navega Jun 20 '17 at 8:23

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.