CG GroundBirdie (groundbird)

3 answers · asked · Lesson: Hologram · Course: Shader Forge

What's the difference between using the Factor node and Color?

@ 6:09 You drag the factor from the Wave node into the color slot nr2. Why don't you use the color node instead? What's the difference?

  • Hi groundbird 

    The difference is that the Factor outputs a value (between 0 and 1) for each point in space, whereas the Color outputs a 3 dimensional vector (for RGB). So, in case of the Wave Texture, the result looks the same, but where the Factor outputs 0.3, for instance, the Color would output (0.3, 0.3, 0.3).

    The difference is a slight performance increase if you connect everything correct.

    If you connect a color output to a factor input, or the other way around, Blender has to do a conversion from a vector to a value, or vice versa. This takes a little time.

    So, in the case of the video, it would actually be better to connect the Color of the Wave Texture into the Color of the Mix Node.

    The result would be the same visually, but a tiny bit faster.

    In the following example, the Faster material rendered in 1.19 min and the Slower one in 1.25 min, but there are two factor/color outputs. The more 'misconnections', the slower;)

     

    • Wow, thanks for the fast & thorough reply! 

      So if i get you right, if you would want to use the colourramp as a factor for a mix shader, you should use the Aplha (grey node) to lock it into the Factorslot of the Mixnode.

    • Not really, the Alpha output is grey, because it outputs a single value.

      However this is either 0 or 1 and indicates whether a pixel is transparent or opaque.

      So, in the above mentioned example, the Alpha output of the Colorramp would be pure white, because every pixel is opaque. You definitely do not want to use that as the factor of a mix node!

      But very often you would put a Colorramp after a generated texture (like a Noise, Voronoi, Wave,etc). Then you would connect the Fac output to the Fac input of the Colorramp. (you will see a lot of people connecting the Color output to the Fac input, (sometimes even putting a RGB to BW node in between), this is not the best way to do this performancewise, although the result will be okay.)

      So, yes, generally you will want to connect the same color output to the inputs, but there are exceptions.