Question by
Crayz · Aug 25, 2015 at 01:38 AM ·
shadershadersinterpolation
Help with Splat map shader, control/splat texture interpolation has dark edges
I'm trying to create a Shader to paint terrain on a procedural generated mesh. I'm not too experienced in CG but I've managed to get something working, I think it would be considered splat or AddPass though not sure. The interpolation from the primary texture to another texture doesn't look correct, check this screenshot to see what I mean: http://puu.sh/jNtyZ/b438329641.jpg
Dirt is my main texture, tile and grass are splats. The interpolation from the main texture to any splat has a dark edge around it though interpolating from splat to splat is clear. Any idea why this might be happening?
Here's my fragment function:
half4 frag(fragmentInput i) : COLOR
{
float4 main = tex2D(_MainTex, i.uv);
float4 splat = float4(i.color.r * tex2D(_Splat0, i.uv).rgb, i.color.r);
splat += float4(i.color.g * tex2D(_Splat1, i.uv).rgb, i.color.g);
splat += float4(i.color.b * tex2D(_Splat2, i.uv).rgb, i.color.b);
float4 _out = lerp(main, splat, splat.a);
return _out;
}
To change textures on the mesh I simply change the rgb value of a vertex
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612001319im_/https://answers.unity.com/themes/thub/images/avi.jpg)