|
| 1 | +--- |
| 2 | +title: Ambient Occlusion |
| 3 | +order: 7 |
| 4 | +--- |
| 5 | + |
| 6 | +<Image src="https://mdn.alipayobjects.com/huamei_9ahbho/afts/img/A*1fx8QIhX-MsAAAAAgCAAAAgAegDwAQ/original" /> |
| 7 | + |
| 8 | +Ambient Occlusion (AO) is a rendering technique that enhances scene realism by simulating how objects occlude ambient light in crevices, recesses, and contact areas, making the scene appear more grounded and natural. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## Parameters Overview |
| 13 | + |
| 14 | +| Parameter | Description | |
| 15 | +|------------------------|-------------| |
| 16 | +| **Enable** | Toggle to enable or disable Ambient Occlusion | |
| 17 | +| **Quality** | Controls the number of samples and algorithm complexity; lower quality improves performance, higher quality gives finer detail but costs more performance | |
| 18 | +| **Intensity** | Controls the overall strength of AO; higher values make occlusion darker | |
| 19 | +| **Power** | Adjusts the contrast of AO shadows; higher values make dark areas darker | |
| 20 | +| **Radius** | Controls the spread of AO; larger radius makes occlusion spread further | |
| 21 | +| **Bias** | Prevents self-occlusion artifacts to avoid surfaces darkening themselves | |
| 22 | +| **Bilateral Blur** | Removes noise without blurring object edges; larger values make AO smoother | |
| 23 | +| **Min Horizon Angle** | Ignores small angle occlusion to reduce artifacts | |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## Parameter Details |
| 28 | + |
| 29 | +**Radius** |
| 30 | +<Callout type="positive"> |
| 31 | +Global range, determines how far AO can spread |
| 32 | +</Callout> |
| 33 | +- Controls the sampling range of AO. If the radius is too small, AO only appears in narrow contact areas, looking “stuck to the edge.” If the radius is too large, AO will spread into areas that shouldn’t be darkened. |
| 34 | + |
| 35 | +<Image src="https://mdn.alipayobjects.com/huamei_9ahbho/afts/img/A*5YWVTZYSPuoAAAAAgQAAAAgAegDwAQ/original" /> |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +**Bias** |
| 40 | +<Callout type="positive"> |
| 41 | +Local adjustment, only affects the relation between the pixel itself and its sample points |
| 42 | +</Callout> |
| 43 | +- Typically a very small positive number (recommended `0.001 – 0.01`). |
| 44 | +- Adjusts the starting point of occlusion calculations to prevent a pixel from occluding itself. |
| 45 | +- Too small → surfaces may darken themselves. |
| 46 | +- Too large → legitimate occlusion may be skipped, resulting in overly clean visuals. |
| 47 | +- If your image looks too “dirty,” try increasing Bias. If occlusion looks too weak, try decreasing it. |
| 48 | + |
| 49 | +<Image src="https://mdn.alipayobjects.com/huamei_9ahbho/afts/img/A*uQONRpF8Sv4AAAAAgIAAAAgAegDwAQ/original" /> |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +**Bilateral Blur** |
| 54 | +- Blurs the AO texture to remove noise, but only within the same object surface while preserving sharp edges. |
| 55 | +- Higher values → smoother, softer AO with clean edges. |
| 56 | +- Lower values → noisier AO with possible banding or stripes. |
| 57 | + |
| 58 | +<Image src="https://mdn.alipayobjects.com/huamei_9ahbho/afts/img/A*lq7WSK7fgjUAAAAAgFAAAAgAegDwAQ/original" /> |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +**Min Horizon Angle** |
| 63 | +- Range: `0° – 45°` |
| 64 | +- Think of it as the “minimum angle required to start counting occlusion.” |
| 65 | + - Near `0°`: even tiny gaps are considered occluded. |
| 66 | + - At `45°`: only more obvious recesses are considered. |
| 67 | + |
| 68 | +Example across `0° – 45°`: |
| 69 | +<Image src="https://mdn.alipayobjects.com/huamei_9ahbho/afts/img/A*zGxmS6vR8RoAAAAAgPAAAAgAegDwAQ/original" /> |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +## Using Ambient Occlusion |
| 74 | + |
| 75 | +1. In the **Scene** settings, locate **Ambient Occlusion**. |
| 76 | +2. Click **Enable**. |
| 77 | + |
| 78 | +<Image src="https://mdn.alipayobjects.com/huamei_9ahbho/afts/img/A*FOuFQ4lKRLEAAAAAgEAAAAgAegDwAQ/original" /> |
| 79 | + |
| 80 | +- **Effect Comparison** |
| 81 | + |
| 82 | +<Comparison |
| 83 | + leftSrc="https://mdn.alipayobjects.com/huamei_9ahbho/afts/img/A*LEn7SLWoc4MAAAAAgEAAAAgAegDwAQ/fmt.webp" |
| 84 | + leftText="AO Disabled" |
| 85 | + rightSrc="https://mdn.alipayobjects.com/huamei_9ahbho/afts/img/A*AT5IQ7dq3VsAAAAAgEAAAAgAegDwAQ/original" |
| 86 | + rightText="AO Enabled" |
| 87 | +/> |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +## Best Practices |
| 92 | + |
| 93 | +1. **Why does AO look too dirty?** |
| 94 | + - Don’t set the radius too high. |
| 95 | + - Large radius + high intensity = dirty. |
| 96 | + - Moderate radius + Bilateral Blur = natural. |
| 97 | + |
| 98 | +2. **Combine with other post-processing** |
| 99 | + - Use with [Bloom](/docs/graphics/postProcess/effects/#bloom) and [Tonemapping](/docs/graphics/postProcess/effects/#tonemapping) to make AO shadows blend more naturally into the final image. |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +## Limitations |
| 104 | + |
| 105 | +Ambient Occlusion relies on the **depth buffer**, so it has the following limitations: |
| 106 | + |
| 107 | +1. **No support for transparent objects** |
| 108 | + - Transparent materials do not write to the depth buffer, so AO cannot be applied correctly to transparent surfaces. |
| 109 | + |
| 110 | +2. **Depth precision** |
| 111 | + - Galacean uses a **24-bit depth buffer** and does **not support 16-bit depth**. |
| 112 | + - This avoids banding and AO noise caused by insufficient precision in 16-bit depth. |
| 113 | + |
| 114 | +<Callout info="warning"> |
| 115 | +On some mobile devices, high-precision depth may increase performance cost. |
| 116 | +If you notice subtle “dirty spots,” try increasing **Bias** to mitigate the issue. |
| 117 | +</Callout> |
0 commit comments