- Home /
How can recreate shader file in URP (Universal Renderer Pipeline)
Hi everyone.
I am using unity 2019.3.0b1f with URP
I haven't learned anything about shader. And i am learning shader graph in URP now.
My situation is I am learning Field of view visualisation by Sebastian Lague and He used shader.
But i don't have any knowledge about shader. And if possible, I wanna use shader graph. If not where should i learn about shader.
This is link where i get lesson of Sebastian Lague
https://www.youtube.com/watch?v=xkcCWqifT9M&list=PLFt_AvWsXl0dohbtVgHDNmgZV_UY7xZv7∈dex=3
and script of below are shaders which name are Stencil mask.
 Shader "Custom/Stencil Mask" {
     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" "Queue"="Geometry-100" }
         ColorMask 0
         ZWrite off
         LOD 200
 
         Stencil {
             Ref 1
             Pass replace
         }
 
         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;
 
         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"
 }
 
and Stencil Object
 Shader "Custom/Stencil Object" {
     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
 
         Stencil {
             Ref 1
             Comp equal
         }
         
         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;
 
         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"
 }
 
Thank you to read my problem.
And i wish someone figure out my problem. ^^
Answer by Snubber · May 27, 2020 at 12:43 AM
I ran into this issue as well and figured out how to do it. I made a youtube tutorial that describes the process as well as has a download for a working Unity project: https://youtu.be/uJSxqr3a0cA
I hope this helps.
Your answer
 
 
             Follow this Question
Related Questions
How can I render depth into a cube render texture and sample it in another shader? 0 Answers
CustomRenderTexture (RFloat) wont initialize in the same frame it is created. 0 Answers
How do I get rid of the black line in Unity Sky 1 Answer
Change UV Offset according to target objects to achieve a "Look At" effect 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                