# Applying texture inside of an Icosphere?

I have implemented a code to generate an Icosphere procedurally in Unity 5.3.4f, which works pretty well. However, what I need to do know it tweak the code to make the sphere to receive texture only in its inside triangle-faces, not outside. Searching trough the Unity forums, many have said that it's simply the case of flipping the normals of all triangles (i.e. multiplying them by -1). I tried it and it is not the case.

What is the correct way of changing the triangles (not trough shaders) so the Icosphere mesh can only be textured inside (e.g. in a skydome)?

EDIT: After Kromster's answer, I did some research and ended up implementing the following code:

Mesh InvertMeshFaces(Mesh _mesh)
{

//Flip the triangles
int[] triangles = _mesh.triangles;

int numtriangles = triangles.Length / 3;
for (int t = 0; t < numtriangles; t++)
{
int temptriangle = triangles[t * 3];
triangles[t * 3] = triangles[(t * 3) + 2];
triangles[(t * 3) + 2] = temptriangle;
}

//reseting the UV
Vector2[] uvs = _mesh.uv;
for (int uvnum = 0; uvnum < uvs.Length; uvnum++)
{
uvs[uvnum] = new Vector2(1 - uvs[uvnum].x, uvs[uvnum].y);
}

//reseting normals
Vector3[] normals = _mesh.normals;
for (int normalsnum = 0; normalsnum < norms.Length; normalsnum++)
{
norms[normalsnum] = -norms[normalsnum];
}

//setting the new values of triangles, normals and UVs
_mesh.triangles = triangles;
_mesh.uv = uvs;
_mesh.normals = normals ;

return _mesh;
}


So far, it works only partially. Applying that function to my Icosphere mesh, now it is possible to see the sphere rendered when camera is inside it. However, oddly enough, it's still also possible to see the sphere from outside. It means, both inside and outside are visible - the outside is not culled as expected.

• Is the sphere invisible from the inside, or is it visible and just not textured? – Icy Defiance May 26 '16 at 4:23
• @IcyDefiance It is currently invisible and being textured outside. I want to change both: make it only visible from the inside and only texturable from the inside. – AndraSol May 26 '16 at 5:54