# Flip Normals, Unity, Lightwave, spheres

I want to flip the normals on a texture in unity. I have a model and a texture and wish for the texture to be inside the sphere model and not on the outside. I want to create a 360 panoramic effect by moving the camera around the images inside the sphere on top of the flipped texture. Can anyone help with this, I have searched how to flip normals etc and cannot find what I need.

Thanks for any help!

Judith.

Flipping normals won’t draw on the inside of the sphere. You need to flip the triangle winding of the mesh instead.

``````//get a reference to the mesh
var mesh : Mesh = GetComponent(MeshFilter).mesh;
//reverse triangle winding
var triangles:int[]=mesh.triangles;
var numpolies : int =triangles.Length / 3;

for(var t=0;t<numpolies;t++)
{
var tribuffer : int = triangles[t*3];
triangles[t*3]=triangles[(t*3)+2];
triangles[(t*3)+2]=tribuffer;
}

mesh.triangles=triangles;
``````

Thanks BPPHarv, I condensed that to the following if it helps:

using System.Linq;

using UnityEngine;

public class FlipNormals : MonoBehaviour

{

``````void Start()
{
var mesh = (transform.GetComponent("MeshFilter") as MeshFilter).mesh;
mesh.uv = mesh.uv.Select(o => new Vector2(1 - o.x, o.y)).ToArray();
mesh.triangles = mesh.triangles.Reverse().ToArray();
mesh.normals = mesh.normals.Select(o => -o).ToArray();
}
``````

}

I’m new to this whole thing, and I just had a hunch I needed to change the normals, I need to get the texture on the inside of the sphere and from there move my camera around it creating a panoramic effect.

Essentially, can I just use this code posted and add it to the object?..Will there be much difference for c# scripting?

Thank you very much this is exactly what I needed!

Thanks again!!