text: 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.
  Did you manage to flip the normals in Lightwave but that is not coming across when you import to Unity? Or are you asking how to flip the normals in Lightwave?
  Answer by BPPHarv
  ·
  Oct 09, 2012 at 06:22 PM
  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;
  Yes, you're absolutely right. The confusion comes from the fact that most modelling tools (blender, 3ds max, ...) call the winding order "face normal". They show which side a face is looking by drawing a normal vector at the trianges (or quads) center.
  The face normal(winding order) has nothing to do with the vertex normals which are used in the shader to shade the object.
  I am completely new to this sort of thing, I had a hunch I had to change the normals of the texture as they where on the outside of the sphere ins$$anonymous$$d of inside. I need to have it on inside then get the camera to rotate round creating a panoramic effect.
  Essentially, if I apply the code above to the object this will flip the triangles or reverse them?
  Is the scripting much different in c#?
  Answer by judith
  ·
  Oct 10, 2012 at 11:53 AM
  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?
  For my own personal interest I banged out this little script. It takes a unity sphere and "turns it inside out" to create an inner projective surface. It's far from perfect but it might get you started. To use it apply it on a sphere sized (by scale) to fit your scene. The panoskyies I use from will fit the upper portion when the texture uses a 1x 2y tile material setting.
  What you would ideally do is search for skydome implementations for Unity3d, there are a few out there both free and pay which will have a much more complete solution for you.
  QuickieSkyDome.cs
  using UnityEngine; using System.Collections;
  public class QuickieSkyDome : MonoBehaviour
  {
  // Use this for initialization
  //This will modify a unity prefab sphere "inside out" for inner surface project
  void Start ()
  {
  //get a reference to the mesh
  MeshFilter BaseMeshjustjust normals for inner sphere projection
  Vector3[] norms = mesh.normals;
  for(int normalsnum = 0;normalsnum < norms.Length;normalsnum++)
  {
  norms[normalsnum]=-norms[normalsnum];
  }
  //copy local built in arrays back to the mesh
  mesh.uv = uvs;
  mesh.triangles=triangles;
  mesh.normals=norms;
  }
  }
  Answer by xavier steele
  ·
  Nov 17, 2013 at 03:14 PM
  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();
  }
  }
  Answer by judith
  ·
  Oct 11, 2012 at 09:01 AM
  Thank you very much this is exactly what I needed!
  How to make camera collision with my custom camera?
  2
  Answers
  make android camera video as the background of the unity scene?
  0
  Answers
  Camera Animation
  1
  Answer
  Move Camera towards Object
  1
  Answer