KatsBits Community

Game Editing => General Content Creation => Topic started by: kat on July 10, 2015, 02:21:48 AM

Title: [Unity] two-sided meshes
Post by: kat on July 10, 2015, 02:21:48 AM
Unity renders only the outside of a mesh

Unity, like most game engines, renders meshes single-sided by default because it's the cheapest way to display an object. Technically meshes are always single-sided unless the engine is instructed to duplicate and mirror surfaces. Drawing mesh data this way is often global; it's either 'on' of 'off' for everything so not easily controllable per-model, and it uses significant resources to perform (load mesh » read mesh » duplicate structure » flip structure » render to screen). Because some models do need to be double-sided its more effective to disable two-sided rendering in favour of using more individualistic approaches. This can be done in by;
When to use which option
Option "2" works best with simple models or selections/assignments made from reduced numbers of faces, so creating a basic planar windowpane would simply mean duplicating and inverting faces per two-sided requirements. More complex or numerous objects may benefit from option "1"; grass sprites for instance where there is a need to render a lot of double-sided surfaces. Care has to be taken to not waste too much in the way of CPU, GPU or memory resources associated with 'overdraw' and 'fill rates', in addition to lighting issues - both sides are illuminated the same way so the reverse side may appear lit when it should be shaded (more complex shaders are required to solve this).