본문 바로가기

쉐이더 조절로 이미지 흑백 만들기와 Lerp 함수의 기본 12345678910111213141516171819202122232425Shader "Custom/NewSurfaceShader" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } CGPROGRAM #pragma surface surf Standard fullforwardshadows sampler2D _MainTex; struct Input { float2 uv_MainTex; }; void surf (Input IN, inout SurfaceOutputStandard o) { fixed4 c = tex2D (_MainTex, IN.uv_MainTex); o.Albed.. 더보기
기본 쉐이더 코드의 텍스쳐 부분 알아보기 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849Shader "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 CGPROGRAM // Physically based Standard ligh.. 더보기
변수와 인터페이스 활용 변수 1.변수명은 첫 글자를 영어로 시작해야 하고, 숫자로 시작해서는 안됨.2.한글이나 _를 제외한 특수문자, 공백 사용불가3.예약어 사용불가. (float, Color같은 것)4.이미 사용하고 있는 변수명 사용불가5.대소문자 구별. 소문자로 시작하는 것이 좋음 변수를 활용12345678 void surf (Input IN, inout SurfaceOutputStandard o) { float4 test = float4(1,0,0,1); // 변수 생성 fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color; o.Albedo = test.rgb; //float4인 test가 가지고 있는 값 중 r,g,b만 사용하겠다는 뜻 => float3로 사용가능 o.Alpha =.. 더보기