Material not rendering correctly on Submesh
So I'm having an issue correctly rendering this image on the submesh. I've tried using different shaders but nothing is correctly working. I'm wondering if it has something with how the material is being applied to the submesh. Bottom line, I need to find a way where the full photo is correctly displayed on each side of the object. Any help would be greatly appreciated, thank you!
The code I'm using to generate this object is as follows:
public class ChangeSubmesh : MonoBehaviour
{
private Mesh _lowerMesh;
private Mesh _topMesh;
public Material[] topMaterialArray;
public Material[] bottomMaterialArray;
private Material[] _topMeshRender;
private Material[] _lowerMeshRender;
private void Awake()
{
_lowerMesh = transform.GetChild(0).GetComponent<MeshFilter>().mesh;
_topMesh = transform.GetChild(1).GetComponent<MeshFilter>().mesh;
_lowerMeshRender = transform.GetChild(0).GetComponent<MeshRenderer>().materials = bottomMaterialArray;
_topMeshRender = transform.GetChild(1).GetComponent<MeshRenderer>().materials = topMaterialArray;
_lowerMesh.subMeshCount = 3;
_topMesh.subMeshCount = 3;
}
void Start()
{
_lowerMesh.SetTriangles(new int[] {4, 1, 0}, 0);
_lowerMesh.SetTriangles(new int[] {4, 3, 2}, 1);
_lowerMesh.SetTriangles(new int[] {4, 2, 1}, 2);
_topMesh.SetTriangles(new int[] {1,4,2}, 0);
_topMesh.SetTriangles(new int[] {3,4,1}, 1);
_topMesh.SetTriangles(new int[] {2,4,3}, 2);
}
}
![alt text][1] [1]: /storage/temp/177039-bottom-image-1.jpg
diamond-object.jpg
(17.7 kB)
bottom-image-1.jpg
(45.7 kB)
Comment