-
05/04 유니티 쉐이더 램버트, 블린퐁, 스탠다드유니티/쉐이더 2021. 5. 4. 16:37
스탠다드 램버트 블린퐁 Lambert
#pragma 스탠다드를 Lambert로
inout 매개변수타입를 SurfaceOutput로
BlinnPhong
#pragma 스탠다드를 BlinnPhong로
inout 매개변수타입를 SurfaceOutput로스탠다드
Shader "Custom/Standard" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM #pragma surface surf Standard 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); o.Albedo = c.rgb; o.Alpha = c.a; } ENDCG } FallBack "Diffuse" }
램버트
Shader "Custom/Standard" { 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 CGPROGRAM // Physically based Standard lighting model, and enable shadows on all light types #pragma surface surf Lambert sampler2D _MainTex; struct Input { float2 uv_MainTex; }; half _Glossiness; half _Metallic; fixed4 _Color; void surf (Input IN, inout SurfaceOutput o) { // Albedo comes from a texture tinted by color fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color; o.Albedo = c.rgb; o.Alpha = c.a; } ENDCG } FallBack "Diffuse" }
블린퐁
Shader "Custom/Standard" { 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 _SpecColor ("Specular Color", color) = (1,1,1,1) } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM // Physically based Standard lighting model, and enable shadows on all light types #pragma surface surf BlinnPhong sampler2D _MainTex; struct Input { float2 uv_MainTex; }; half _Glossiness; half _Metallic; fixed4 _Color; void surf (Input IN, inout SurfaceOutput o) { // Albedo comes from a texture tinted by color fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color; o.Specular = 0.5; o.Gloss = 1; o.Albedo = c.rgb; // Metallic and smoothness come from slider variables o.Alpha = c.a; } ENDCG } FallBack "Diffuse" }
'유니티 > 쉐이더' 카테고리의 다른 글
05/06 유니티 쉐이더 라이트 lambert와 half-lambert 연습 (0) 2021.05.06 05/04 유니티 쉐이더 노멀 맵(범프 매핑) (0) 2021.05.04 05/04 유니티 쉐이더 Smoothness 연습 (0) 2021.05.04 05/03 유니티 쉐이더 불 타는 효과 만들기 (0) 2021.05.03 05/03 유니티 쉐이더 UV가 Time으로 흘러가게 하기 (0) 2021.05.03