# Need help getting rid of a seam in a procedural shader

Hello, I am not that proficient in shaders and have been trying to modify a shader to work for my needs. I am 99% of the way there by there is an annoying issue. There seems to be a seam caused by the random function (i think ) on the line “rand(floor(uv))”. Can anyone help help fix this issue so it is seamless?

Thanks, Charlie

v2f vert(appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o, o.vertex);
return o;
}
float rand(float2 coord) {
coord = mod(coord, float2(1.0,1.0)*round(_Size));
return frac(sin(dot(coord.xy ,float2(12.9898,78.233))) * 15.5453 * _Seed);
}
float noise(float2 coord) {
float2 i = floor(coord);
float2 f = frac(coord);
float a = rand(i);
float b = rand(i + float2(1.0, 0.0));
float c = rand(i + float2(0.0, 1.0));
float d = rand(i + float2(1.0, 1.0));
float2 cubic = f * f * (3.0 - 2.0 * f);
return lerp(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y;
}
float fbm(float2 coord) {
float value = 0.0;
float scale = 0.5;
for (int i = 0; i < _OCTAVES; i++) {
value += noise(coord) * scale;
coord *= 2.0;
scale *= 0.5;
}
return value;
}
float circleNoise(float2 uv) {
float uv_y = floor(uv.y);
uv.x += uv_y * 0.3;
float2 f = frac(uv);
float h = rand(floor(uv));
float m = length(f - 0.25 - (h * 0.5));
float r = h * 0.25;
return smoothstep(0.0, r, m * 0.75);
}
float cloud_alpha(float2 uv) {
float c_noise = 0.0;

// more iterations for more turbulence
for (int i = 0; i < 8; i++) {
c_noise += circleNoise((uv * _Size * 0.3) + (float(i + 1) + 10.) + (float2(time * _Time_speed, 0.0)));
}
float fbmval = fbm(uv * _Size + c_noise + float2(time * _Time_speed, 0.0));

return fbmval;
}
float2 spherify(float2 uv) {
float2 centered = uv * 2.0 - 1.0;
float z = sqrt(1.0 - dot(centered.xy, centered.xy));
float2 sphere = centered / (z + 1.0);
return sphere * 0.5 + 0.5;
}
fixed4 frag(v2f i) : COLOR {
float2 uv = frac(i.uv);
//uv = spherify(uv);
float c = cloud_alpha(uv);
float3 col = _Base_color.rgb;
if (c < _Cloud_cover + 0.03) {
col = _Outline_color.rgb;
}
return fixed4(col, step(_Cloud_cover, c));
}

The problem is you’re trying to map 2D noise onto three dimensions.
You’ll want to use 3D noise functions to map the noise to the actual vertex positions, not the UVs. That way the noise can be inherently seamless.

Thanks Invertex. Not sure how to do that. Ill have a google around