Search Unity

Backface culling in Unity

Discussion in 'Editor & General Support' started by Marowe, May 13, 2010.

Thread Status:
Not open for further replies.
  1. Marowe

    Marowe

    Joined:
    May 13, 2010
    Posts:
    5
    I've been trying to figure out how to get backface culling to turn off in Unity, since I don't want to waste the polys by making everything have two sides.

    I've read in a few places that I need to type something like CullOff in the Pass of the shader...I'm not sure where to type this in to turn it off, and I'm not much of a coder so I don't know where to look.

    Any help would be greatly appreciated! Thanks!
     
    jabo12 likes this.
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    By default, backface culling is on, which means everything has one side (the back face is culled). You don't want to use Cull Off, except for those cases where you do want to render both sides.

    --Eric
     
    KKTFT likes this.
  3. Marowe

    Marowe

    Joined:
    May 13, 2010
    Posts:
    5
    Yeah, that's exactly what I want. :(
     
    BrainSlugs83 and chunyiugary like this.
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Oh, I misunderstood your question. You can look in the shader source for the particle shaders, for example, because they all have backface culling turned off. Basically it's just putting "Cull Off" in the "SubShader" section.

    --Eric
     
    FlyingSquirrels likes this.
  5. Marowe

    Marowe

    Joined:
    May 13, 2010
    Posts:
    5
    Thanks for the help, Eric. Unfortunately I'm still not sure exactly what to do though, mostly because I don't know how to access the "SubShader" section, and I only started using Unity yesterday so I'm not sure where to look. I opened the material up in a script editor and didn't see any culling flags (though I know almost nothing about scripting so I may have overlooked something) and I'm not sure if this is a glitch, but if I select "Edit Shader..." in Unity, nothing pops up :(

    I spent a while looking, because I don't want to be like one of those lazy noobs that expects answers to fall in their lap, but I'm really at a loss of what to do...I understand what you suggested, I'm just not sure where to find any of that stuff. Sorry >__<
     
  6. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    If you want your objects to be properly lit, I highly recommend avoiding the Cull Off approach. Basically, Cull Off will get you two-sided geometry with one side lit incorrectly. The work-around is to make complex modifications to existing shaders and take a performance hit due to the extra draw calls.

    Unless you are seriously limited by mesh data size, the easiest and best-performing way to render backfaces is to double your mesh and flip the normals on the duplicate.
     
    VivaanMalik, mandisaw and artician like this.
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can only edit your own custom shaders. However, you can download the source for all the built-in shaders (look at the sticky in the Shaderlab forum). I agree that, generally speaking, duplicating geometry is the best way. It's still good to know how to do the cull off thing for special cases though.

    --Eric
     
  8. Marowe

    Marowe

    Joined:
    May 13, 2010
    Posts:
    5
    Ah, I didn't realize there was such a drawback to turning off the culling. I guess I'll try it and see how it looks, but it probably won't be pretty by the sound of it. Thank you for the help guys, I REALLY appreciate it!
     
  9. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    Reading my post, I don't think I made it clear that turning culling off is appropriate and faster when you don't want to do any lighting. As such, it can be useful for special effects or non-photorealistic rendering.
     
  10. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    I totally agree with this post: if you need to have a biface mesh the best way is to duplicate it and flip normals.
    This is the right way for so many reasons...

    Otherwise you have to code your shader but will not perform so fast.

    The only drawback, as they told you, is that you will use twice the memory for the mesh... but usually this is not a problem.
     
    josiahlonge94 likes this.
  11. Marowe

    Marowe

    Joined:
    May 13, 2010
    Posts:
    5
    Thanks for all the tips guys. It's definitely a lot more apparent that Cull Off won't solve the problem.

    I really appreciate all the help! Thank you :D
     
  12. Legion555

    Legion555

    Joined:
    Mar 22, 2014
    Posts:
    4
    4 years later,
    At this moment with unity 4.X back facing culling off works very good for clothes and hair shaders. just depends on your needs, but if you create a shader and then set the culling off in the subshader section everything works very fine, (at least for me)
     
  13. Noah492

    Noah492

    Joined:
    Jul 2, 2014
    Posts:
    44
    Hi Daniel, how exactly do I do the alternative. Ctrl+D to duplicate right? And then how do I flip the normals on the duplicate?
     
    nadeeramy likes this.
  14. Bernardo_Olafson

    Bernardo_Olafson

    Joined:
    Feb 11, 2015
    Posts:
    5
    You would have to do it in your 3D Editor of choice. As far as I know you cannot edit Meshes in Unity, at least not through the editor.
     
  15. nadeeramy

    nadeeramy

    Joined:
    Aug 13, 2015
    Posts:
    2
    so how exactly?
     
  16. nadeeramy

    nadeeramy

    Joined:
    Aug 13, 2015
    Posts:
    2
    hi all I just installed n tried using Unity yesterday...
     
  17. guywald

    guywald

    Joined:
    Aug 22, 2013
    Posts:
    13
    Thanks! You saved me a lot of time. I had the same problem of a "side not appearing".
    Flipping the normals solved this.

    A method showing how to do this can be found at:
    http://wiki.unity3d.com/index.php/ReverseNormals

    Thanks.
     
  18. Anki13

    Anki13

    Joined:
    Oct 26, 2017
    Posts:
    1
    I read all the comments and answer for this particular question and i agree to most of it. What if someone is doing vertex paint and want its plane to be double sided then how can we do that?? How can we make a plane double side to do vertex painting in Unity???!!!
     
  19. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    I am so sick of saying this, but please DO NOT bring back to life threads that are 2 years old.
     
  20. Honorsoft

    Honorsoft

    Joined:
    Oct 31, 2016
    Posts:
    81
    I found this thread trying to find out how to turn off culling in a shader in Unity 2018.x. I'm getting 'shader compile errors' when I try the 'Unity 5' method. Anyways, someone online recommended duplicating all the faces and fliping them over as a solution, but doubling the model size isn't wise. I will keep looking for a 2018 (or now 2019) shader that has back-face culling turned off, but if anyone needed the culling turned off for Unity 5 then I'll post the basic Standard Shader (Unity 5 version) with culling turned off. You can make the same change to any shader, just put the Cull Off in the sub-shader section. (Note: Standard Shaders might vary from version to version, this shader seems to work with Unity 5, but not with Unity 2018.

    (Save as "StandardCullOFF.shader"):

    Code (CSharp):
    1. Shader "StandardCullOFF"
    2. {
    3.     Properties
    4.     {
    5.         _Color("Color", Color) = (1,1,1,1)
    6.         _MainTex("Albedo", 2D) = "white" {}
    7.    
    8.         _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
    9.  
    10.         _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
    11.         _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
    12.         [Enum(Metallic Alpha,0,Albedo Alpha,1)] _SmoothnessTextureChannel ("Smoothness texture channel", Float) = 0
    13.  
    14.         [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
    15.         _MetallicGlossMap("Metallic", 2D) = "white" {}
    16.  
    17.         [ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
    18.         [ToggleOff] _GlossyReflections("Glossy Reflections", Float) = 1.0
    19.  
    20.         _BumpScale("Scale", Float) = 1.0
    21.         _BumpMap("Normal Map", 2D) = "bump" {}
    22.  
    23.         _Parallax ("Height Scale", Range (0.005, 0.08)) = 0.02
    24.         _ParallaxMap ("Height Map", 2D) = "black" {}
    25.  
    26.         _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
    27.         _OcclusionMap("Occlusion", 2D) = "white" {}
    28.  
    29.         _EmissionColor("Color", Color) = (0,0,0)
    30.         _EmissionMap("Emission", 2D) = "white" {}
    31.    
    32.         _DetailMask("Detail Mask", 2D) = "white" {}
    33.  
    34.         _DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {}
    35.         _DetailNormalMapScale("Scale", Float) = 1.0
    36.         _DetailNormalMap("Normal Map", 2D) = "bump" {}
    37.  
    38.         [Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0
    39.  
    40.  
    41.         // Blending state
    42.          _Mode ("__mode", Float) = 0.0
    43.          _SrcBlend ("__src", Float) = 1.0
    44.          _DstBlend ("__dst", Float) = 0.0
    45.          _ZWrite ("__zw", Float) = 1.0
    46.     }
    47.  
    48.     CGINCLUDE
    49.         #define UNITY_SETUP_BRDF_INPUT MetallicSetup
    50.     ENDCG
    51.  
    52.     SubShader
    53.     {
    54.         Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
    55.         LOD 300
    56.  
    57.         // ------------------------------------------------------------------
    58.         //  Base forward pass (directional light, emission, lightmaps, ...)
    59.         Pass
    60.         {
    61.        
    62.             Name "FORWARD"
    63.             Tags { "LightMode" = "ForwardBase" }
    64.  
    65.             Blend [_SrcBlend] [_DstBlend]
    66.             ZWrite [_ZWrite]
    67.             Cull Off //  HERE IS WHERE YOU PUT CULL OFF
    68.  
    69.             CGPROGRAM
    70.             #pragma target 3.0
    71.  
    72.             // -------------------------------------
    73.  
    74.             #pragma shader_feature _NORMALMAP
    75.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
    76.             #pragma shader_feature _EMISSION
    77.             #pragma shader_feature _METALLICGLOSSMAP
    78.             #pragma shader_feature ___ _DETAIL_MULX2
    79.             #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
    80.             #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
    81.             #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF
    82.             #pragma shader_feature _PARALLAXMAP
    83.  
    84.             #pragma multi_compile_fwdbase
    85.             #pragma multi_compile_fog
    86.  
    87.             #pragma vertex vertBase
    88.             #pragma fragment fragBase
    89.             #include "UnityStandardCoreForward.cginc"
    90.  
    91.             ENDCG
    92.         }
    93.         // ------------------------------------------------------------------
    94.         //  Additive forward pass (one light per pass)
    95.         Pass
    96.         {
    97.             Name "FORWARD_DELTA"
    98.             Tags { "LightMode" = "ForwardAdd" }
    99.             Blend [_SrcBlend] One
    100.             Fog { Color (0,0,0,0) } // in additive pass fog should be black
    101.             ZWrite Off
    102.             ZTest LEqual
    103.  
    104.             CGPROGRAM
    105.             #pragma target 3.0
    106.  
    107.             // -------------------------------------
    108.  
    109.  
    110.             #pragma shader_feature _NORMALMAP
    111.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
    112.             #pragma shader_feature _METALLICGLOSSMAP
    113.             #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
    114.             #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
    115.             #pragma shader_feature ___ _DETAIL_MULX2
    116.             #pragma shader_feature _PARALLAXMAP
    117.  
    118.             #pragma multi_compile_fwdadd_fullshadows
    119.             #pragma multi_compile_fog
    120.  
    121.  
    122.             #pragma vertex vertAdd
    123.             #pragma fragment fragAdd
    124.             #include "UnityStandardCoreForward.cginc"
    125.  
    126.             ENDCG
    127.         }
    128.         // ------------------------------------------------------------------
    129.         //  Shadow rendering pass
    130.         Pass {
    131.             Name "ShadowCaster"
    132.             Tags { "LightMode" = "ShadowCaster" }
    133.  
    134.             ZWrite On ZTest LEqual
    135.  
    136.             CGPROGRAM
    137.             #pragma target 3.0
    138.  
    139.             // -------------------------------------
    140.  
    141.  
    142.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
    143.             #pragma shader_feature _METALLICGLOSSMAP
    144.             #pragma shader_feature _PARALLAXMAP
    145.             #pragma multi_compile_shadowcaster
    146.  
    147.             #pragma vertex vertShadowCaster
    148.             #pragma fragment fragShadowCaster
    149.  
    150.             #include "UnityStandardShadow.cginc"
    151.  
    152.             ENDCG
    153.         }
    154.         // ------------------------------------------------------------------
    155.         //  Deferred pass
    156.         Pass
    157.         {
    158.             Name "DEFERRED"
    159.             Tags { "LightMode" = "Deferred" }
    160.  
    161.             CGPROGRAM
    162.             #pragma target 3.0
    163.             #pragma exclude_renderers nomrt
    164.  
    165.  
    166.             // -------------------------------------
    167.  
    168.             #pragma shader_feature _NORMALMAP
    169.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
    170.             #pragma shader_feature _EMISSION
    171.             #pragma shader_feature _METALLICGLOSSMAP
    172.             #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
    173.             #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
    174.             #pragma shader_feature ___ _DETAIL_MULX2
    175.             #pragma shader_feature _PARALLAXMAP
    176.  
    177.             #pragma multi_compile ___ UNITY_HDR_ON
    178.             #pragma multi_compile ___ LIGHTMAP_ON
    179.             #pragma multi_compile ___ DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE
    180.             #pragma multi_compile ___ DYNAMICLIGHTMAP_ON
    181.  
    182.             #pragma vertex vertDeferred
    183.             #pragma fragment fragDeferred
    184.  
    185.             #include "UnityStandardCore.cginc"
    186.  
    187.             ENDCG
    188.         }
    189.  
    190.         // ------------------------------------------------------------------
    191.         // Extracts information for lightmapping, GI (emission, albedo, ...)
    192.         // This pass it not used during regular rendering.
    193.         Pass
    194.         {
    195.             Name "META"
    196.             Tags { "LightMode"="Meta" }
    197.  
    198.             Cull Off
    199.  
    200.             CGPROGRAM
    201.             #pragma vertex vert_meta
    202.             #pragma fragment frag_meta
    203.  
    204.             #pragma shader_feature _EMISSION
    205.             #pragma shader_feature _METALLICGLOSSMAP
    206.             #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
    207.             #pragma shader_feature ___ _DETAIL_MULX2
    208.  
    209.             #include "UnityStandardMeta.cginc"
    210.             ENDCG
    211.         }
    212.     }
    213.  
    214.     SubShader
    215.     {
    216.         Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
    217.         LOD 150
    218.  
    219.         // ------------------------------------------------------------------
    220.         //  Base forward pass (directional light, emission, lightmaps, ...)
    221.         Pass
    222.         {
    223.             Name "FORWARD"
    224.             Tags { "LightMode" = "ForwardBase" }
    225.  
    226.             Blend [_SrcBlend] [_DstBlend]
    227.             ZWrite [_ZWrite]
    228.  
    229.             CGPROGRAM
    230.             #pragma target 2.0
    231.        
    232.             #pragma shader_feature _NORMALMAP
    233.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
    234.             #pragma shader_feature _EMISSION
    235.             #pragma shader_feature _METALLICGLOSSMAP
    236.             #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
    237.             #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
    238.             #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF
    239.             // SM2.0: NOT SUPPORTED shader_feature ___ _DETAIL_MULX2
    240.             // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
    241.  
    242.             #pragma skip_variants SHADOWS_SOFT DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE
    243.  
    244.             #pragma multi_compile_fwdbase
    245.             #pragma multi_compile_fog
    246.  
    247.             #pragma vertex vertBase
    248.             #pragma fragment fragBase
    249.             #include "UnityStandardCoreForward.cginc"
    250.  
    251.             ENDCG
    252.         }
    253.         // ------------------------------------------------------------------
    254.         //  Additive forward pass (one light per pass)
    255.         Pass
    256.         {
    257.             Name "FORWARD_DELTA"
    258.             Tags { "LightMode" = "ForwardAdd" }
    259.             Blend [_SrcBlend] One
    260.             Fog { Color (0,0,0,0) } // in additive pass fog should be black
    261.             ZWrite Off
    262.             ZTest LEqual
    263.        
    264.             CGPROGRAM
    265.             #pragma target 2.0
    266.  
    267.             #pragma shader_feature _NORMALMAP
    268.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
    269.             #pragma shader_feature _METALLICGLOSSMAP
    270.             #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
    271.             #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
    272.             #pragma shader_feature ___ _DETAIL_MULX2
    273.             // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
    274.             #pragma skip_variants SHADOWS_SOFT
    275.        
    276.             #pragma multi_compile_fwdadd_fullshadows
    277.             #pragma multi_compile_fog
    278.        
    279.             #pragma vertex vertAdd
    280.             #pragma fragment fragAdd
    281.             #include "UnityStandardCoreForward.cginc"
    282.  
    283.             ENDCG
    284.         }
    285.         // ------------------------------------------------------------------
    286.         //  Shadow rendering pass
    287.         Pass {
    288.             Name "ShadowCaster"
    289.             Tags { "LightMode" = "ShadowCaster" }
    290.        
    291.             ZWrite On ZTest LEqual
    292.  
    293.             CGPROGRAM
    294.             #pragma target 2.0
    295.  
    296.             #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
    297.             #pragma shader_feature _METALLICGLOSSMAP
    298.             #pragma skip_variants SHADOWS_SOFT
    299.             #pragma multi_compile_shadowcaster
    300.  
    301.             #pragma vertex vertShadowCaster
    302.             #pragma fragment fragShadowCaster
    303.  
    304.             #include "UnityStandardShadow.cginc"
    305.  
    306.             ENDCG
    307.         }
    308.  
    309.         // ------------------------------------------------------------------
    310.         // Extracts information for lightmapping, GI (emission, albedo, ...)
    311.         // This pass it not used during regular rendering.
    312.         Pass
    313.         {
    314.             Name "META"
    315.             Tags { "LightMode"="Meta" }
    316.  
    317.             Cull Off
    318.  
    319.             CGPROGRAM
    320.             #pragma vertex vert_meta
    321.             #pragma fragment frag_meta
    322.  
    323.             #pragma shader_feature _EMISSION
    324.             #pragma shader_feature _METALLICGLOSSMAP
    325.             #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
    326.             #pragma shader_feature ___ _DETAIL_MULX2
    327.  
    328.             #include "UnityStandardMeta.cginc"
    329.             ENDCG
    330.         }
    331.     }
    332.  
    333.  
    334.     FallBack "VertexLit"
    335.     CustomEditor "StandardShaderGUI"
    336. }
    337.  
     
    Last edited: Dec 13, 2019
    gostrafx, pitibonom and Edwin_deVries like this.
  21. dbchest

    dbchest

    Joined:
    Sep 26, 2016
    Posts:
    23
    Thanks for this, Eric! I found this post via search tonight and it was exactly what I needed,
    Derek
     
  22. mranger

    mranger

    Joined:
    Jan 26, 2019
    Posts:
    13
    I read through this twice and still don't know how to access the sub shader section.
     
    JasonC_SN and F4bs like this.
  23. wenyu-zhang

    wenyu-zhang

    Joined:
    Aug 9, 2019
    Posts:
    1
    You have to create a new 'Standard Surface Shader' in Unity, then double click on it to open it in Visual Studio.
     
  24. Honorsoft

    Honorsoft

    Joined:
    Oct 31, 2016
    Posts:
    81
    It's 2020 now, I have Unity 2019 but am using 2018. I had the same problem trying to turn off backface culling. I edited an Unity 2018 shader too include CULL OFF but it didn't seem to work. It did work with Unity 5 shaders though.

    Anyways, I found a couple of shaders that have culling off and work in Unity 2018:
    https://gist.github.com/unitycoder/469118783af9d2fd0e2b36becc7dd347

    Namely, this one:
    https://gist.github.com/unitycoder/...dea2b044497bde3b4cf492/Standard-2Sided.shader

    I find that CULL OFF is necessary for things like hair and capes or clothing.
     
    Last edited: Jan 21, 2021
    Zhelatin and salex1 like this.
  25. Honorsoft

    Honorsoft

    Joined:
    Oct 31, 2016
    Posts:
    81
    See? There's still people talking about it in 2019 and 2020. Maybe contribute to the conversation.

    Many threads need updating still because they still exist online and appear in web searches but are outdated. Contribute also, or stay quiet and let others converse.
     
    Last edited: Aug 21, 2020
  26. pitibonom

    pitibonom

    Joined:
    Aug 17, 2010
    Posts:
    220
    JasonC_SN and Honorsoft like this.
  27. riccardokhm

    riccardokhm

    Joined:
    Oct 22, 2019
    Posts:
    9
    I got the 2019.4.12 f1 and it worked great! Is there something else similar to test other solution?
     
  28. kiraxace

    kiraxace

    Joined:
    Apr 16, 2018
    Posts:
    1
    It's still working, thank you so Much!
     
    Honorsoft likes this.
  29. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    Any solution for Unity 2021.1?
     
  30. unity_oVsJgtACmNlH5w

    unity_oVsJgtACmNlH5w

    Joined:
    Aug 2, 2020
    Posts:
    4
    You can switch Cull fuction here in shader.
    upload_2022-4-30_19-54-54.png
     
  31. Honorsoft

    Honorsoft

    Joined:
    Oct 31, 2016
    Posts:
    81
    That's for "Shader Graph", and it sounds like the OP is talking about regular shaders. If they were using Shader Graph, they could just turn off culling by default...but then what do you do if you need back-face culling for some models?

    *Just as an update about back-face culling in Unity:
    I was still having some problems with culling properly shut off in Unity, since some 2-sided shaders turned out to have side-effects like being semi-transparent on one side, or causing some other models to be seen through them even when opaque. To achieve proper double-sided meshes with proper 2-sided shadows, so far my best results have come from using Unity's Nature/Tree Soft Occlusion Leaves shader (built-in). The slider settings will need to be adjusted though.
     
    Last edited: Jun 30, 2022
  32. Partybwal

    Partybwal

    Joined:
    Oct 4, 2017
    Posts:
    1
    I had this problem, and the easy solution was to go to the material and change shader from Standard to Standard_two_sided.
     
  33. Honorsoft

    Honorsoft

    Joined:
    Oct 31, 2016
    Posts:
    81
    Yes, I thought I had found the same solution years ago, but that shader (and most others) have weird effects you may not have noticed yet, like the backside of the object (with the 2-sided shader) will be semi-transparent. So, for example, if you had a flag with a 2-sided shader, you can now see both sides, but if you look from the other side, the flag is partially transparent. There's also other side effects, like lighting anomalies, etc..

    Here's a post about 2-sided shaders where I show screenshots of some errors caused by the 2-sided shaders for Unity:
    https://forum.unity.com/threads/how-to-turn-off-back-face-culling.329744/#post-8086097
    It shows things like other objects being seen through the 2-sided shader object (like the barn where you can see the fences inside the barn through the walls).
     
Thread Status:
Not open for further replies.