- Home /
Custom skybox Shader uv issue, skybox texture stretching along one axis.
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
}
Comment
Your answer
Follow this Question
Related Questions
Texture stretching on one axis. Skybox Shader help. 1 Answer
Assigning UV Map to model at runtime 0 Answers
How to scale and offset UV coordinates from the center of the texture? 1 Answer
What's the syntax for creating a skybox with a script? 2 Answers
How can I tile a texture on a Skybox? 2 Answers