c# - How do I texture both sides of a mesh in Unity3D? -


at moment i'm creating mesh , texturing it. works 1 side, other transparent.

        m.name = "topwallmesh";         m.vertices = new vector3[] {             new vector3(-width, 0f, -height),             new vector3(width, 0f, -height),             new vector3(-width, 0.1f, -height),             new vector3(width, 0.1f, -height)         };         m.uv = new vector2[] {             new vector2 (0, 0),             new vector2 (0, 1),             new vector2 (1, 0),             new vector2 (1, 1)         };         m.triangles = new int[] { 0, 1, 2, 1, 3, 2 };         m.recalculatenormals(); 

how go fixing it's textured on both sides?

set cull off shader render backface culled. here have example of doubleside standard shader:

shader "doublesided" { properties {      _color ("main color", color) = (1,1,1,1)      _maintex ("base (rgb)", 2d) = "white" {}      //_bumpmap ("bump (rgb) illumin (a)", 2d) = "bump" {}  }  subshader {           //usepass "self-illumin/vertexlit/base"      //usepass "bumped diffuse/ppl"      // ambient pass     pass {      name "base"      tags {"lightmode" = "always" /* upgrade note: changed pixelornone */}      color [_pplambient]      settexture [_bumpmap] {          constantcolor (.5,.5,.5)          combine constant lerp (texture) previous          }      settexture [_maintex] {          constantcolor [_color]          combine texture * previous double, texture*constant          }      }  // vertex lights  pass {      name "base"      tags {"lightmode" = "vertex"}      material {          diffuse [_color]          emission [_pplambient]          shininess [_shininess]          specular [_speccolor]          }      separatespecular on      lighting on      cull off      settexture [_bumpmap] {          constantcolor (.5,.5,.5)          combine constant lerp (texture) previous         }     settexture [_maintex] {           combine texture * previous double, texture*primary          }      }  }   fallback "diffuse", 1 } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -