# 2. Environment Detail and Set Dressing Part of [[Decals and Environment Detail]]. Previous: [[1. URP Decals Mental Model and Setup]]. Next: [[3. Decal Materials and Atlases]]. > [!warning] Code not compiled in Unity > The Editor tool below type-checked against 6000.5.8f1 and URP. It wasn't run. ## 2.1 What decals are for in a level A modular kit (see [[ProBuilder Gray-Boxing and Landmarks]]) repeats. Players notice the repetition long before they notice the polygons. Decals break it cheaply: | Job | Decal | Placement rule | |---|---|---| | Hide seams | Dirt strip, leak stain | Along wall-floor and wall-wall joins | | Wear | Scuffs, chipped paint | Where people would touch: door frames, handrails, corners at shoulder height | | Grime and age | Soot, water stains | Below vents, windows, pipes. Gravity and airflow, not random | | Cracks and damage | Cracked plaster, bullet scars | Near the story event that caused them | | Ground variety | Puddles, oil, leaves | In low spots, near drains, under trees | | Information | Signage, arrows, hazard stripes | Where the player makes a decision | ## 2.2 Storytelling with marks [[Level Up! (Review)]] talks about guiding players with what they notice. Marks are a quiet version of that: - **Breadcrumbs:** a trail of scorch marks or drag marks leads the eye down a corridor toward the next beat. Players follow it without being told. - **Aftermath:** a ring of bullet scars around one doorway says "someone made a stand here". That's backstory with zero dialogue. - **Affordance:** worn paint on one ledge says "this is climbable". Use it the same way every time, or it stops meaning anything. Rule of thumb: **decals near decision points, quiet elsewhere.** If every wall has grime, nothing reads. ## 2.3 Keep decals off characters: rendering layers A projector box near the floor also paints the player's boots when they walk through it. Fix that with rendering layers: 1. In the **Decal** renderer feature, tick **Use Rendering Layers**. 2. In **Project Settings → Tags and Layers → Rendering Layers**, name a layer, for example **Environment**. (Unity 6 keeps rendering layers there. This menu path wasn't re-checked on 6000.5.) 3. On environment renderers, set **Rendering Layer Mask** to include `Environment`. On characters, *exclude* it. 4. On each projector, set **Rendering Layers** to `Environment` only. Now decals paint walls and floors but never characters. Rendering layers cost an extra layer check, and on some platforms an extra buffer, so turn them on only if you need them. ## 2.4 Angle fade and draw order - **Angle Fade** (start/end in degrees) fades the decal on surfaces turned away from the projection direction. A floor puddle whose box clips the bottom of a wall would otherwise smear down the wall in long streaks. Try start 60 and end 85. - **Draw Order** on the decal material (−50 to 50, from the Shader Graph decal target) decides which decal wins when two overlap. Put base grime low and signage high. ## 2.5 A snap-to-surface tool Hand-placing hundreds of decals means nudging boxes into walls. This Editor tool casts along each selected projector's arrow, aligns the box to the surface normal (keeping its spin), and centres the box on the surface. ```csharp // Assets/Editor/DecalSurfaceSnap.cs #if UNITY_EDITOR using UnityEditor; using UnityEngine; using UnityEngine.Rendering.Universal; /// <summary> /// Editor helper for set dressing: snaps each selected Decal Projector onto the surface it points at, /// aligns it to the surface normal (keeping its spin) and centres the projection box on the surface. /// </summary> public static class DecalSurfaceSnap { [MenuItem("Tools/Decals/Snap Selected To Surface %#d")] static void Snap() { foreach (var go in Selection.gameObjects) { if (!go.TryGetComponent<DecalProjector>(out var p)) continue; var t = go.transform; var origin = t.position - t.forward * 0.5f; if (!Physics.Raycast(origin, t.forward, out var hit, 5f, ~0, QueryTriggerInteraction.Ignore)) { Debug.LogWarning(go.name + ": nothing to snap to within 5 m along the projection direction.", go); continue; } Undo.RecordObject(t, "Snap Decal"); Undo.RecordObject(p, "Snap Decal"); var spin = t.localEulerAngles.z; t.rotation = Quaternion.LookRotation(-hit.normal) * Quaternion.Euler(0f, 0f, spin); var depth = Mathf.Max(0.05f, p.size.z); p.pivot = new Vector3(0f, 0f, depth * 0.5f); t.position = hit.point + hit.normal * (depth * 0.5f); } } [MenuItem("Tools/Decals/Snap Selected To Surface %#d", true)] static bool CanSnap() => Selection.activeGameObject != null && Selection.activeGameObject.GetComponent<DecalProjector>() != null; } #endif ``` Workflow: duplicate a decal (**Ctrl+D**), drag it roughly over a new spot with the arrow facing the surface, then press **Ctrl+Shift+D** (Cmd+Shift+D on macOS). The `Undo.RecordObject` calls make each snap undoable. ## 2.6 Budget for authored decals Authored decals still cost every frame they're visible. Keep them: - **Batched:** share a few atlas materials with GPU instancing (part 3). - **Culled:** set a per-projector **Draw Distance** (15–30 m for small grime) instead of the 1000 m default. - **Shallow:** a thin projection depth paints fewer pixels behind the surface and touches fewer meshes.