<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>방향 벡터 Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<atom:link href="https://lycos7560.com/tag/%EB%B0%A9%ED%96%A5-%EB%B2%A1%ED%84%B0/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>생각의 흐름을 타고 다니며 만드는 블로그</description>
	<lastBuildDate>Thu, 01 Dec 2022 05:58:20 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://lycos7560.com/wp-content/uploads/2022/11/cropped-cropped-cropped-log-1-150x150-1-80x80.png</url>
	<title>방향 벡터 Archives - 어제와 내일의 나 그 사이의 이야기</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>12 &#8211; 01 ~ 02 Rim 라이트의 기초 (Unity Shader)</title>
		<link>https://lycos7560.com/unity/unity_shader/unity-shader-rim-light-fresnel/2900/</link>
					<comments>https://lycos7560.com/unity/unity_shader/unity-shader-rim-light-fresnel/2900/#respond</comments>
		
		<dc:creator><![CDATA[lycos7560]]></dc:creator>
		<pubDate>Thu, 01 Dec 2022 05:34:19 +0000</pubDate>
				<category><![CDATA[Unity]]></category>
		<category><![CDATA[UnityShader]]></category>
		<category><![CDATA[fresnel]]></category>
		<category><![CDATA[loat3 lightDir]]></category>
		<category><![CDATA[normalmap]]></category>
		<category><![CDATA[pow]]></category>
		<category><![CDATA[Rim]]></category>
		<category><![CDATA[RimLight]]></category>
		<category><![CDATA[Shader]]></category>
		<category><![CDATA[Standard Surface Shader]]></category>
		<category><![CDATA[Unity Shader]]></category>
		<category><![CDATA[viewDir]]></category>
		<category><![CDATA[공식]]></category>
		<category><![CDATA[노멀맵]]></category>
		<category><![CDATA[림]]></category>
		<category><![CDATA[림라이트]]></category>
		<category><![CDATA[방향 벡터]]></category>
		<category><![CDATA[쉐이더]]></category>
		<category><![CDATA[유니티]]></category>
		<category><![CDATA[프레넬]]></category>
		<guid isPermaLink="false">https://lycos7560.com/?p=2900</guid>

					<description><![CDATA[<p>Rim 라이트의 기초와 유니티에서 프레넬 공식을 통하여 구현하는 방법을 예제를 통해 간단하게 작성하였습니다. </p>
<p>The post <a href="https://lycos7560.com/unity/unity_shader/unity-shader-rim-light-fresnel/2900/">12 &#8211; 01 ~ 02 Rim 라이트의 기초 (Unity Shader)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div style="height:45px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">12 &#8211; 01 ~ 02 Rim 라이트의 기초 (Unity Shader)</h2>



<div style="height:26px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">주변을 자세히 보면 모든 물체는 기울어 질수록 반사가 심해집니다.</p>



<p class="has-medium-font-size wp-block-paragraph">실제로 모든 물체는 기울어 질수록 심하게 반사가 되며 그 반사율은 재질에 따라 다르게 나타납니다.</p>



<div style="height:38px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="804" height="353" src="https://lycos7560.com/wp-content/uploads/image-432.png" alt="" class="wp-image-2901" srcset="https://lycos7560.com/wp-content/uploads/image-432.png 804w, https://lycos7560.com/wp-content/uploads/image-432-300x132.png 300w, https://lycos7560.com/wp-content/uploads/image-432-768x337.png 768w" sizes="(max-width: 804px) 100vw, 804px" /></figure>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">만약 역광이 있을 떄, 털이나 반투명의 재질을 가진 물체들은 이 현상이 매우 강렬하게 나타날 수 있고</p>



<p class="has-medium-font-size wp-block-paragraph">재질에 따라 때로는 잘 보이지 않게 나타날 수도 있습니다.</p>



<div style="height:38px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">사진 분야에서는 이것을 Rim Light ( 림 라이트 ) 라고 부릅니다.</p>



<div style="height:31px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="553" height="239" src="https://lycos7560.com/wp-content/uploads/image-433.png" alt="" class="wp-image-2902" srcset="https://lycos7560.com/wp-content/uploads/image-433.png 553w, https://lycos7560.com/wp-content/uploads/image-433-300x130.png 300w" sizes="(max-width: 553px) 100vw, 553px" /></figure>



<div style="height:41px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">우리가 사용하는 Standard Shader와 같은 물리 기반의 쉐이더는 이러한 재질의 특성에 따른 반사율이</p>



<p class="has-medium-font-size wp-block-paragraph">BRDF(Bidirectional Reflectance Distribution Function &#8211;&nbsp;양방향 반사 분포 함수) 를 이용하여 구현되어 있습니다.</p>



<div style="height:31px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1341" height="809" src="https://lycos7560.com/wp-content/uploads/image-434.png" alt="" class="wp-image-2903" srcset="https://lycos7560.com/wp-content/uploads/image-434.png 1341w, https://lycos7560.com/wp-content/uploads/image-434-300x181.png 300w, https://lycos7560.com/wp-content/uploads/image-434-768x463.png 768w" sizes="(max-width: 1341px) 100vw, 1341px" /></figure>



<div style="height:44px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">이러한 반사 공식을&nbsp;<strong>fresnel (프레넬)</strong>&nbsp;이라 부릅니다.</p>



<p class="has-medium-font-size wp-block-paragraph">이번에 설명할 fresnel 공식은 그보다는 간단하게, 빛의 방향과는 전혀 상관이 없게 만드는 효과입니다.</p>



<p class="has-medium-font-size wp-block-paragraph">기본적으로 배경과 캐릭터의 분리나 강조를 위해, 혹은 선택되었을때나 특정 상태를 표현하기 위한 특수한 효과를 위해 사용합니다.</p>



<div style="height:26px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="959" height="695" src="https://lycos7560.com/wp-content/uploads/image-435.png" alt="" class="wp-image-2904" srcset="https://lycos7560.com/wp-content/uploads/image-435.png 959w, https://lycos7560.com/wp-content/uploads/image-435-300x217.png 300w, https://lycos7560.com/wp-content/uploads/image-435-768x557.png 768w" sizes="(max-width: 959px) 100vw, 959px" /></figure>



<div style="height:143px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">직접 확인해보기 위해서 아래 에셋을 사용했습니다. (무료)</p>



<p class="has-medium-font-size wp-block-paragraph"><a href="https://assetstore.unity.com/packages/3d/characters/humanoids/barbarian-warrior-75519" target="_blank" rel="noreferrer noopener">https://assetstore.unity.com/packages/3d/characters/humanoids/barbarian-warrior-75519</a>&nbsp;&lt;- TestAsset</p>



<div style="height:36px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><a href="https://assetstore.unity.com/packages/3d/characters/humanoids/barbarian-warrior-75519" target="_blank" rel="noreferrer noopener"><img decoding="async" width="1304" height="317" src="https://lycos7560.com/wp-content/uploads/image-388.png" alt="" class="wp-image-2824" srcset="https://lycos7560.com/wp-content/uploads/image-388.png 1304w, https://lycos7560.com/wp-content/uploads/image-388-300x73.png 300w, https://lycos7560.com/wp-content/uploads/image-388-768x187.png 768w" sizes="(max-width: 1304px) 100vw, 1304px" /></a></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"><strong>fresnel 공식 구현</strong></h2>



<div style="height:17px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">텍스쳐를 한장만 받는 기본형으로 쉐이더를 변경합니다.</p>



<div style="height:21px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Shader "Custom/RimLight"
{
    Properties
    {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        
        #pragma surface surf Lambert noambient
        #pragma target 3.0

        sampler2D _MainTex;

        struct Input
        {
            float2 uv_MainTex;
        };

        void surf (Input IN, inout SurfaceOutput o)
        {
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
            o.Albedo = c.rgb;
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}</pre>



<div style="height:41px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1313" height="545" src="https://lycos7560.com/wp-content/uploads/image-436.png" alt="" class="wp-image-2905" srcset="https://lycos7560.com/wp-content/uploads/image-436.png 1313w, https://lycos7560.com/wp-content/uploads/image-436-300x125.png 300w, https://lycos7560.com/wp-content/uploads/image-436-768x319.png 768w" sizes="(max-width: 1313px) 100vw, 1313px" /></figure>



<div style="height:58px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">o.Albedo 를 0 으로 만들어서 검게 만들고 시작하는 것이 좋습니다. </p>



<div style="height:36px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1533" height="476" src="https://lycos7560.com/wp-content/uploads/image-438.png" alt="" class="wp-image-2907" srcset="https://lycos7560.com/wp-content/uploads/image-438.png 1533w, https://lycos7560.com/wp-content/uploads/image-438-300x93.png 300w, https://lycos7560.com/wp-content/uploads/image-438-768x238.png 768w" sizes="(max-width: 1533px) 100vw, 1533px" /></figure>



<div style="height:38px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">이전에 배운 Lambert 공식은 노멀 벡터와 조명 벡터를 dot 연산한 공식입니다.</p>



<p class="has-medium-font-size wp-block-paragraph">이 공식을 간단하게 정의하면 두 벡터, 즉 노멀벡터와 조명 벡터의 각도가 같으면 밝고, 90도가 되면 어두워져서 검정색이 된다는 것입니다.</p>



<p class="has-medium-font-size wp-block-paragraph">그렇다면 여기에서 input 구조체에서 다른 값을 받아 봅시다.</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph"><a href="https://docs.unity3d.com/Manual/SL-SurfaceShaders.html" target="_blank" rel="noreferrer noopener">https://docs.unity3d.com/Manual/SL-SurfaceShaders.html</a> &lt;- 영문</p>



<div style="height:21px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><a href="https://docs.unity3d.com/Manual/SL-SurfaceShaders.html" target="_blank" rel="noreferrer noopener"><img decoding="async" width="1309" height="315" src="https://lycos7560.com/wp-content/uploads/image-439.png" alt="" class="wp-image-2908" srcset="https://lycos7560.com/wp-content/uploads/image-439.png 1309w, https://lycos7560.com/wp-content/uploads/image-439-300x72.png 300w, https://lycos7560.com/wp-content/uploads/image-439-768x185.png 768w" sizes="(max-width: 1309px) 100vw, 1309px" /></a></figure>



<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="wp-block-paragraph"><a href="https://docs.unity3d.com/kr/2021.3/Manual/SL-SurfaceShaders.html" target="_blank" rel="noreferrer noopener">https://docs.unity3d.com/kr/2021.3/Manual/SL-SurfaceShaders.html</a> &lt;- 한글</p>



<figure class="wp-block-image size-full"><a href="https://docs.unity3d.com/kr/2021.3/Manual/SL-SurfaceShaders.html" target="_blank" rel="noreferrer noopener"><img decoding="async" width="1302" height="315" src="https://lycos7560.com/wp-content/uploads/image-440.png" alt="" class="wp-image-2909" srcset="https://lycos7560.com/wp-content/uploads/image-440.png 1302w, https://lycos7560.com/wp-content/uploads/image-440-300x73.png 300w, https://lycos7560.com/wp-content/uploads/image-440-768x186.png 768w" sizes="(max-width: 1302px) 100vw, 1302px" /></a></figure>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">표면 셰이더 입력 구조</p>



<p class="has-medium-font-size wp-block-paragraph">입력 구조 Input에는 일반적으로 셰이더가 필요로 하는 텍스처 좌표가 있습니다. 텍스처 좌표의 이름은 텍스처 이름 앞에 “uv”가 붙는 형식으로 지어야 합니다(또는 두 번째 텍스처 좌표 세트를 사용하려면 “uv2”로 시작해야 합니다.)</p>



<div style="height:55px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="has-medium-font-size wp-block-heading">다음 값을 입력 구조에 추가할 수 있습니다.</h2>



<p class="has-medium-font-size wp-block-paragraph">float3 viewDir&nbsp;&#8211; 뷰 방향을 포함합니다. 패럴랙스 이펙트, 림 조명 등의 컴퓨팅에 사용합니다.</p>



<p class="has-medium-font-size wp-block-paragraph">float4와&nbsp;COLOR&nbsp;시맨틱 &#8211; 보간된 버텍스당 컬러를 포함합니다.</p>



<p class="has-medium-font-size wp-block-paragraph">float4 screenPos&nbsp;&#8211; 반사 또는 스크린 공간 효과를 위한 스크린 공간 포지션을 포함합니다.&nbsp;GrabPass에는 적합하지 않습니다.&nbsp;ComputeGrabScreenPos&nbsp;함수를 사용하여 커스텀 UV를 직접 계산해야 합니다.</p>



<p class="has-medium-font-size wp-block-paragraph">float3 worldPos&nbsp;&#8211; 월드 공간 포지션을 포함합니다.</p>



<p class="has-medium-font-size wp-block-paragraph">float3 worldRefl&nbsp;&#8211;&nbsp;표면 셰이더가 o.Normal에 기록하지 않는 경우&nbsp;월드 반사 벡터를 포함합니다. 예를 들어 리플렉트-디퓨즈(Reflect-Diffuse) 셰이더가 있습니다.</p>



<p class="has-medium-font-size wp-block-paragraph">float3 worldNormal&nbsp;&#8211;&nbsp;표면 셰이더가 o.Normal에 기록하지 않는 경우&nbsp;월드 노멀 벡터를 포함합니다.</p>



<p class="has-medium-font-size wp-block-paragraph">float3 worldRefl; INTERNAL_DATA&nbsp;&#8211;&nbsp;표면 셰이더가 o.Normal에 기록하는 경우&nbsp;월드 반사 벡터를 포함합니다. 픽셀당 노멀 맵을 기반으로 반사 벡터를 얻으려면&nbsp;WorldReflectionVector (IN, o.Normal)를 사용해야 합니다. 예를 들어 리플렉트-범프드(Reflect-Bumped) 셰이더가 있습니다.</p>



<p class="has-medium-font-size wp-block-paragraph">float3 worldNormal; INTERNAL_DATA&nbsp;&#8211;&nbsp;표면 셰이더가 o.Normal에 기록하는 경우&nbsp;월드 노멀 벡터를 포함합니다. 픽셀당 노멀 맵에 기반한 노멀 벡터를 얻으려면&nbsp;WorldNormalVector (IN, o.Normal)를 사용해야 합니다.</p>



<div style="height:84px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">우리가 사용할 값은 float3 viewDir 입니다.</p>



<p class="has-medium-font-size wp-block-paragraph">float3 는 3차원 벡터 Input 구조체 안에 있는 것으로 봐서 엔진에서 받을 수 있는 데이터입니다.</p>



<div style="height:27px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="718" height="186" src="https://lycos7560.com/wp-content/uploads/image-441.png" alt="" class="wp-image-2911" srcset="https://lycos7560.com/wp-content/uploads/image-441.png 718w, https://lycos7560.com/wp-content/uploads/image-441-300x78.png 300w" sizes="(max-width: 718px) 100vw, 718px" /></figure>



<div style="height:71px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">float3 lightDir가 <strong>버텍스에서 바라보는 조명의 방향을 나타내는 길이가 1인 벡터</strong>라면</p>



<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1076" height="623" src="https://lycos7560.com/wp-content/uploads/image-442.png" alt="" class="wp-image-2912" srcset="https://lycos7560.com/wp-content/uploads/image-442.png 1076w, https://lycos7560.com/wp-content/uploads/image-442-300x174.png 300w, https://lycos7560.com/wp-content/uploads/image-442-768x445.png 768w" sizes="(max-width: 1076px) 100vw, 1076px" /></figure>



<div style="height:37px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">float3 viewDir 은 <strong>버텍스에서 바라보는 카메라의 방향</strong>을 나타냅니다.</p>



<div style="height:35px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1071" height="646" src="https://lycos7560.com/wp-content/uploads/image-443.png" alt="" class="wp-image-2913" srcset="https://lycos7560.com/wp-content/uploads/image-443.png 1071w, https://lycos7560.com/wp-content/uploads/image-443-300x181.png 300w, https://lycos7560.com/wp-content/uploads/image-443-768x463.png 768w" sizes="(max-width: 1071px) 100vw, 1071px" /></figure>



<div style="height:38px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">그럼 Normal dot lightDir&nbsp; 대신&nbsp; Normal dot viewDir 을 하면</p>



<p class="has-medium-font-size wp-block-paragraph">카메라가 마치 조명처럼 인식되어 내가 바라보는 방향이 계속 밝아진다는 것입니다.&nbsp;</p>



<div style="height:29px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="878" height="445" src="https://lycos7560.com/wp-content/uploads/image-444.png" alt="" class="wp-image-2914" srcset="https://lycos7560.com/wp-content/uploads/image-444.png 878w, https://lycos7560.com/wp-content/uploads/image-444-300x152.png 300w, https://lycos7560.com/wp-content/uploads/image-444-768x389.png 768w" sizes="(max-width: 878px) 100vw, 878px" /></figure>



<div style="height:35px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-video"><video height="832" style="aspect-ratio: 1488 / 832;" width="1488" controls src="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_20_50_14.mp4"></video></figure>



<div style="height:64px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">반전</h2>



<div style="height:28px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="701" height="385" src="https://lycos7560.com/wp-content/uploads/image-445.png" alt="" class="wp-image-2916" srcset="https://lycos7560.com/wp-content/uploads/image-445.png 701w, https://lycos7560.com/wp-content/uploads/image-445-300x165.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></figure>



<div style="height:22px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-video"><video height="832" style="aspect-ratio: 1216 / 832;" width="1216" controls src="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_22_41_652.mp4"></video></figure>



<div style="height:35px" aria-hidden="true" class="wp-block-spacer"></div>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Shader "Custom/RimLight"
{
    Properties
    {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        
        #pragma surface surf Lambert noambient
        #pragma target 3.0

        sampler2D _MainTex;

        struct Input
        {
            float2 uv_MainTex;
            float3 viewDir;
        };

        void surf (Input IN, inout SurfaceOutput o)
        {
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
            float rim = dot(o.Normal, IN.viewDir);
            o.Emission = 1 - rim; // 결과 뒤집기
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}</pre>



<div style="height:88px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">위에서 조심할 내용은 dot 연산은 -1 까지 내려가서 나중에 결과가 이상해 질 수 가 있습니다.   saturate() 를 잊지마세요</p>



<div style="height:47px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">보는 각도를 바꿔도 언제나 외각이 밝아 보이면서 이제 Rim 라이트처럼 보이기 시작합니다.</p>



<p class="has-medium-font-size wp-block-paragraph">그런데 Rim라이트가 너무 두꺼워서 Rim 라이트 느낌이 살아나지 않습니다.</p>



<p class="has-medium-font-size wp-block-paragraph">흰테두리를 더 얇게 만들어줄 필요가 있습니다.</p>



<div style="height:55px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">검정부터 흰색까지 변하는 음영을 표로 보면 아래와 같습니다.</p>



<p class="has-medium-font-size wp-block-paragraph">가로축은 1 &#8211; dot(o.Normal, IN.viewDir) 이고 세로축은 색상 (흑백)을 의미합니다. 두 벡터의 각도 차이가 벌어질수록, 색상도 흰색이 됩니다. </p>



<div style="height:65px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="563" height="457" src="https://lycos7560.com/wp-content/uploads/image-446.png" alt="" class="wp-image-2918" srcset="https://lycos7560.com/wp-content/uploads/image-446.png 563w, https://lycos7560.com/wp-content/uploads/image-446-300x244.png 300w" sizes="(max-width: 563px) 100vw, 563px" /></figure>



<div style="height:34px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">pow 를 이용하면 지수함수와 같은 그래프로 어두운 부분이 한참동안 존재하다가 갑자기 밝아지는 모양이 됩니다.</p>



<p class="has-medium-font-size wp-block-paragraph">이 그래프를 이용하여 흰 테두리를 얇게 만듭니다.</p>



<div style="height:26px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="563" height="383" src="https://lycos7560.com/wp-content/uploads/image-447.png" alt="" class="wp-image-2919" srcset="https://lycos7560.com/wp-content/uploads/image-447.png 563w, https://lycos7560.com/wp-content/uploads/image-447-300x204.png 300w" sizes="(max-width: 563px) 100vw, 563px" /></figure>



<div style="height:46px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1538" height="639" src="https://lycos7560.com/wp-content/uploads/image-448.png" alt="" class="wp-image-2920" srcset="https://lycos7560.com/wp-content/uploads/image-448.png 1538w, https://lycos7560.com/wp-content/uploads/image-448-300x125.png 300w, https://lycos7560.com/wp-content/uploads/image-448-768x319.png 768w, https://lycos7560.com/wp-content/uploads/image-448-1536x638.png 1536w" sizes="(max-width: 1538px) 100vw, 1538px" /></figure>



<div style="height:64px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">이제 rim 라이트에 색상을 추가합니다.</h2>



<div style="height:41px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="895" height="891" src="https://lycos7560.com/wp-content/uploads/image-449.png" alt="" class="wp-image-2921" srcset="https://lycos7560.com/wp-content/uploads/image-449.png 895w, https://lycos7560.com/wp-content/uploads/image-449-300x300.png 300w, https://lycos7560.com/wp-content/uploads/image-449-150x150.png 150w, https://lycos7560.com/wp-content/uploads/image-449-768x765.png 768w" sizes="(max-width: 895px) 100vw, 895px" /></figure>



<div style="height:31px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-video"><video height="972" style="aspect-ratio: 1424 / 972;" width="1424" controls src="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_25_40_789.mp4"></video></figure>



<div style="height:51px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">두께 조절 프로퍼티도 만들어줍니다.</p>



<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="908" height="1051" src="https://lycos7560.com/wp-content/uploads/image-450.png" alt="" class="wp-image-2923" srcset="https://lycos7560.com/wp-content/uploads/image-450.png 908w, https://lycos7560.com/wp-content/uploads/image-450-259x300.png 259w, https://lycos7560.com/wp-content/uploads/image-450-768x889.png 768w" sizes="(max-width: 908px) 100vw, 908px" /></figure>



<div style="height:27px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-video"><video height="972" style="aspect-ratio: 1728 / 972;" width="1728" controls src="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_26_59_679.mp4"></video></figure>



<div style="height:59px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">NormalMap 추가</h2>



<div style="height:29px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">Rim 연산에서 o.Normal을 사용하기 때문에 반드시 Rim라이트 연산 이전에 NormalMap 을 적용시켜줘야 합니다.</p>



<div style="height:28px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="762" height="1063" src="https://lycos7560.com/wp-content/uploads/image-451.png" alt="" class="wp-image-2925" srcset="https://lycos7560.com/wp-content/uploads/image-451.png 762w, https://lycos7560.com/wp-content/uploads/image-451-215x300.png 215w" sizes="(max-width: 762px) 100vw, 762px" /></figure>



<div style="height:34px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-video"><video height="836" style="aspect-ratio: 1480 / 836;" width="1480" controls src="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_29_23_149.mp4"></video></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">이제 dot 연산에서 -1로 넘어가는 부분을 막아주고 noambient 까지 지워서 완성합니다.</p>



<div style="height:35px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-image size-full"><img decoding="async" width="818" height="1057" src="https://lycos7560.com/wp-content/uploads/image-452.png" alt="" class="wp-image-2927" srcset="https://lycos7560.com/wp-content/uploads/image-452.png 818w, https://lycos7560.com/wp-content/uploads/image-452-232x300.png 232w, https://lycos7560.com/wp-content/uploads/image-452-768x992.png 768w" sizes="(max-width: 818px) 100vw, 818px" /></figure>



<div style="height:74px" aria-hidden="true" class="wp-block-spacer"></div>



<figure class="wp-block-video"><video height="836" style="aspect-ratio: 1480 / 836;" width="1480" controls src="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_30_45_465.mp4"></video></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p class="has-medium-font-size wp-block-paragraph">이것이 Rim 라이트라고 부르는 Fresnel 이 적용된 결과 입니다.</p>



<p class="has-medium-font-size wp-block-paragraph">게임에서 캐릭터가 데미지를 입었을 때나 선택할 때, 혹은 단순히 배경과 분리된 느낌을 원할 때 자주 사용되는 방식이지만</p>



<p class="has-medium-font-size wp-block-paragraph">실제 존재하는 Rim 라이트를 구현했다고 부르기에는 약간 부족합니다.</p>



<p class="has-medium-font-size wp-block-paragraph">우리가 만든 Rim 라이트는 조명의 방향과 전혀 연관이 없습니다.</p>



<p class="has-medium-font-size wp-block-paragraph">이상적인 Rim 라이트는 역광일 때 주로 나타나고 직광일 때는 보이지 않습니다. (나중에 커스텀 라이트를 만들 때 가능합니다.)</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
<p>The post <a href="https://lycos7560.com/unity/unity_shader/unity-shader-rim-light-fresnel/2900/">12 &#8211; 01 ~ 02 Rim 라이트의 기초 (Unity Shader)</a> appeared first on <a href="https://lycos7560.com">어제와 내일의 나 그 사이의 이야기</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lycos7560.com/unity/unity_shader/unity-shader-rim-light-fresnel/2900/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_20_50_14.mp4" length="2364166" type="video/mp4" />
<enclosure url="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_22_41_652.mp4" length="3371153" type="video/mp4" />
<enclosure url="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_25_40_789.mp4" length="1297617" type="video/mp4" />
<enclosure url="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_26_59_679.mp4" length="1234314" type="video/mp4" />
<enclosure url="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_29_23_149.mp4" length="825114" type="video/mp4" />
<enclosure url="https://lycos7560.com/wp-content/uploads/녹화_2022_12_01_14_30_45_465.mp4" length="3354833" type="video/mp4" />

			</item>
	</channel>
</rss>
