- Home /
Question by
AlexTemina · Dec 26, 2015 at 11:19 AM ·
shadertexturescalemapsurface shader
apply a map to a surface shader using its original size and tiling
Hi, I'm trying to get a texture that is used as a map in a surface shader. I want the texture to use its original size, and tile when necesarry, but I'm not able to. The texture always upscales to have the size of the object. What should I do? This is the code of the shader:
sampler2D _MainTex;
sampler2D _NoiseTex;
struct Input
{
float2 uv_MainTex : TEXCOORD0;
float2 uv2_NoiseTex : TEXCOORD1;
fixed4 color;
float4 screenPos;
float3 worldPos;
};
void vert(inout appdata_full v, out Input o)
{
#if defined( PIXELSNAP_ON )
v.vertex = UnityPixelSnap(v_.vertex);
#endif
UNITY_INITIALIZE_OUTPUT(Input, o);
o.color = v.color * _Color;
o.worldPos = mul(_Object2World, v.vertex);
}
....
fixed3 glitt(SurfaceOutput o, Input i)
{
float scale = 0.1f;
fixed4 tex2d = tex2D(_ColdTex, i.uv_MainTex);
float4 noisetex2d = tex2D(_NoiseTex, i.uv2_NoiseTex);
There, noisetex2d will appear in the scene upscaling the texture to the object, which is bigger than the texture.
Thanks for the help.
Comment
Your answer
Follow this Question
Related Questions
Assigning UV Map to model at runtime 0 Answers
Rendering oval map texture with Graphics.DrawTexture() 1 Answer
Non scale texture? 1 Answer
Shader Texture Change 3 Answers
How to use a displacement map to create a ripple effect on a texture? 0 Answers