Jacob Hicks (akutalata)

1 reply · posted

Two sided triangles

I am trying to port Python code for Blender that creates a particular solid to generate the same solid in C# for use in Unity.  Getting the right normal vectors  to view it properly is driving me crazy.  In addition, I would also like to be able to view my solid from the outside or inside.  Is there a convenient way to make a triangle show up when viewed from both front and back?   Is it different in the game and scene view?  Is the only way to make two triangles on top of each other with opposite normals?

Thanks for any help.  (I know that code attached doesn't generate a tetrahedron, but that is the file I was modifying to get the mesh generation syntax correct)

  • crew

    Yes you can make a mesh double sided, but you'd have to utilize a custom shader for this. If you're using the latest version of Unity you can use one of the new rendering pipelines when you first create a project. Change it from "3d"  to "Lightweight RP" for the template section. 

    Within there the default Lightweight shader has support for double sided rendering. 

    Note this is using the LightWeightPipeline/Standard(Physically Based) shader for the material. Enable double sided and you can render both sides of a mesh.

    If that seems a bit complicated for something so simple then you could also use this: https://assetstore.unity.com/packages/vfx/shaders/double-sided-shaders-23087 it's the same concept except this can be used without any of the rendering pipeline templates.