public static Mesh uvMapWithTilling(Mesh mesh,splatMapShaderInput input) { Vector2[] uvG = new Vector2[mesh.uv.Length]; Vector2[] uvB = new Vector2[mesh.uv.Length]; Vector2[] uvA = new Vector2[mesh.uv.Length]; for(int i=0; i < mesh.uv.Length; i++) { //mesh.uv1[i] = new Vector2(mesh.uv[i].x * input.tillingR.x,mesh.uv[i].y * input.tillingR.y); uvG[i] = new Vector2(mesh.uv[i].x * input.tillingG.x,mesh.uv[i].y * input.tillingG.y); uvB[i] = new Vector2(mesh.uv[i].x * input.tillingB.x,mesh.uv[i].y * input.tillingB.y); uvA[i] = new Vector2(mesh.uv[i].x * input.tillingA.x,mesh.uv[i].y * input.tillingA.y); } mesh.uv2 = uvA; mesh.uv3 = uvB; mesh.uv4 = uvG; return mesh; }
public static void sendSplatToMaterial(splatMapShaderInput input,Material myMaterial) { myMaterial.SetTexture("_Control",input.weights); myMaterial.SetTexture("_Splat3",input.textureA); myMaterial.SetTexture("_Splat2",input.textureB); myMaterial.SetTexture("_Splat1",input.textureG); myMaterial.SetTexture("_Splat0",input.textureR); myMaterial.SetTexture("_Normal3",input.normalA); myMaterial.SetTexture("_Normal2",input.normalB); myMaterial.SetTexture("_Normal1",input.normalG); myMaterial.SetTexture("_Normal0",input.normalR); }