Special note: FAQs
This lecture will answer some questions one after another.
Q:(1) What is transform_tex?(2) The _ maintex_st variable in float4 _ maintex_st is also useless. Why do I have to declare it?
A:(1) In simple terms, transform_tex is mainly used to calculate the vertex UV and tiling and offset of the material ball to ensure that the scaling and offset settings in the material ball are correct. (V. texcoord is the UV of the vertex)
The following two functions are equivalent.
O. UV =Transform_tex (V. texcoord, _ maintex );
O. UV = v.Texcoord. XY * _ maintex_st.xy + _ maintex_st.zw;
(2) The st of _ maintex_st should be samplertexture, that is, it declares that _ maintex is a sampling graph, that is, it performs UV operations.Without this sentence, you cannot perform the transform_tex operation. _ Maintex_st.xy is tiling, and ZW is offset.
If tiling and offset are the default values, that is, when tiling is () offset is (), O. UV = transform_tex (V. texcoord, _ maintex ); Change to O. UV = v. texcoord. XY; can also be displayed normally; equivalent to tiling is () offset is (), but such as the tiling value and offset value does not work