Skip to content

Commit

Permalink
Fixed typos in the documentation and added runtime-bake.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Wasp3r committed Mar 5, 2024
1 parent a285db6 commit 1a62b76
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 38 deletions.
16 changes: 8 additions & 8 deletions Documentation/articles/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ Frustum culling is a technique used to cull objects that are not visible from th

Frustum culling does not remove from the rendering objects that are behind of other objects.

| Type | Visualsation |
| --- | --- |
| **Precomputed culling off** | <img src="../images/culing_off.png" width="200" />|
| **Precomputed culling on** | <img src="../images/culing_on.png" width="200" /> |
| Type | Visualization |
|-----------------------------|----------------------------------------------------|
| **Precomputed culling off** | <img src="../images/culing_off.png" width="200" /> |
| **Precomputed culling on** | <img src="../images/culing_on.png" width="200" /> |

# When should I use precomputed culling

Precomputed culling should be used for virtualy any 3D project. From fully open worlds, to closed, corridor based scenes. Scene with hundreds or thousands of objects usually without any culling algorithm can have significant GPU impact. Using precomputed culling can save a lot of GPU resources.
Precomputed culling should be used for virtually any 3D project. From fully open worlds, to closed, corridor based scenes. Scene with hundreds or thousands of objects usually without any culling algorithm can have significant GPU impact. Using precomputed culling can save a lot of GPU resources.

For **open world games**, in long view distant scenes you can save between **10-25% of GPU usage** ,depending on the scenery and occlusion level.

For **indor levels**, you can save up to **90% of the GPU usage**, depending on the scenery and occlusion level.
For **indoor levels**, you can save up to **90% of the GPU usage**, depending on the scenery and occlusion level.

# How often should I bake culling data

Expand All @@ -36,7 +36,7 @@ We recommend setting up CI pipeline that would bake culling after any scene chan

We created this asset for 3 main reasons.

1. Umbra doesn't support multi-scene setups, or addative scene setups.
1. Umbra doesn't support multi-scene setups, or additive scene setups.
2. Umbra bakes are low quality and bleed a lot of objects.
3. We often had issues with baking in batch mode.

Expand All @@ -46,7 +46,7 @@ With our solution we tried to address those issues and improve upon them.

We added features like:
- Variants bake
- Quality controll with pixel visiblity
- Quality control with pixel visibility
- Multiple areas with priorities
- and many more...

8 changes: 4 additions & 4 deletions Documentation/articles/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Adjust the priority of the cell, to determine which data should be used to gener

Preview your culling results in the scene view. Click on the area that you want to preview, and enable the preview mode.

*Note: Remeber to bake the culling data before previewing!*
*Note: Remember to bake the culling data before previewing!*

![Preview bake](../images/preview-bake.gif)

Expand All @@ -39,9 +39,9 @@ Each of the bake also contains data about it's preview bake time and it's size i

Configure the culling precision and quality. Use Minimal required visibility to allow for small objects to be culled, even if in theory visible.

The culling is based on 4096x4096 pixels of resolution per sample. So each sample is based on 16 milion pixels. By default when we set 0 or 1 of visibility we will see all objects, even if they were only single pixel visible. The more we will increase this value, we will change how much of the object should be visible before it is culled.
The culling is based on 4096x4096 pixels of resolution per sample. So each sample is based on 16 million pixels. By default when we set 0 or 1 of visibility we will see all objects, even if they were only single pixel visible. The more we will increase this value, we will change how much of the object should be visible before it is culled.

*Note: This has impact on small objects, like single rocks or cuttlery. Because they might generate a very little pixels on the samples, they will disapear faster then they should.*
*Note: This has impact on small objects, like single rocks or cutlery. Because they might generate a very little pixels on the samples, they will disappear faster then they should.*

*Note: At the time of writing this, you can only preview the visibility of the object in the runtime. This is subject to change in future versions.*

Expand All @@ -52,7 +52,7 @@ The culling is based on 4096x4096 pixels of resolution per sample. So each sampl

