# Transparency

Transparent materials allow you to see through a mesh. Transparency can be **partial** (e.g. glass) or **binary** (fully visible or fully invisible per pixel). Choosing the correct method is important for both visual quality and performance.

There are two main approaches:

### Transparent Blending

Enable transparency by setting the material’s **Transparent** toggle to *Yes*. The final pixel color is blended with what has already been rendered behind it, using a blend mode (e.g. alpha blending).

**Pros**

* Supports **partial transparency** (smooth transitions between opaque and transparent)
* Ideal for materials like glass, water, smoke, and UI elements

**Cons**

* **Requires correct rendering order** (back-to-front sorting). Incorrect order can cause visible artifacts
* **Performance cost**: Objects behind must still be rendered even if fully covered
* Can produce **visual errors** when transparent objects overlap or intersect

**Use when**

* You need smooth, semi-transparent effects
* Visual accuracy is more important than performance

### Alpha Testing (Cutout)

Alpha testing uses a threshold to decide whether a pixel is rendered or discarded.

Example:\
If the alpha threshold is **0.1**, pixels with alpha < 0.1 are discarded; others are fully opaque.

**Pros**

* No sorting issues (renders like opaque objects)
* **Better performance** than blending in many cases
* Works well with depth testing and shadows

**Cons**

* No partial transparency (hard cut between visible/invisible)
* Can produce **jagged or pixelated edges**

**Tips**

* Adjust the threshold to minimize harsh edges
* Use higher-resolution textures or dithering techniques to improve appearance

**Use when**

* You need sharp cutouts (foliage, fences, grates)
* Performance and stability are important

### Quick Comparison

| Feature              | Transparent Blending | Alpha Test    |
| -------------------- | -------------------- | ------------- |
| Partial transparency | ✅ Yes                | ❌ No          |
| Sorting required     | ⚠️ Yes               | ❌ No          |
| Performance          | ❌ Higher cost        | ✅ Lower cost  |
| Edge quality         | ✅ Smooth             | ⚠️ Hard edges |

### Rule of Thumb

* Use **Transparent Blending** for *glass, liquids, effects*
* Use **Alpha Test** for *foliage, cutout textures, thin geometry*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hology.app/assets/materials/transparency.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
