Unity3d Tutorial Shader: Special FAQ

Source: Internet
Author: User

reprinted from the Wind Yu Chong Unity3d Tutorial College

We will add some answers to these questions in succession.

Q:(1) What does Transform_tex do? (2) float4 _maintex_st in the _maintex_st variable is not used, why do you want to declare it?  Answer:(1) In simple terms, the main role of Transform_tex is to take the vertex UV and material ball tiling and offset for the operation, to ensure that the material ball in the scaling and offset settings are correct. (V.texcoord is the vertex UV)

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) and _maintex_st St is supposed to be samplertexture meaning, that is, the declaration _maintex is a sampling map, that is, the UV operation. If there is no such sentence, it is not possible to perform transform_tex operations. _maintex_st.xy is the offset in the TILING,ZW. if tiling and offset you leave the default value, that is, tiling () offset to (0,0), you can notO.uv = Transform_tex (V.texcoord,_maintex);change to O.uv = V.texcoord.xy, which can be displayed normally, equivalent to tiling to (0,0) offset, but the tiling value and the value of offset are not working.

Unity3d Tutorial Shader: Special FAQ

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.