Determines how far the algorithm will look for neighboring cells. If it's set to 0, it will only take the cell we are currently in to generate the culling. If it's set to 1, it will take the cell we are currently in and it's neighbors. If it's set to 2, it will take the cell we are currently in and it's neighbors and it's neighbors, etc...

This is usefull if you have an open world and you want to make sure that there are no artifacts in the culling for objects that are behind small ocluders like trees.
This is usefully if you have an open world and you want to make sure that there are no artifacts in the culling for objects that are behind small ocluders like trees.

This setting will slightly decrease the performance because it will have to load data from not one but at least 4 cells.

Expand Down
25 changes: 12 additions & 13 deletions Documentation/articles/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Open world scenes with flat chunked terrain, gained us 10-25%. From 47fps to 60f

**Links:**

| Name | Link |
| ---- | ---- |
| Documentation and API reference | https://prographers.github.io/Precomputed-Culling |
| Project page | https://prographers.com/precomputed-culling/ |
| Documentation repository | https://github.com/Prographers/Precomputed-Culling/ |
| **Asset Store** | https://assetstore.unity.com/packages/slug/221372 |
| Name | Link |
|---------------------------------|-----------------------------------------------------|
| Documentation and API reference | https://prographers.github.io/Precomputed-Culling |
| Project page | https://prographers.com/precomputed-culling/ |
| Documentation repository | https://github.com/Prographers/Precomputed-Culling/ |
| **Asset Store** | https://assetstore.unity.com/packages/slug/221372 |

### Features:
- Support for URP and HDRP
Expand All @@ -34,11 +34,10 @@ Open world scenes with flat chunked terrain, gained us 10-25%. From 47fps to 60f
- Examples and Demos
- Support via email or discord
- Superior performance
-
- Bake in runtime or before build

*Not recommended to use in 2D games, intended use is for example leaves on the 3D trees or far away rocks.

### Limitations:
- Required to bake scenes and their variants before build.

### Roadmap:
- Support for Legacy (built-in)
Expand All @@ -57,15 +56,15 @@ Open world scenes with flat chunked terrain, gained us 10-25%. From 47fps to 60f

## Basic Usage:

For more advanced usages visit https://prographers.com/Precomputed-Culling/ or the related section in the repository https://github.com/Prographers/Precomputed-Culling/
For more advanced usages visit https://prographers.com/precomputed-culling/ or the related section in the repository https://github.com/Prographers/Precomputed-Culling/

1. Open the main scene where you want to initialize your setup
2. In the top menu, press Tools->Precomputed Culling->Setup
3. Adjust Precomputed Volume/Area to match the play area of your player (note you can have multiple areas)
4. Adjust cell density and camera control (Find the best setting between bake Quality and Bake time and performance).
4. Start baking either in Tools->Precomputed Culling->Bake or in Area
5. Wait for bake to finish
6. Enjoy an increase in performance
5. Start baking either in Tools->Precomputed Culling->Bake or in Area
6. Wait for bake to finish
7. Enjoy an increase in performance

## Recommendation:
### Open world areas:
Expand Down
30 changes: 30 additions & 0 deletions Documentation/articles/runtime-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Runtime Bake Guide

This guide will show you how to set up and use runtime occlusion culling.

## Setup

1. Create or open a scene on which you want to enable runtime baking.
2. From the top menu, press Tools > PrecomputedCulling > SetupRuntime or add elements manually:
* Add PrecomputedSceneSettings to the scene.
* Add PrecomputedCamera to the camera.
* Add your implementation of BaseRuntimeBakeController or DemoRuntimeBakeController.
* Add PrecomputedCullingRendererId to all renderers you want to be taken into account during the bake. Remember to set the correct id.
3. To trigger the bake, call BakeAll on your implementation of BaseRuntimeBakeController or DemoRuntimeBakeController.
4. To load data use LoadIndex on your IDataProvider.
5. Assign the PrecomputedData to the correct PrecomputedArea.
See the DemoRuntimeBakeController for an example of how to use the runtime bake system.

