현실에서 광원은 거리가 멀어질수록 희미해지며, 희미한 광원은 밝은 광원보다 범위가 작습니다. “폴오프(fall-off)”는 광원이 희미해지는 속도를 나타냅니다. Unity의 기본 폴오프 조명 동작과 함께 커스텀 폴오프 설정을 사용할 수도 있습니다.
프로그레시브 라이트매퍼는 스크립트를 통해 구현할 수 있는 커스텀 폴오프 프리셋을 제공합니다. 테이블 아래 이미지에서 시각적으로 설명된 동작 방식을 확인하고, 이미지 아래의 코드 샘플을 통해 이 기능의 사용 사례를 살펴보십시오.
프로퍼티 | 기능 |
---|---|
InverseSquared |
역제곱 거리 폴오프 모델을 적용합니다. 즉, 빛 강도가 현재 위치에서 광원까지 거리의 제곱에 반비례하여 약해집니다. 자세한 내용은 ’Wikipedia: 역제곱 법칙’을 참조하십시오. 이 옵션이 물리적으로 가장 정확합니다. |
InverseSquaredNoRangeAttenuation |
부드러운 범위 감쇠가 제외된 역제곱 거리 폴오프 모델을 적용합니다. InverseSquared 와 같은 방식으로 동작하지만, 조명 시스템에서 점 모양 광원(점 광원 및 스폿 광원)의 범위 파라미터 감쇠가 고려되지 않습니다. |
Legacy |
2차 폴오프 모델을 적용합니다. 이 모델의 경우 광원 감쇠가 광원 범위에 기반하여 이루어집니다. 광원이 소스에서 멀어질수록 강도가 감소하지만, 감쇠 도중 매우 급격하고 비정상적인 하락이 발생하고 시각 효과가 비현실적으로 보입니다. |
Linear |
리니어 폴오프 모델을 적용합니다. 이 모델에서 감쇠는 광원으로부터의 거리에 반비례하며, 소스에서부터 멀어질수록 일정 비율로 폴오프가 감소합니다. |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.GlobalIllumination;
using UnityEngine.SceneManagement;
[ExecuteInEditMode]
public class ExtractFalloff : MonoBehaviour
{
public void OnEnable()
{
Lightmapping.RequestLightsDelegate testDel = (Light[] requests, Unity.Collections.NativeArray<LightDataGI> lightsOutput) =>
{
DirectionalLight dLight = new DirectionalLight();
PointLight point = new PointLight();
SpotLight spot = new SpotLight();
RectangleLight rect = new RectangleLight();
LightDataGI ld = new LightDataGI();
for (int i = 0; i < requests.Length; i++)
{
Light l = requests[i];
switch (l.type)
{
case UnityEngine.LightType.Directional: LightmapperUtils.Extract(l, ref dLight); ld.Init(ref dLight); break;
case UnityEngine.LightType.Point: LightmapperUtils.Extract(l, ref point); ld.Init(ref point); break;
case UnityEngine.LightType.Spot: LightmapperUtils.Extract(l, ref spot); ld.Init(ref spot); break;
case UnityEngine.LightType.Area: LightmapperUtils.Extract(l, ref rect); ld.Init(ref rect); break;
default: ld.InitNoBake(l.GetInstanceID()); break;
}
ld.falloff = FalloffType.InverseSquared;
lightsOutput[i] = ld;
}
};
Lightmapping.SetDelegate(testDel);
}
void OnDisable()
{
Lightmapping.ResetDelegate();
}
}
2018.1에서 프로그레시브 라이트매퍼 추가됨 NewIn20181
2018–03–28 일부 편집 리뷰를 거쳐 페이지 게시됨
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.