- Home /
Other
Texture stretching on one axis. Skybox Shader help.
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
}
Answer by DarkPixel · Oct 05, 2013 at 01:55 PM
Set WrapMode to Repeat instead of Clamp to your texture?
I already suggested that, and deleted it when I found it was already set to Repeat. Although, with that code and that output, it does seem like that's the issue. Jazzer008, have you tried manually refreshing the cubemap textures? Sometimes they can be a bit dodgy.
Follow this Question
Related Questions
Custom skybox Shader uv issue, skybox texture stretching along one axis. 0 Answers
Stretching Texture2D 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
how to solve shader/texture problem: putting white icons on colored planes 1 Answer