Simon, this series is pure gold, but I'd encourage everybody who isn't a genius to play it at 0.75x speed, my brain can process it that way!

Ellie MacQueen

11th November 2020 - 03:19

Hello Simon, thanks for this fantastic tutorial series. It's saving my life this #nodevember ! Question, could you explain why the Multiply Add mode does the same thing as the Map Range nodes in vector terms? I understand that both operations are re-mapping the limited 0-1 range to a wider range (-1 to 1). But how does one multiply and add the vectors here to achieve that same end? Thank you!

Simon Thommes

12th November 2020 - 12:35

@Ellie MacQueen I'm glad you're enjoying it!
Basically the 'Map Range' node, under the hood, does the same thing as the multiply add node. It is just much more convenient due to the inputs that it takes.

In this example:
Multiplying by 0.5 brings values from a range [-1 : 1] to a range [-0.5 : 0.5]. Then adding 0.5 brings it from there to [0 : 1].
So in total from [-1 : 1] to [0 : 1], which can directly specify as limits in the 'Map Range' node.
The 'Map Range' node essentially just uses its inputs to find out what values it needs to multiply and add.

To be honest, if I made this video today, I wouldn't have included the 'Multiply Add' node at all here, as it just unnecessarily complicates things. But I hope this helps!

I'm not sure what you mean with 'in vector terms' here. Both nodes operate on values and a vector in Blender is just a container of 3 independent values. So to apply the same mapping to vectors you would have to either separate the components and control them individually or use vector math operations. (there is also a 'Vector Curves' node that I keep forgetting about)

Pablo Gonzalez

19th August 2020 - 20:34

Hi Simon, in the latest version 2.83.4 the absolute node doesn´t works as expected (exactly , it does nothing) Is that hapend to you also? or I´m doing somethin wrong

Simon Thommes

19th August 2020 - 20:46

*@Pablo Gonzalez* There should not have been any changes regarding the absolute node. I tested it on 2.83.5 and it works fine. My guess would be that you are accidentally clamping the negative values to 0 in an operation before, but that is hard to pin down without seeing the setup. You can post a screenshot and I'll take a look.

Pablo Gonzalez

19th August 2020 - 20:51

*@Simon Thommes* Exactly !! It was clamped. Thank you for your fast answer

fu233

12th September 2022 - 12:45

@Simon Thommes what is the function of CLAMP? I also made the same mistake.

Simon Thommes

13th September 2022 - 13:10

@fu233 Clamping makes sure that your values don't go beyond a certain maximum/minimum. Usually in Blender nodes that is [0-1]. That is sometimes useful to make sure you are not working with values outside of the visible range, but oftentimes also a math operation requires the values outside of those bounds and clamping can give an incorrect result.

kroneborge

21st September 2020 - 03:14

So much good info here, but I'm going to need to watch it about 10 times, lol

Michael Schwarz

20th August 2020 - 16:23

Using the Map Range Node before the RGB Curves node leads to negative values at the output of the RGB Curves node. Is that correct? (Min 2:16)

Simon Thommes

20th August 2020 - 16:45

*@Michael Schwarz* The optput of the map range node, because clamping is activated, is strictly between its 'To' range (0 and 1). And because the RGB Curves node operates between 0 and 1 as well, the output of that node is also in that range.

The map range node is there to map the range of coordinates that the shape will be created on to the range in which the RGB Curves node operates.

Michael Schwarz

21st August 2020 - 10:35

*@Simon Thommes*
Thanks for the reply. It took me some time and some trying but now I'd got it.

Greg McKim

13th October 2020 - 05:10

It would be nice to see either an image with the finished node tree or a Blender file containing the final material

Simon Thommes

13th October 2020 - 10:19

*@Greg McKim* You are right, I added the file in the description

Greg McKim

14th October 2020 - 04:21

*@Simon Thommes* Thanks much!

Tighe Racicot

11th February 2021 - 05:52

I realize I'm going to need to dive into some math if I want to level up in this area. @Simon, when you graph the arctan2 result of x and y, I can't wrap my head around why it's 3D (z values). The z coordinate was dropped off at the Separate XYZ. I had to research the arctan2 function itself. Given two coordinates, it can determine the signed angle (specific quadrant), starting at the positive x axis, outputting a range of values from -pi to +pi. But... why does it spiral vertically?

