Ayfel/PrefabLightmapping
소개
라이트맵 데이터를 프리팹에 저장하는 스크립트입니다. Unity의 Assets 탭에서 사용할 수 있습니다. 이 스크립트를 루트에 둔 채 프리팹을 씬에 배치하세요. 조명을 설정한 다음 에디터에서 Assets->Bake Prefab Lightmaps를 실행합니다. 처리가 끝나면 다른 씬에 프리팹을 생성해도 원래 씬의 라이트맵을 사용합니다.
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalPrefabLightmapping
Script for saving lightmapping data to prefabs. Used through the Assets tab in Unity. Place your prefabs in the scene with this script at the root. Set up your lighting and in the editor go to Assets->Bake Prefab Lightmaps. After the bake is processed you can now spawn your prefabs in different scenes and they will use the lightmapping from the original scene.
Remember that if you are not instantiating your prefabs at runtime you should remove the static flag from the GameObjects, otherwise static batching will mess with uvs and the lightmap won't work properly.
If you find problems when building make sure to check your graphics settings under Project Settings, as shader stripping might be the cause of the issue. Try playing with the option "Lightmap Modes" and setting it to Custom if it's not working.

*There is also an issue with Probuilder Objects so make sure to bake those meshes down so you don't use Probuilder objects in the prefabs.
** I added an optional checkbox called "Release Shaders" that is true by default, this makes the system reassign the shaders when applying the lightmaps. In some cases this is not necessary and it might conflict with certain shader keywords, if you notice some of your materials losing shader features you can uncheck this and that might fix your specific issue. It is true by default.
Original idea came from Joachim_Ante in the Unity forums
Feel free to use this project in all commercial and personal projects ;)
Runtime Light Probes
I added a new script that can be used to use lightprobes with your lightmapped prefabs. It needs a special setup though. You need to create a uniform lightprobe group in the scene you are going to instantiate prefabs at, and then do an "empty" bake in that scene. Then this script (LightProbeRuntime.cs) should be placed in that scene where you instantiate prefabs, and it will wait a frame to calculate the light volume contribution from the lights (only point lights for now) in the scene (so for this to work properly you need to have those lights be a part of the prefabs rooms/assets you bake, so this script finds the lights and adds their "would be" contribution to the probes). You can easily tweak this to call it at will if you prefer to recalculate probes at different times.
관련 프로젝트 살펴보기
불러오는 중…