I don’t understand the principle very well without outlining the principle, but I will share it if I find a way.
First of all, it’s probably because I’m not very familiar with using Unity. Simple things like double-sided display require Shader creation. Without further ado, let’s get straight to the point!
First create a URP, create ShaderGraph-URP-LitshaderGraph in the asset bar, and
we will get a standard editor.
Double-click to open the editor, then click on a blank space to find the RenderFace under the GraphSettings property in the upper left corner. Set the property to Default Front Back Reverse Both Front I understand the reference in the official documentation to set this up. I saw a lot of Two Sided switches on the website and I don’t know how to create them. I won’t list them one by one based on the actual situation. Reference: That’s it
for CullMode !
Double-sided display is the solution!
So if you are creating a shader—StandardSurfaceShader, how to add attributes? I also tried it. First, create
an editor where we will get an S. Right-click to find Show is Explorer and open the local location. Here, let’s see what kind of editor you like to use. Open the TXT file that comes with the system. You can use VS for advanced users. The N++ used here is very good for simple document editing!
This is how it is opened by default,
Shader "Custom/NewSurfaceShader"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
Cull Off //增加这条就默认给的双面显示依次给Fronet 称为正面剔除Back称为背面剔除
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
struct Input
{
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o)
{
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Reference documentation: ShaderLab command: Cull