Simon Thommes

12th February 2021 - 12:08

@Tighe Racicot The graph that is shown is simply a representation of the value that is shown. With this you are not looking at actual 3D data. Just the one-dimensional result of arctan2 on a two-dimensional plane (x,y). The fact that this is displayed along the z axis is due to the value graph tool that I introduced in Chapter 1-4 https://cloud.blender.org/training/procedural-shading/5f07557cb710f162b1d6b5a3

Tighe Racicot

13th February 2021 - 05:17

@Simon Thommes Thanks so much. I reviewed the video and it clicked.

Tighe Racicot

17th February 2021 - 07:39

@Simon I'm just about through this episode. It's taken me on a journey of basic trig, arctan2, polar coordinates. Circling back, I just wanted to confirm why removing the z coordinate to work with cylindrical coords vs spherical coords matters. After testing this on a cube instead of a plane, if I don't drop the z coordinate, everthing is black (or white, depending on the operation between the angle and radius). Is this because the third additional component causes the length to be too large? The angle is mapped to 0-1, but the length could then be greater than 1 or less than -1. Then again, there should be some intermittent values that would result in 0-1 output in the shader. So, I don't fully understand why keeping the z component would cause problems with spherical coordinates.

Simon Thommes

17th February 2021 - 12:10

@Tighe Racicot The length of 3D coordinates is simply their distance from the origin. So on a cube that has a dimension on the z axis the z component also contributes to that distance. On a plane, where z=0 this does not matter but with the cube for example it does, as the z-component distorts the distance from the center. You can see the effect gradually have an effect when you scale the cube on the z-axis in edit mode down to a plane.

By ignoring the z-component you essentially use the distance from the z-axis, instead of the distance to the origin point. (cylindric vs spherical)

Tyler Stephens

24th February 2021 - 03:24

Why does Arctan2(X/Y) provide values outside the functions range of [-pi/2, pi/2]. Also how does it handle it when Y is 0?

Simon Thommes

2nd March 2021 - 12:20

@Tyler Stephens The great thing about arctan2 is that you don't only pass in the quotient of the coordinates x/y but both coordinates individually. That's how you don't have to worry about the divisor being 0 and that's also how it's possible to gain values of the full 2pi range.

How it works is basically that the function is evaluated differently depending on what quadrant the coordinates are in.

Chidi Jenkins-Johnston

10th March 2021 - 21:00

I can't seem to download the chapter_2-2.blend file, I get an access denied. Other than that tutorial is fantastic! Thank you!

Simon Thommes

11th March 2021 - 13:33

@Chidi Jenkins-Johnston Hm, for me it works, even without being logged in...
Can you maybe report this as a bug? Instructions are here: https://cloud.blender.org/contact/

Domas Astrauskas

12th September 2021 - 10:11

Thnaks for this tutorial :)))

Bora Semiz

12th September 2021 - 13:07

Are there any books that you can recommend for beginners to familiarize themselves with application of these math subjects?

Simon Thommes

12th September 2021 - 15:56

@Bora Semiz Besides my general math education from school/university I'm primarily self-taught, so I don't have specific literature that I can recommend fro my own experience, sorry.
A resource that people kept bringing up when it came to this question in the past it thebookofshaders.com and from browsing it a bit it seems to be a fantastic resource. Even though it is not blender-specific, the concepts are universal.

Bora Semiz

13th September 2021 - 20:08

@Simon Thommes Thank you very much. I just skimmed through the book you sent, it looks like something like what I am looking for.

MOHAMMED AIMAN IZZUDDIN BIN ABD MALIK

10th January 2023 - 10:58

Hello Simon, can i know how blender process when i divide some value by 0 ?

Simon Thommes

11th January 2023 - 14:59

@MOHAMMED AIMAN IZZUDDIN BIN ABD MALIK You should always try to avoid this. As correct behavior for this is not defined you will get unintended results in any case. In a shader this usually results in incredibly high/low values that are different per pixel.

## 31 Comments

Join to comment publicly.

## Vsion Studio

15th August 2020 - 11:32

