Body Texture: What is it? Tex2d previously can only sample the UV coordinate system in the fragment program: In fact, the point is the lower left corner, the range is "0,1", U is the x axis, V is the Y axis
texture.wrapmode Cycle mode: texturewrapmode.clamp: Set texture full stretch use texturewrapmode.repeat:Texture Repeat tile useIf you use Repeat, then the u>=1 is equal to the picture on the right side of the map
texture.filtermode Filter Mode:Point : Pixel filtering (Do not filter )Bilinear: bilineartrilinear: three- wire
UV Texture Sampling:UV Texture
Post-Map effect: The UV coordinates of the stereo space are the upper left corner, U is the horizontal right direction, V is the vertical downward direction, the default range [0,1]
Source:
Shader "Sbin/texshader" {Properties{_maintex ("Texture", 2D) = "White" {}_u ("U", Range ( -0001,0.001)) = 0_v ("V", Range (0,1 ) = 0}subshader{pass{cgprogram#pragma Vertex vert#pragma fragment Frag#include "Unitycg.cginc" sampler2d _MainTex; float _u;float _v;struct v2f{float4 pos:position;float2 uv:texcoord0;}; v2f Vert (Appdata_base v) {v2f O;o.pos = Mul (UNITY_MATRIX_MVP, V.vertex); o.uv = V.texcoord.xy;return o;} Fixed4 Frag (v2f v): color{fixed4 col = tex2d (_maintex, V.UV);//First parameter: texture, second parameter UV vector return col;} ENDCG}}}
texture tiling scale and offset:
Tiling: Scaling the model UV texture sampling coordinates, for example: Tiling x=2, the model UV coordinates of the u to expand twice times, the U range value into 2, if the WrapMode select Repeat, then the U-axis direction will be texture sampling two times. V-Axis similarly
Offset: Offsets the model UV texture sample coordinates; For example: offset x = 0.1, which means to compile the model UV coordinates to the left and then sample the UV texture map.
Both of these actions result in the following effects:
Introduction to CG 21:fragment shader-2d texture Sampling