Hello and welcome to another episode in the Godot Basics tutorial series, keep in mind a Godot Tutorials is not affiliated with or sponsored by Godot game engine. In this episode, we will be taking a quick look at the Canvas Item material resource class.
And that's because we will be dealing with lights in a future episode.
One more thing to keep in mind is that there will be no code example in this episode. Now, materials are resources that change the appearance of objects. However, since this series is dealing in 2D, most of these simple rendering manipulations will be quite simple when compared to 3D.
Now the Canvas item material resource class is usually attached to a canvas item class, and since the known 2D node class object is a class of canvas item, that means that every Notari game object can in fact use the canvas item material resource class.
Now the most important property of the canvas item is the material property. You can't do much in terms of rendering effects without any material resource. The canvas item takes in two different types of material resources. The first is the shader material. The second is the canvas item material. We will take a basic look at shader materials in a future episode.
Now the canvas item resource class, once attached to the canvas item class, has two property values that are important for now.
The first is the BLEND mode and the second is the late mode. Both these properties take in enum values. Let's go ahead and take a look at Blende demotes. Now you have five choices when it comes to blend modes. You have mix, add, subtract, multiply and pre multiply alpha by default. You are given the blend mode called mix. The blend mode code mix mixes your images. Basically it renders one on top of the other based on the ordering of your symmetry.
If you have not changed any of the default values provided to you by the canvas item class properties. Next on the list is add.
If you decide to set your blend mode to add or additions, you will basically add the colors of the background and the image.
The third option is subtract and you basically do the opposite of addition, which is you subtract colors of the background and the image. The fourth choice is multiply. And just like addition and subtraction, you will multiply colors of the background and the image. And lastly, you have pre multiplying alpha. Now, with the blend most set to Pre multiply Alpha, you will multiply the alpha values on your image to the values of that image. The reason for this is you get a better looking image when you change the opacity of your image.
Again, the opacity being the alpha value. Next, let's take a look at the Light Mode property. The light mode property comes in three different options.
The first is normal, the second is shaded, and the third is unshattered. By default, mode is set to normal, one set to normal. You will add a light source value onto the existing images, visual properties.
Basically you are telling the image how it should react to the light, to the node.
Now, if you change the light mode to shaded, basically your image will be visually affected based on the light source. This means that unlike normal, where you will still show your image even without a light source with shaded set as your late mode option, your image may in fact disappear if in fact it is not close or being affected by light, or in this case, a light to denote. And the last option is unshattered. And with this option set on, what this means is that your image will not be affected by any light source.
Now, since we are talking about light segueing into an episode of The Light to the node, I also want to talk about the canvas items, light mask of property.
So in a sense, the easiest way to think about a light mask is what layers will my game object be by default? You are set to layer one on top of that.
The light 2D node by default only affects layer one. So you can see that the light to the node and the Kandace item based on their default values will affect and be affected by light. Now, in this case, you may not want to be affected by light and so you would change the layering through the light mask property.
And so if you wanted to, you could say, I don't want to get affected by light in layer one. Or rather, maybe layer six.
And so if a late tuti note is in layer one, but your game object is in layer six, your object will not get affected by late and any other layer except lights that have chosen the option of layer six through the late coma's, which we will take a look at a later episode and come back to this in a little more detail through examples.
Well, that's all I have for you in this episode.
Thank you so much for joining me.
Thank you for subscribing and thank you for clicking the like button.
If you have any questions or comments, please feel free to leave them in the comments section down below. And I look forward to seeing you in the next episode.
Have an amazing day.