Setup monitors
KanikamaBakeTargetMonitorGroup
The KanikamaBakeTargetMonitorGroup component is a BakeTargetGroup for monitors. When there are multiple monitors projecting the same image, the number of lightmap bakes can be reduced by combining them into a single monitor group. You need to setup this component even if there is only one monitor in your Scene.
fields | type | note |
---|---|---|
mainMonitor | KanikamaMonitor | A main monitor. Can not be null. |
subMonitors | KanikamaMonitor[] | Sub monitors (optional). main and sub monitors are supposed to have the same image. |
bakeTargetPrefab | BakeTarget | A prefab for grid cells of monitors. |
partitionType | KanikamaMonitor.PartitionType | How to divide monitors. |
monitorGridFibers | List<MonitorGridFiber> | BakeTargets used on baking. Fibers are generated by clicking Setup Lights button. |
Prefabs
Prefabs for MonitorGroups:
- Unity:
Packages/Kanikama/Runtime/Application/Prefabs/KanikamaMonitorGroup.prefab
- Udon Unity :
Packages/Kanikama Udon/Runtime/Application/Prefabs/KanikamaMonitorGroup.prefab
For Bakery, set the following Prefab for bakeTargetPrefab field.
Packages/Kanikama Bakery/Runtime/Application/Prefabs/BakeryGridCell.prefab
KanikamaRuntimeMonitorCamera
This is a runtime component to capture a monitor by Camera and get averaged colors. This component is attached in KanikamaMonitorGroup.prefab
. Averaged colors are given by choosing appropriate mipmap levels. For example, if you use 2x2 grids, the mipmap level should be 7. To work this correctly, the render target of the Camera needs to have the resolution 256 x 256.
fields | type | note |
---|---|---|
isSRP | bool | Check this when URP. |
monitorRenderer | Renderer | A renderer that the camera captures. It is recommended to use a Unity Quad hidden for players. |
bakeTargetPrefab | BakeTarget | A prefab for grid cells of monitors. |
partitionType | KanikamaMonitor.PartitionType | Set the same value to the KanikamaBakeTargetMonitorGroup. |
targetCamera | Camera | A Camera capturing a monitor to get colors. Its depth should be smaller than the main camera. |
readingTexture | Texture2D | Set 256 x 256 readable RGBA 16 SFloat Texture2D object with mipmap. |
KanikamaUdonMonitorCamera
This is a Udon version of KanikamaRuntimeMonitorCamera. It is a bit slower than the C# version because of U#'s rescriction of Unity API.