# Outlines

The outline implementation uses an **inverse hull extrusion method**, which creates outlines by duplicating and extruding the mesh along its vertex normals. This approach is efficient and widely used, but it's important to understand that the solutions provided are **per-object** implementations designed to complement the main shader functionality.

While this works well for many common use cases, there are certain limitations:

* As a per-object solution, each outlined object requires an additional draw call
* Some vertices may split (SEE SOLUTION IN THE NEXT POINT)
* Performance scales linearly with the number of outlined objects

**If your project requires advanced outline solutions** (such as global screen-space outlines, perfect outline continuity across multiple objects, or specialized edge detection), consider dedicated outline-specific assets that focus solely on this problem domain and provide post-processing outline solutions like [Linework](https://assetstore.unity.com/packages/vfx/shaders/linework-outlines-and-edge-detection-294140?aid=1101l52IjU).

All In 1 3D Shader offers outlines as part of its comprehensive feature set, but specialized outline assets may provide more robust solutions for projects where outlines are a critical visual element.

### Handling Sharp Corners and Non-Smooth Meshes

Since the outline uses **inverse hull normal extrusion**, the quality of the outline depends directly on the mesh's vertex normals. Meshes with sharp corners or flat-shaded normals can create gaps in the outline where vertex normals point in drastically different directions:

<figure><img src="/files/eV4Y7hh9FCVtdIaEwLUd" alt=""><figcaption></figcaption></figure>

**Solution: Smooth Shading + Flat Normals Effect**

To achieve clean outlines while maintaining a flat-shaded or faceted look for your lighting:

1. Set your mesh to **Shade Smooth** in your 3D modeling software or Unity (in the Mesh Import settings set the Normals to Calculate, the Smoothness Source to Angle, then choose some Smoothing Angle and press Apply. For better results try different Smoothing Angle values)

<figure><img src="/files/UUULWN7XRIGPBlmh1EQc" alt=""><figcaption></figcaption></figure>

2. Enable the **Flat Normals** effect in the shader
3. Adjust the Flat Normals intensity slider to control how faceted the lighting appears

<figure><img src="/files/iICnVbiMOh268kaWgxej" alt=""><figcaption></figcaption></figure>

This approach gives you the best of both worlds:

* Smooth vertex normals for clean, gap-free outline extrusion
* Flat-shaded appearance for stylized or low-poly aesthetics
* Full control over the degree of flatness through the adjustable slider

Here in the left we have the setup we just described, while on the right we have the regular flat shading + non smoothed normals you'll find in popular asset packs such as Synty ones:

<figure><img src="/files/ytSDfg5vZgGu8E99DVEB" alt=""><figcaption></figcaption></figure>

The Flat Normals effect recalculates surface normals per-pixel to create a faceted lighting appearance while preserving the smooth vertex normals used for outline generation.

### Outline Types

The shader offers four different outline methods, each with its own advantages and use cases:

#### None

Disables the outline effect entirely. Use this option when you don't need outlines or want to temporarily disable them without losing your settings.

#### Simple

A fixed basic implementation that extrudes the mesh along its vertex normals by a customizable width. This is the most common and versatile outline type, suitable for most use cases where a consistent outline is desired. The outline width remains constant in object space.

#### Constant

Creates an outline with constant screen-space width regardless of the object's distance from the camera. This is particularly useful for UI-like elements in 3D space or for maintaining consistent outline visibility at any distance. Objects retain the same outline thickness whether near or far from the camera.

#### Fade With Distance

An outline that becomes more visible as objects get closer to the camera and fades when far away. This creates interesting effects where objects only show prominent outlines when within interaction range, helping guide player attention to nearby interactive elements.

<figure><img src="/files/BeJwMmJeEJQJmO3IgsCv" alt=""><figcaption></figcaption></figure>

### Outline Modes

Each outline type supports two rendering modes that control how the outline appears:

#### Simple Mode

The shader extrudes an outline-colored mesh behind the original mesh. This is the most straightforward approach and works well for most cases, though the outline may appear on both the silhouette and internal edges visible from certain angles.

#### Clean Mode

Uses the stencil buffer to prevent the outline from appearing on top of the mesh surfaces. The outline only renders around the silhouette where the mesh edges meet the background, creating a cleaner appearance. This mode is ideal for detailed meshes where internal edges would otherwise create visual clutter.

<figure><img src="/files/RW9hUIzYgGt5HiBL6Xfh" alt=""><figcaption></figcaption></figure>

### URP Setup

For URP projects, the outline feature requires specific Render Features in your pipeline settings:

<figure><img src="/files/PmExaxnKtI3B5Ndhokjh" alt=""><figcaption></figcaption></figure>

The asset will prompt you to auto-configure these features when you first import it if URP is detected. You can also manually configure the pipeline settings at any time through the [Asset Window](/seaside-studios/3d-shader/asset-window.md) under URP Settings → Configure:

<figure><img src="/files/uGc1r51UvmLPpSD9BV6O" alt=""><figcaption></figcaption></figure>


---

# 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://seasidestudios.gitbook.io/seaside-studios/3d-shader/outlines.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.
