본문 바로가기

분류 전체보기414

[Unity/Shader] 파트9-2 : Lambert 라이팅 매우 전통적이고 가벼운 라이팅 공식이다. 코드 Shader "Custom/NewSurfaceShader 1" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM // Physically based Standard lighting model, and enable shadows on all light types #pragma surface surf Lambert // * 여기를 Lambert로 바꿨다. // Use shader model 3.0 target, to get nicer looking lighting #pragma target 3.0 .. 2023. 8. 9.
[Unity/Shader] 파트9-1 : 유니티에 내장된 라이팅 구조 라이팅 구조는 총 3가지이다. Lambert - Specular 공식이 없다. - SurfaceOutput 구조체를 사용한다. Blinn Phong - Specular 공식이 있다. 그 중 블린 퐁 공식을 사용한다. - SurfaceOutput 구조체를 사용한다. Standard - PBS (물리 기반 쉐이더, Physically Based Shader)이다. - 주변 환경 반사해 Specular 구현한다. - Diffuse와 Specular가 에너지 보존 법칙을 따른다. - SurfaceOutputStandard 구조체 또는 SurfaceOutputStandardSpecular 구조체를 사용한다. (단지 Specular 색상을 임의로 결정한다는 점만 차이가 있다.) 2023. 8. 9.
[Unity/Shader] 파트8-5 : 멀티 텍스쳐링 (버텍스 컬러 적용) 버텍스 컬러를 이용해 여러 텍스쳐를 혼합한다. 그냥 lerp한 것이다. 코드 Shader "Custom/part8-5" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} _MainTex2 ("Albedo (RGB)", 2D) = "white" {} _MainTex3 ("Albedo (RGB)", 2D) = "white" {} _MainTex4 ("Albedo (RGB)", 2D) = "white" {} _BumpMap ("Normalmap", 2D) = "bump" {} _Metallic ("Metallic", range(0,1)) = 0.5 _Smoothness ("Smoothness", range(0,1)) = 0.5 } SubShader { Ta.. 2023. 8. 9.
[Unity/Shader] 파트8-4 : Occlusion 구석진 부분의 추가 음영이다. AO (엠비언트 오클루전 = 환경차폐)이라고도 불린다. 매우 구석져있어 환경광도 닿지 못하는 아주 어두운 부분이다. 코드 Shader "Custom/part8-2" { Properties { _MainTex("Albedo (RGB)", 2D) = "white" {} _Metallic("Metalic", Range(0,1)) = 0 _Smoothness("Smoothness", Range(0,1)) = 0.5 _BumpMap("Normalmap", 2D) = "bump"{} _Occlusion("Occlusion", 2D) = "white" {} // * } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM // Ph.. 2023. 8. 9.
[서평] 폴리매스 / 다재다능한 사람으로 되돌아가라 자신의 잠재성을 깨닫게 하는 책이다. 자아실현의 로드맵을 제시한다. 폴리매스가 되는 것이 아니라 폴리매스로 되돌아가는 것이라는 문장이 가장 인상 깊었다. 하지만 사례의 나열로 인해 책이 다소 지루하였다. 메모 2023. 8. 8.
[Unity/Shader] 파트8-3 : Normal map 노말맵에 대해 알아본다. UnpackNormal 부분이 특히 도움된다. 코드 Shader "Custom/part8-2" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} _Metallic ("Metalic", Range(0,1)) = 0 _Smoothness("Smoothness", Range(0,1)) = 0.5 _BumpMap("Normalmap", 2D) = "bump"{} // 유니티 내장 쉐이더에서 bump 명칭을 사용하고 있어 bumpmap으로 이름 짓는다. } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM // Physically based Standard lighting mo.. 2023. 8. 7.
[Unity/Shader] 파트8-2 : Metalic과 Smoothness 기본 코드에서 Metallic과 Smoothness가 어떤 역할을 하는지 설명한다. 코드 Shader "Custom/part8-2" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} _Metallic ("Metalic", Range(0,1)) = 0 _Smoothness("Smoothness", Range(0,1)) = 0.5 } SubShader { Tags { "RenderType"="Opaque" } LOD 200 CGPROGRAM // Physically based Standard lighting model, and enable shadows on all light types #pragma surface surf Standard fullforw.. 2023. 8. 7.
[Unity/Shader] 파트5-2 : 텍스쳐 입출력 해석 텍스쳐 받아서 그대로 출력하는 쉐이더이다. 추가된 코드는 없다. 단지 해석할 뿐이다. 코드 Shader "Custom/part5-2" { Properties { _MainTex ("Albedo (RGB)", 2D) = "white" {} // 2D 텍스쳐를 받는다. 기본값은 흰색 텍스쳐이다. } SubShader { Tags { "RenderType"="Opaque" } LOD 200 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 .. 2023. 8. 7.
[Unreal/Material] Gaussian Blur 구현 노드 구조 Blur_Size 파라미터 값을 조절하면 블러가 적용된다. IsNormal 파라미터 노말맵이라면 체크 해주어야한다. 이유는 https://monggus.tistory.com/375 참고 Custom 코드 // Var float3 out_color = float3(0.0, 0.0, 0.0); float Pi = 6.28318530718; float Directions = 16.0; // BLUR DIRECTIONS (Default 16.0 - More is better but slower) float Quality = 4.0; // BLUR QUALITY (Default 4.0 - More is better but slower) float Size = in_size; // BLUR SIZE (R.. 2023. 8. 7.