LWRP에서 Subtractive 모드로 LightMap Bake하기
CustomMaster Node에 LightMap 기능을 추가하면서 이것저것 테스트 해보았다.
LWRP 에서는 아직 Shadow Mask Mode는 지원하지 않으며, Baked Indirect와 Subtractive 모드만 지원하고 있다.
Baked Indirect 모드는 셰도우를 Bake 하지 않기 때문에 Subtractive만 테스트.
LWRP에서 조명
LWRP에서 조명을 쓰는 경우 PointLight는 아직 Shadow를 지원하지 않는다.
그리고 Area Light의 경우 지원하지 않는 줄 알았는데, 버그 였나보다...
관련 내용은 아래를 참고하자.
https://forum.unity.com/threads/lwrp-area-light-baking-not-working.664063/
[LWRP] Area light baking not working
I'm trying to generate light maps with an area light (which is baked only), but I don't see any light output in generated lightmaps. I verified this by...
forum.unity.com
수정이 되었다고 하는데 내용보면 아직 불안해 보이고 Bake만 지원하니 제외하는 것으로...
Directional Light, Point Light(빨강), Spot Light(파랑) 각각 하나씩 가지는 씬을 구성하였다.
캐릭터는 Dynamice Object이며, 나머지 Object는 Static Object로 설정되어 있다.
캐릭터의 아래를 보면 그림자가 두개인 것이 보이는데 길게 늘어진 그림자는 Directional Light에 의해 생긴 그림자이며 발 아래 있는 그림자는 SpotLight에 의해 생긴 그림자이다.
위에서도 언급했지만 LWRP에서 PointLight는 아직 그림자를 지원하지 않는다.
모든 Lighting을 Mixed로 두고 Bake한 결과
유니티 Subtractive 모드는 Directional Lighting만 Dynamice Shadow를 제공하기 때문에 사진을 보면 SpotLight의 그림자가 생기지 않은 것을 알수 있다.
유니티 매뉴얼에도 해당 내용이 잘 명시되어 있다.
https://docs.unity3d.com/2019.1/Documentation/Manual/LightMode-Mixed-Subtractive.html
Unity - Manual: Subtractive mode
Subtractive mode Subtractive mode is a lighting mode shared by all Mixed Lights in a Scene. To set Mixed lighting to Subtractive, open the Lighting window (menu: Window > RenderingThe process of drawing graphics to the screen (or to a render texture). By d
docs.unity3d.com
그리고 아래 Bake 된 라이트 맵을 보면 MixedMode에서 PointLight는 Bake 되지 않은 것을 알 수있다.
PointLight는 Mixed 모드를 지원하지 않는 것 같다.
정리해서 LWRP에서 Subtractive LightMap 기능은 아래와 같은 것으로 보인다.