## How it Works

Culling data generated during the bake is saved to a zip file located at StreamingAssets/PrecomputedData/PrecomputedData.zip. This file contains all the baked data separated into files for each bake. Data is serialized by a custom serializer called SimpleTextSerializer. Then, while loading, the data is unpacked and deserialized. The culling process works exactly the same as in the case of the pre-baked data.

## Customization

### Customizing the Data Storage, Serialization, and Deserialization

You are free to implement your custom provider and serializer that will fit your needs. To do this, implement IDataProvider and handle the serialization and deserialization of the data. Then you just have to pass your provider to the RuntimeBakeProcess.

### Customizing the Bake Process Indicator

You can, and probably should, also implement your own way of showing the progress of the bake. Our demo implementation uses a DemoRuntimeBakeProgress. You can swap it with your implementation of IBakeProgress. Then you have to pass it to the RuntimeBakeProcess as well.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Open world scenes with flat chunked terrain, gained us 10-25%. From 47fps to 60f

**Links:**

| Name | Link |
| ---- | ---- |
| Documentation and API reference | https://prographers.github.io/Precomputed-Culling |
| Project page | https://prographers.com/precomputed-culling/ |
| Documentation repository | https://github.com/Prographers/Precomputed-Culling/ |
| Discord | https://discord.gg/55gM3s3pdR |
| **Asset Store** | https://assetstore.unity.com/packages/slug/221372 |
| Name | Link |
|---------------------------------|-----------------------------------------------------|
| Documentation and API reference | https://prographers.github.io/Precomputed-Culling |
| Project page | https://prographers.com/precomputed-culling/ |
| Documentation repository | https://github.com/Prographers/Precomputed-Culling/ |
| Discord | https://discord.gg/55gM3s3pdR |
| **Asset Store** | https://assetstore.unity.com/packages/slug/221372 |

### Features:
- Support for URP and HDRP
Expand Down Expand Up @@ -57,26 +57,26 @@ For more advanced usages visit https://prographers.com/precomputed-culling/ or t
2. In the top menu, press Tools->Precomputed Culling->Setup
3. Adjust Precomputed Volume/Area to match the play area of your player (note you can have multiple areas)
4. Adjust cell density and camera control (Find the best setting between bake Quality and Bake time and performance).
4. Start baking either in Tools->Precomputed Culling->Bake or in Area
5. Wait for bake to finish
6. Enjoy an increase in performance
5. Start baking either in Tools->Precomputed Culling->Bake or in Area
6. Wait for bake to finish
7. Enjoy an increase in performance

## Recommendation:
### Open world areas:
- Chunk size should be around 5 meters in width by 5 meters height by top jump height.
- At least 3 cameras in the middle. At top of jump height; At eye level; At Croutch eye level (add the fourth one if the prone position is allowed)
- At least 3 cameras in the middle. At top of jump height; At eye level; At Crouch eye level (add the fourth one if the prone position is allowed)
- Allow for taking data from neighboring cells at distance of 1 reduce aggressiveness of the algorithm
- Set runtime pixel requirement to 50-100 pixels
- Allow for baking terrain
- Allow for sprites baking (If the environment is not a pure 3D model)

### Small Areas (building):
- Chunk size should be around 1 meter by 1 meter by the height of the building
- At least 18 cameras. All spread out within the cell. At top of jump height; At eye level; At Croutch eye level.
- At least 18 cameras. All spread out within the cell. At top of jump height; At eye level; At Crouch eye level.
- (Optional if experiencing artifacts) Allow for taking data from neighboring cells in distance of 1 reduce aggressiveness of the algorithm
- Set runtime pixel requirement to 0 - 25 pixels
- Allow for baking transparent between 1 or 2 layers

More dense areas should have a bigger priority than less dense areas.

Please rate us at Asset Store 5 stars if you find this plugin usefull!
Please rate us at Asset Store 5 stars if you find this plugin useful!

0 comments on commit 1a62b76

Please sign in to comment.