Simon, this series is pure gold, but I'd encourage everybody who isn't a genius to play it at 0.75x speed, my brain can process it that way!

## Ellie MacQueen

11th November 2020 - 03:19

Hello Simon, thanks for this fantastic tutorial series. It's saving my life this #nodevember ! Question, could you explain why the Multiply Add mode does the same thing as the Map Range nodes in vector terms? I understand that both operations are re-mapping the limited 0-1 range to a wider range (-1 to 1). But how does one multiply and add the vectors here to achieve that same end? Thank you!

## Simon Thommes

12th November 2020 - 12:35

@Ellie MacQueen I'm glad you're enjoying it! Basically the 'Map Range' node, under the hood, does the same thing as the multiply add node. It is just much more convenient due to the inputs that it takes.

In this example: Multiplying by 0.5 brings values from a range [-1 : 1] to a range [-0.5 : 0.5]. Then adding 0.5 brings it from there to [0 : 1]. So in total from [-1 : 1] to [0 : 1], which can directly specify as limits in the 'Map Range' node. The 'Map Range' node essentially just uses its inputs to find out what values it needs to multiply and add.

To be honest, if I made this video today, I wouldn't have included the 'Multiply Add' node at all here, as it just unnecessarily complicates things. But I hope this helps!

I'm not sure what you mean with 'in vector terms' here. Both nodes operate on values and a vector in Blender is just a container of 3 independent values. So to apply the same mapping to vectors you would have to either separate the components and control them individually or use vector math operations. (there is also a 'Vector Curves' node that I keep forgetting about)

## Pablo Gonzalez

19th August 2020 - 20:34

Hi Simon, in the latest version 2.83.4 the absolute node doesn´t works as expected (exactly , it does nothing) Is that hapend to you also? or I´m doing somethin wrong

## Simon Thommes

19th August 2020 - 20:46

*

@Pablo Gonzalez* There should not have been any changes regarding the absolute node. I tested it on 2.83.5 and it works fine. My guess would be that you are accidentally clamping the negative values to 0 in an operation before, but that is hard to pin down without seeing the setup. You can post a screenshot and I'll take a look.## Pablo Gonzalez

19th August 2020 - 20:51

*

@Simon Thommes* Exactly !! It was clamped. Thank you for your fast answer## fu233

12th September 2022 - 12:45

@Simon Thommes what is the function of CLAMP? I also made the same mistake.

## Simon Thommes

13th September 2022 - 13:10

@fu233 Clamping makes sure that your values don't go beyond a certain maximum/minimum. Usually in Blender nodes that is [0-1]. That is sometimes useful to make sure you are not working with values outside of the visible range, but oftentimes also a math operation requires the values outside of those bounds and clamping can give an incorrect result.

## kroneborge

21st September 2020 - 03:14

So much good info here, but I'm going to need to watch it about 10 times, lol

## Michael Schwarz

20th August 2020 - 16:23

Using the Map Range Node before the RGB Curves node leads to negative values at the output of the RGB Curves node. Is that correct? (Min 2:16)

## Simon Thommes

20th August 2020 - 16:45

*

@Michael Schwarz* The optput of the map range node, because clamping is activated, is strictly between its 'To' range (0 and 1). And because the RGB Curves node operates between 0 and 1 as well, the output of that node is also in that range.The map range node is there to map the range of coordinates that the shape will be created on to the range in which the RGB Curves node operates.

## Michael Schwarz

21st August 2020 - 10:35

*

@Simon Thommes* Thanks for the reply. It took me some time and some trying but now I'd got it.## Greg McKim

13th October 2020 - 05:10

It would be nice to see either an image with the finished node tree or a Blender file containing the final material

## Simon Thommes

13th October 2020 - 10:19

*

@Greg McKim* You are right, I added the file in the description## Greg McKim

14th October 2020 - 04:21

*

@Simon Thommes* Thanks much!## Tighe Racicot

11th February 2021 - 05:52

I realize I'm going to need to dive into some math if I want to level up in this area. @Simon, when you graph the arctan2 result of x and y, I can't wrap my head around why it's 3D (z values). The z coordinate was dropped off at the Separate XYZ. I had to research the arctan2 function itself. Given two coordinates, it can determine the signed angle (specific quadrant), starting at the positive x axis, outputting a range of values from -pi to +pi. But... why does it spiral vertically?

