正在加载商城…
极塔素材

Pixel Sprite Outline — real-time outline effect

Pixel Sprite Outline — real-time outline effect · Unity 特效 · 预览图 1

资源介绍

Sprite Outline adds a crisp, pixel-perfect outline to any SpriteRenderer using just a single component. Designed specifically for pixel art and 2D sprites, it respects hard pixel edges and delivers clean outlines at any resolution. No material editing. No shader graphs. No post-processing. Just go to Add Component > Effects > Sprite Outline, and it works instantly on any sprite! ✨ Features Zero Setup: Attach the component, and the outline appears immediately. Pixel-Perfect Edge Detection: Works beautifully with pixel art sprites. Adjustable Thickness: Fine-tune outline thickness from 0 to 16 pixels. Full Color Control: Pick any outline color via the Inspector or runtime API. Alpha Threshold: Adjust which sprite edges get outlined (great for anti-aliased sprites). Sorting Offset: Renders cleanly behind the sprite with zero z-fighting. Animation-Ready: Fully compatible with Unity Animator, sprite swapping, and flipping. Pipeline Agnostic: Seamlessly supports Built-in, URP, and HDRP. Runtime API: Control SetOutlineColor, outlinePixels, and more directly from your code. ⚙️ How it works The component creates a lightweight overlay mesh behind your sprite and uses an edge-detection shader that samples 8 neighboring pixels. Only the edges are colored—the original sprite remains completely untouched. The result is a clean outline that flawlessly follows your sprite through animations, scaling, rotation, and flipping. 🚀 Performance Highly Optimized: Only 1 extra draw call per outlined sprite. Lightweight: Just 4 vertices per outline mesh. No Overhead: Zero render textures, command buffers, or post-processing passes required. 🎨 Customization (Inspector Properties) Outline Color: Choose any color. Outline Pixels: Set thickness (0 to 16). Alpha Threshold: Define which alpha values count as an edge (0.0 to 1.0). Sorting Order Offset: Adjust the render position relative to the base sprite. 🎯 Suitable for Pixel Art Games: Platformers, RPGs, and action games. Highlighting Elements: Interactable objects, enemies, items, or selected units. Visual Feedback: Hover effects, selection outlines, and targeting indicators. Any 2D Project: A versatile effect that works with any sprite texture. 📦 What's included SpriteOutlineRenderer.cs (Main component) SpriteOutlineOnly.shader (Edge-detection shader) Interactive demo scene with UI controls Demo character sprites (CC-0 licensed) Comprehensive documentation (PDF, HTML, and Markdown) 📌 Requirements Unity 2022.3 or later Compatible with Built-in, URP, and HDRP No additional packages required! Pixel-perfect edge-detection shader samples 8 neighbor pixels Adjustable outline thickness: 0 to 16 pixels Configurable outline color with runtime SetOutlineColor API Alpha threshold slider for precise edge detection (0 to 1) Sorting order offset for clean rendering behind the sprite Automatic mesh generation from any sprite texture Real-time updates in LateUpdate for animation and sprite swap support Works with SpriteRenderer flipping (flipX / flipY) Fully compatible with Sprite Atlas Supports all render pipelines: Built-in, URP, HDRP AddComponentMenu shortcut: Effects / Sprite Outline Single draw call overhead per outlined sprite No external dependencies or additional packages required Includes full demo scene with interactive controls Documentation provided in PDF, HTML, and Markdown formats