So I’ve made a Skybox shader that creates nebula with perlin noise. I have a star field texture that I want to tile across the background.
So far however, the texture is stretching across a single axis, as shown.
Here’s the relevant part of code:
Pass {
ZWrite Off
Cull Off
CGPROGRAM
#pragma exclude_renderers d3d11 xbox360
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
float4 _StarColor;
sampler2D _StarTex;
struct v2f{
float4 position : POSITION;
float2 uv : TEXCOORD0;
};
float4 _StarTex_ST;
v2f vert(appdata_base IN) {
v2f OUT;
OUT.position = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.uv = TRANSFORM_TEX(IN.texcoord, _StarTex);
return OUT;
}
half4 frag (v2f i) : COLOR{
half4 texcol = tex2D (_StarTex, i.uv);
return texcol * _StarColor;
}
ENDCG
}