Skip to content

Getting Started

Matt Dean edited this page Nov 17, 2018 · 3 revisions

BACK > Home


Welcome to kPortals!

The page will explain how to get started with kPortals for your project. First, clone or download a zip of this repository. Then you can either copy the kPortals and Gizmos folders into your project directory, or simply import kDecals.unitypackage directly into your project. You can also get the unitypackage for a given version directly from the releases tab here on Github.

Setting up the scene

alt text Manually placed Portal Volumes and Occluders.

If you are going to manually place your volume and occlusion objects you should first set up your scene. You can create new Portal Volumes and Portal Occluders either by using the Create menu in the Hierarchy and selecting kTools/Portals/Portal Volume and kTools/Portals/Portal Occluder respectively or by using the Add Component menu to add the components via kTools/Portals/.

Baking visibility

alt text Baked visibility information.

Next, or if you intend to automatically generate the previous data, you must add a Portal System to the scene. Again, You can create a new Portal System either by using the Create menu in the Hierarchy and selecting kTools/Portals/Portal System or by using the Add Component menu to add the component via kTools/Portals/.

Next set the Volume Mode. If you have manually placed volumes you should choose either Manual or Hybrid (if you wish to also generate automatic Volumes). If you select Automatic or Hybrid next you should set the amount of Subdivisions to use for the automatic Volumes. A higher Subdivisions value will provide better culling, but can also increase bake time substantially and runtime cost slightly.

Finally you might choose to tweak the Bake Settings (although the defaults should work in most cases). A higher Ray Density value will increase visibility accuracy but will increase bake time. A smaller Cone Angle will decrease bake time, but may reduce the amount of objects that are culled. See How it works for more information.

Finally press Bake, and wait for the bake process to finish. If the Processed Occludees value in the Statistics window is not 100% then some Occludees have not been hit by a ray. In this case increase the Ray Density and/or Cone Angle and rebake.

Defining Agents

alt text Defining a Portal Agent on the Camera.

The final step is to define Portal Agents. This component tells the Portal System in which Volume an actor is that requires visibility. You can define any number of Portal Agents. The Portal System will enable all Occludees for all volumes that contain Portal Agents, allowing split-screen cameras and other multiple camera setups.

Enter play mode

alt text Culling of cubes in play mode.

On entering play mode all Occludees not visibile from any Volumes containing Portal Agents will be hidden. As the Portal Agents move between Volumes this visibility information is updated and Occludees will be enabled and disabled as per the baked visibility information.

If this is not the result you are experiencing then go back to the start of this page and check that you have set up kPortals correctly. If you find the system still does not work you may choose to check the tests in this repository. If you believe there is a bug in the system please report it via Issues.

Thanks for trying kPortals. Happy culling!

Clone this wiki locally