## Simon Thommes

12th February 2021 - 12:08

@Tighe Racicot The graph that is shown is simply a representation of the value that is shown. With this you are not looking at actual 3D data. Just the one-dimensional result of arctan2 on a two-dimensional plane (x,y). The fact that this is displayed along the z axis is due to the value graph tool that I introduced in Chapter 1-4 https://cloud.blender.org/training/procedural-shading/5f07557cb710f162b1d6b5a3

## Tighe Racicot

13th February 2021 - 05:17

@Simon Thommes Thanks so much. I reviewed the video and it clicked.

## Tighe Racicot

17th February 2021 - 07:39

@Simon I'm just about through this episode. It's taken me on a journey of basic trig, arctan2, polar coordinates. Circling back, I just wanted to confirm why removing the z coordinate to work with cylindrical coords vs spherical coords matters. After testing this on a cube instead of a plane, if I don't drop the z coordinate, everthing is black (or white, depending on the operation between the angle and radius). Is this because the third additional component causes the length to be too large? The angle is mapped to 0-1, but the length could then be greater than 1 or less than -1. Then again, there should be some intermittent values that would result in 0-1 output in the shader. So, I don't fully understand why keeping the z component would cause problems with spherical coordinates.

## Simon Thommes

17th February 2021 - 12:10

@Tighe Racicot The length of 3D coordinates is simply their distance from the origin. So on a cube that has a dimension on the z axis the z component also contributes to that distance. On a plane, where z=0 this does not matter but with the cube for example it does, as the z-component distorts the distance from the center. You can see the effect gradually have an effect when you scale the cube on the z-axis in edit mode down to a plane.

By ignoring the z-component you essentially use the distance from the z-axis, instead of the distance to the origin point. (cylindric vs spherical)

## Tyler Stephens

24th February 2021 - 03:24

Why does Arctan2(X/Y) provide values outside the functions range of [-pi/2, pi/2]. Also how does it handle it when Y is 0?

## Simon Thommes

2nd March 2021 - 12:20

@Tyler Stephens The great thing about arctan2 is that you don't only pass in the quotient of the coordinates

`x/y`

but both coordinates individually. That's how you don't have to worry about the divisor being`0`

and that's also how it's possible to gain values of the full 2pi range.How it works is basically that the function is evaluated differently depending on what quadrant the coordinates are in.

## Chidi Jenkins-Johnston

10th March 2021 - 21:00

I can't seem to download the chapter_2-2.blend file, I get an access denied. Other than that tutorial is fantastic! Thank you!

## Simon Thommes

11th March 2021 - 13:33

@Chidi Jenkins-Johnston Hm, for me it works, even without being logged in... Can you maybe report this as a bug? Instructions are here: https://cloud.blender.org/contact/

## Domas Astrauskas

12th September 2021 - 10:11

Thnaks for this tutorial :)))

## Bora Semiz

12th September 2021 - 13:07

Are there any books that you can recommend for beginners to familiarize themselves with application of these math subjects?

## Simon Thommes

12th September 2021 - 15:56

@Bora Semiz Besides my general math education from school/university I'm primarily self-taught, so I don't have specific literature that I can recommend fro my own experience, sorry. A resource that people kept bringing up when it came to this question in the past it thebookofshaders.com and from browsing it a bit it seems to be a fantastic resource. Even though it is not blender-specific, the concepts are universal.

## Bora Semiz

13th September 2021 - 20:08

@Simon Thommes Thank you very much. I just skimmed through the book you sent, it looks like something like what I am looking for.

## MOHAMMED AIMAN IZZUDDIN BIN ABD MALIK

10th January 2023 - 10:58

Hello Simon, can i know how blender process when i divide some value by 0 ?

## Simon Thommes

11th January 2023 - 14:59

@MOHAMMED AIMAN IZZUDDIN BIN ABD MALIK You should always try to avoid this. As correct behavior for this is not defined you will get unintended results in any case. In a shader this usually results in incredibly high/low values that are different per pixel.

## MOHAMMED AIMAN IZZUDDIN BIN ABD MALIK

12th January 2023 - 08:57

@Simon Thommes i see, thank you Simon