## 1. Introduction

### 1.1 What's Included

Stylized Potions Pack is a complete 3D potion system featuring dynamic color customization, realistic liquid physics, and full Timeline animation support. Now fully compatible with both URP and Built-in Render Pipeline!

#### 3D Models (12 total)

- 10 unique potion bottles
- 1 alchemy table prop
- 1 potion display stand

#### Shaders (8 total)

URP: 4 shaders URP

Built-in: 4 shaders Built-in

#### Scripts (6 total)

- 3 core runtime scripts
- 2 custom editor scripts
- 1 utility tool

#### 110 Gradients

- 8 categories
- LUT texture system
- Real-time color switching

### 1.2 Features Overview

#### Dual Render Pipeline Support

Both URP and Built-in are fully functional with identical features. Same scripts work seamlessly in both pipelines with no code changes required.

### 1.3 Requirements

#### Minimum Requirements

- Unity: Unity 6 LTS (6000.0.60f1+)
- Pipeline: URP OR Built-in
- Graphics: DirectX 11+, Metal, Vulkan/GLES3

✓ Fully Tested URP and Built-in: Windows 10/11, WebGL, Android 11

⚠ (Not tested): macOS, iOS, Linux

### 🚨 Important First Steps

#### URP Users - READ THIS FIRST:

If colors look washed out: Settings > PC_RPAsset > Volumes > Uncheck "Tonemapping"

#### Built-in Users:

You're good to go! Open the demo scene and start using the pack.

Optional: Configure Post Processing Stack v2 manually for enhanced visuals (see Section 2.3).

## 2. Quick Start Guide

Get started with Stylized Potions Pack in 5 minutes!

### 2.1 Import Package

1. Download the package from Unity Asset Store
2. Open your Unity 6 project (URP or Built-in)
3. Import via Package Manager or Assets menu
4. Wait for Unity to compile scripts and import assets

Importing the Stylized Potions Pack via Unity Package Manager

#### Folder Structure After Import

    Assets/
    └── MesshingAround/
        ├── Animations/          # Timeline animations for Showcasing in Demo Scenes
        │   ├── Builtin/
        │   └── URP/
        ├── DemoScene
        │   ├── Builtin/         # Built-in showcase scene
        │       └── PostProcess Profiles (BuiltIn)/      # Post_procss profile for BUILT-IN ONLY
        │   └── URP/             # URP showcase scene
        ├── Documentation/       # This HTML + README
        ├── Materials/
        │   ├── Builtin/         # Built-in materials
        │   └── URP/             # URP materials
        ├── Meshes/              # FBX files
        │   ├── Builtin/         # 12 meshes with proper materials assigned(for built-in)
        │   └── URP/             # 12 meshes with proper materials assigned(for URP)
        ├── Prefabs/
        │   ├── Builtin/         # 18 ready-to-use prefabs(for built-in)
        │   └── URP/             # 18 ready-to-use prefabs(for URP)
        ├── Scripts/             # C# scripts + Editor
        │   ├── Editor/
        ├── Settings/            # Volume Profile for post-process in URP
        │   ├── Volume Profile (URP)/
        ├── Shaders/
        │   ├── Builtin/         # Builtin shaders
        │   └── URP/             # URP ShaderGraphs
        └── Textures/            # Grayscale + LUT textures
            ├── Builtin/         # 12 pre-configured textures(for built-in)
            └── URP/             # 12 pre-configured textures(for URP)

#### Important Notes

- Built-in users: Install Post Processing Stack v2 via Package Manager (for demo scene post-processing). Also install TMP Essentials for text management.
- URP users: Install TMP Essentials for text management
- Both pipelines: Core functionality works without any optional packages

### 2.2 Open Demo Scene

#### For URP Projects

1. Navigate to `Assets/MesshingAround/DemoScene/URP/`
2. Open StylizedPotions_Demo_URP scene
3. Observe Volume component for post-processing

Demo Scene showing potion setup and layout in Scene View

#### For Built-in Projects

1. Navigate to `Assets/MesshingAround/DemoScene/BuiltIn/`
2. Open StylizedPotions_Demo_BuiltIn scene
3. Install Post Processing Stack v2 if prompted
4. Observe Post Processing Profile and Post Process Volume

#### What You'll See in Demo Scene

Both demo scenes showcase:

- ✅ 16 different potion models
- ✅ 1 Alchemy table prop
- ✅ 1 Potion display stand
- ✅ Animated liquid fill amounts
- ✅ Dynamic color transitions using Timeline
- ✅ Real-time liquid wobble physics
- ✅ Different material variations (cork, metal, leather, glass)
- ✅ 110 gradient colors cycling automatically

### 2.3 Post-Processing Setup (Built-in Only)

#### ⚠️ Important for Built-in Users

Post-processing effects are NOT included in the Built-in demo scene to avoid dependency issues.

The demo scene will work correctly but won't have bloom/vignette effects like shown in the Unity Asset Store screenshots.

Why not included?

- Post Processing Stack v2 can cause missing references in clean projects
- Layer conflicts across different Unity versions
- Console errors on import in some configurations

#### To Match Store Visuals:

1. Install Post Processing Stack v2 from Package Manager
2. Follow the complete setup guide in Section 4: Built-in Post-Processing Setup
3. Takes approximately 5-10 minutes

URP Users: This does not apply to you - URP demo scene has post-processing ready to use out of the box!

### 2.4 Test in Play Mode

1. Press Play in Unity Editor
2. Observe the automated showcase:
   - Fill Amount animation
   - Liquid wobble physics
   - Glass Color transitions
   - Liquid Color transitions
   - Material variations
3. Try it yourself:
   - Select any potion GameObject in Hierarchy
   - Find Liquid.cs component in Inspector
   - Adjust Fill Amount slider (0-1)
   - Move the potion in Scene view to see wobble (Note: Wobble physics work best in Play Mode due to real-time calculations)

🎉 Congratulations! You've successfully imported and tested the package.

### 2.5 Using Prefabs

#### Quick Setup with Prefabs

1. Navigate to `Assets/MesshingAround/Prefabs/` (use Built-in or URP acording to your pipeline)
2. Drag any potion prefab into your scene
3. Prefabs come pre-configured with:
   - ✅ Correct materials assigned
   - ✅ PotionTextureSetup component configured
   - ✅ Liquid component ready to use
   - ✅ Textures properly assigned

#### Available Prefabs

- Potion_00_SkullSmall
- Potion_00_SkullSmall_Multicolor
- Potion_01_SquareSmall
- Potion_01_SquareSmall_HealingPotion
- Potion_02_HeartSmall
- Potion_02_HeartSmall_Ice
- Potion_03_ThinSmall
- Potion_03_ThinSmall_Poison
- Potion_04_StarSmall
- Potion_05_DiamondMedium
- Potion_06_RoundMedium
- Potion_07_GemBig
- Potion_07_GemBig_Poison
- Potion_08_ThinNeckBig
- Potion_09_BottleBig
- Potion_09_BottleBig_Multicolor
- Alchemy_Table
- Potions_Stand

Prefabs folder containing 18 ready-to-use potion prefabs

#### Switching Between Pipelines

- Prefabs and Materials are practically identical in both pipelines, use the corresponding assets acording to your pipeline.
- For now, there's no automatic conversion from one pipeline to another.

## 3. Shaders Reference

### 3.1 Stylized Tint (URP & Built-in)

Type:

- URP: Shader Graph (Lit, PBR)
- Built-in: Surface Shader (StandardSpecular)

Purpose: Main shader for opaque potion parts with gradient-based coloring

#### Properties

Property | Type | Pipeline | Description | Default
--- | --- | --- | --- | ---
_GradientTexture (Built-in) / _GradientTexture_LUT (URP) | Texture2D | Both | Gradient lookup table | LUT_Gradients.png
_GradientIndex | Float | Both | Gradient row selector (0-109) | 0
_GradientCount | Float | Both | Total gradients in LUT | 110
_EmissionColor | Color (HDR) | Both | Emission tint | Black
_EmissionStrength | Float | Both | Emission intensity | 0
_Smoothness / _Smoothness_Glossy | Float | Both | Surface smoothness | 0

Stylized Tint shader properties in Material Inspector

#### Usage

- Used for corks, metal bands, leather straps
- Supports emission for glowing effects
- Full PBR lighting in both pipelines
- GPU Instancing compatible

#### Pipeline Differences

- URP: Uses Shader Graph with PBR lighting nodes
- Built-in: Uses Surface Shader with StandardSpecular model
- Result: Visually identical in both pipelines
- Performance: Built-in may be slightly faster on older hardware

#### Configuration Notes

- Always assign both grayscale texture and LUT
- `_GradientIndex` must be between 0-109
- Higher smoothness = more reflective surface
- Emission strength 0 = no glow, 1+ = visible glow

### 3.2 Stylized Tint OP (URP & Built-in)

Files:

- URP: `Stylized_Tint_OP.shadergraph`
- Built-in: `Stylized_Tint_OP(built-in).shader`

Type:

- URP: Shader Graph (Lit, PBR, Transparent)
- Built-in: Surface Shader (StandardSpecular, Alpha:Fade)

Purpose: PBR shader with gradient coloring AND full opacity control

#### Properties

Same as Stylized Tint, plus:

Property | Type | Pipeline | Description | Default
--- | --- | --- | --- | ---
_Alpha / _Transparency | Float (0-1) | Both | Alpha transparency value | 1.0

Stylized Tint OP shader with Alpha parameter for transparency control

#### Key Features

- Full alpha transparency (0 = invisible, 1 = opaque)
- All PBR features from Stylized Tint
- Transparent render queue (renders after opaques)
- Gradient coloring works with transparency

#### When to Use

- Semi-transparent materials that need gradient colors
- Fading effects on corks or bands
- Special materials requiring partial opacity
- NOT for glass (use Stylized Glass instead)

#### Differences from Stylized Tint

- Transparent rendering (proper depth sorting)
- Alpha blending enabled
- ZWrite Off in Built-in version
- Slightly slower due to transparency calculations

#### Pipeline Differences

- URP: Uses `_Transparency` property name
- Built-in: Uses `_Alpha` property name
- Functionality: Identical in both pipelines
- Rendering: Both use alpha blending

### 3.3 Stylized Glass (URP & Built-in)

Type:

- URP: Shader Graph (UnLit, Transparent)
- Built-in: Custom shader with lighting calculations

Purpose: Glass bottle shader with transparency and rim lighting

#### Properties

Property | Type | Pipeline | Description | Default
--- | --- | --- | --- | ---
_OuterRimpower | Float (0-1) | Both | Outer rim intensity | 0.015
_OuterRimSmoothness | Float (0-1) | Both | Outer rim line smoothnes | 0
_RimColor | Color | Both | Outer Rim colouring | White
_InnerRimPower | Float (0-0.5) | Both | Inner rim intensity | 0.131
_InnerRimSmoothness | Float (0-0.5) | Both | Inner rim line smoothnes | 0
_InnerRimColor | Color | Both | Inner Rim colouring | White
_Alpha | Float (0-1) | Both | Glass transparency | 0.3
_MainTintColor | Color | Both | Glass color tint | White
_GradientIndex | Float | Both | Gradient row selector (0-109) | 1
_GradientCount | Float | Both | Total of gradients in LUT texture | 110
_LightCutoff | Float (0-1) | Both | Specular light alpha cutoff | 0.160
_LightCutoffSmoothness | Float (0-1) | Both | Specular light alpha cutoff line smoothness | 0.6
_ViewSpecCutoff | Float (0-1) | Both | Alpha control from specular light generated from scene lights | 0
_SpecularColor | Color | Both | Specular highlight color | White

Stylized Glass shader properties

#### Pipeline Differences

- Performance: Built-in version slightly lighter

Comparison between URP and Built-in pipelines

### 3.4 Liquid Effect (URP & Built-in)

Type:

- URP: Shader Graph (Unlit, Transparent)
- Built-in: Custom Unlit shader (Transparent)

Purpose: Animated liquid with wobble physics and foam

#### Properties

Property | Type | Pipeline | Description | Default
--- | --- | --- | --- | ---
_GradientTexture | 2D texture | Both | LUT texture | LUT_Gradients.png
_TopColor | Color (HDR) | Both | Liquid surface color | Cyan
_Tint / _BottomColor | Color (HDR) | Both | Liquid depth color | Blue
_MainTexture | 2D texture/td> | Both | Custom Texture you want to include | None
_GradientIndex | Float | Both | Gradient row (0-109) | 0
_GradientCount | Float | Both | Total gradients | 110
_FoamSmoothness | Float (0-0.3) | Both | Foam edge smoothness | 0.02
_FoamSmoothness | Float (0-0.3) | Both | Foam edge smoothness | 0.02
_FoamColor | Color (HDR) | Both | Foam/edge color | White
_Line / _FoamWidth | Float (0-0.3) | Both | Foam thickness | 0.05
_Frecuency (Sine) | Float (0-25) | Both | Control de frencuency of sine waves | 10
_Amplitude (Sine) | Float (0-25) | Both | Control de amplitude (size) of sine waves | 10
_Rimpower | Float (0-5) | Both | Control the amount of fresnel effect | 0
_RimColor | Color (HDR) | Both | Rim color | White

Liquid Effect shader properties including wobble, gradient, and color controls

#### Features

- Real-time wobble driven by Liquid.cs script
- Gradient-based coloring using LUT
- Procedural foam at liquid surface
- Rim lighting for depth
- Wave animation for dynamic surface
- Transparent rendering with proper sorting
- Works identically in both URP and Built-in

#### How It Works

1. Liquid.cs calculates wobble and fill position
2. Shader receives `_WobbleX`, `_WobbleZ`, `_FillAmount` via MaterialPropertyBlock
3. Vertex shader displaces vertices based on wobble
4. Fragment shader calculates liquid surface, foam, and colors

#### Pipeline Differences

- Property Names: Some properties have different names (see table above)
- Functionality: 100% identical behavior
- Performance: Nearly identical in both pipelines
- Visual Result: Indistinguishable

#### Important Notes

- Requires Liquid.cs script to function properly
- Culling: Off (double-sided rendering)
- Alpha Clipping enabled for sharp liquid surface
- Performance: Medium (procedural calculations in shader)

## 4. Built-in Render Pipeline - Post-Processing Setup

### Why Post-Processing is Not Included

Post-processing effects are not included in the Built-in package due to compatibility issues with Post Processing Stack v2 across different Unity versions and project configurations.

Issues that can occur when including Post Processing Stack v2:

- Missing references in the demo scene on clean projects
- "PostProcessing" layer not found errors
- Console warnings about undefined layers
- Version conflicts between Unity releases

To ensure maximum compatibility, we've opted to let users set it up manually following these simple steps.

### 4.1 Visual Difference

Without post-processing:

- ❌ No bloom glow on liquids and glass
- ❌ No vignette effect (darkened edges)
- ❌ Flat lighting appearance
- ❌ Colors appear less vibrant

With post-processing:

- ✅ Beautiful bloom glow matching URP visuals
- ✅ Cinematic vignette effect
- ✅ Enhanced colors and depth
- ✅ Matches Unity Asset Store screenshots

Setup Time: 5-10 minutes following this guide

### 4.2 Step-by-Step Setup

#### Step 1: Install Post Processing Stack v2

1. Open Window → Package Manager
2. Search for `"Post Processing" under Unity Registry`
3. Click Install
4. Wait for Unity to compile

#### Step 2: Create PostProcessing Layer

1. Go to Edit → Project Settings → Tags and Layers
2. Find the first empty layer slot
3. Click on it and type: `PostProcessing`
4. Press Enter to confirm

#### Step 3: Create Post Process Profile

1. In the Project window, right-click in your desired folder
2. Select Create → Post-processing Profile
3. Name it: `MyPostProcessProfile` (or any name you prefer)

#### Step 4: Configure Bloom Effect

1. Select your Post Process Profile in the Project window
2. In the Inspector, click Add effect... → Unity → Bloom
3. Configure the following settings:

Property | Value | Description
--- | --- | ---
Intensity | 1.2 | Brightness of the bloom glow
Threshold | 0.85 | Minimum brightness to trigger bloom

#### Step 5: Configure Vignette Effect (Optional)

1. Click Add effect... → Unity → Vignette
2. Configure the following settings:

Property | Value | Description
--- | --- | ---
Color | #3D00FF | Purple/blue tint (or any color you prefer)
Intensity | 0.386 | Strength of edge darkening
Smoothness | 0.226 | Transition smoothness from center to edges

Tip: Vignette is optional but adds cinematic quality. Adjust values to your preference!

#### Step 6: Create Global Volume

1. In the Hierarchy, right-click and select 3D Object → Post-process Volume
2. Rename it to: `Global Volume`
3. In the Inspector, configure:

Property | Value | Description
--- | --- | ---
Is Global | ✓ Checked | Applies to entire scene
Weight | 1 | Full effect intensity
Profile | Your profile asset | Drag your post-process profile here

4. Set the GameObject's Layer to `PostProcessing` using the Layer dropdown at the top of the Inspector

#### ⚠️ Critical Step

You MUST set the volume GameObject to the `PostProcessing` layer, or effects won't work!

#### Step 7: Configure Main Camera

1. Select Main Camera in the Hierarchy
2. In the Inspector, click Add Component
3. Search for and add: `Post-process Layer`
4. Configure the component:

Property | Value | Description
--- | --- | ---
Layer | PostProcessing (your created layer) | Which layer to process
Trigger | This | Use camera position as trigger
Anti-aliasing | None | Disable to avoid conflicts

#### Step 8: Enable HDR (Important for Android)

1. Go to Edit → Project Settings → Graphics
2. Find Tier Settings → Android
3. Uncheck "Use Defaults"
4. Check "Use HDR"

#### Why Enable HDR?

Without HDR enabled, bloom effects won't be visible on Android devices. This is required for mobile deployment.

### ✅ Done!

You should now see bloom and vignette effects in the Game view, matching the URP visual quality and Unity Asset Store screenshots.

### 4.3 Troubleshooting

#### Effects not visible in Game view?

Solution:

- Verify that Main Camera has Post-process Layer component
- Check that Layer is set to PostProcessing
- Confirm volume GameObject is on PostProcessing layer
- Verify "Is Global" is checked on the volume
- Check that Camera has HDR enabled in Camera component

#### Effects work in Scene view but not Game view?

Solution:

- Go to Edit → Project Settings → Graphics
- Tier Settings → Your target platform
- Enable HDR for that platform

#### Performance issues after adding post-processing?

Optimization Tips:

- Reduce Bloom Diffusion value (try 5 instead of 7)
- Increase Bloom Threshold value (try 0.9 instead of 0.85)
- Disable Vignette if not needed
- Use Fast Mode in Bloom settings for mobile

### 4.4 Comparison: URP vs Built-in

Feature | URP | Built-in
--- | --- | ---
Post-Processing | ✅ Included by default | ⚠️ Manual setup required
Setup Time | 0 minutes (ready to use) | 5-10 minutes (follow this guide)
Visual Quality | ✅ Excellent | ✅ Excellent (when configured)
Performance | ✅ Optimized | ✅ Good (slightly older tech)
Compatibility | Unity 2021.3+ | Unity 2020.3+ (with Post Processing Stack v2)

#### Final Notes

- Both pipelines achieve identical visual results when post-processing is configured
- This manual setup gives you full control over post-processing settings
- You can adjust effect intensities to match your project's art style
- Post-processing profile can be reused across different scenes

## 5. Scripts Reference

### 5.1 PotionTextureSetup

File: `PotionTextureSetup.cs`

Purpose: Assigns grayscale textures to materials automatically

Pipeline Support: Works identically in URP and Built-in

#### Component Properties

Property | Type | Description
--- | --- | ---
Grayscale Texture | Texture2D | Grayscale texture for LUT coloring

PotionTextureSetup component with "Prepare for Timeline" button for creating material instances

#### How It Works

1. Detects if object uses Material Instances or MaterialPropertyBlock
2. Assigns `_GrayscaleTex` to all compatible materials
3. Updates automatically when texture changes
4. Syncs with Liquid.cs if present
5. Pipeline-agnostic - works seamlessly in both URP and Built-in

#### When to Use

- Always use on potion prefabs
- Ensures correct texture assignment
- Required for gradient system to work
- No pipeline-specific configuration needed

#### Inspector Features

- Auto-detection of material instances
- Warning messages if configuration is incorrect
- Real-time updates in Edit Mode
- "Prepare for Timeline" button for material instance creation
- "Remove Instances" button to restore original materials

#### Timeline Preparation

For Timeline Animation:

1. Click "Prepare for Timeline" button
2. Material instances will be created
3. "(Instance)" suffix appears in material names
4. Ready for Timeline property animation

To Restore:

1. Click "Remove Instances" button
2. Original shared materials restored
3. Better performance for non-animated objects

### 5.2 Liquid

File: `Liquid.cs`

Purpose: Real-time liquid physics simulation with wobble and fill control

Pipeline Support: 100% compatible with both URP and Built-in

#### Component Properties

Property | Type | Range | Description
--- | --- | --- | ---
Update Mode | Enum | - | Normal / Unscaled Time
Max Wobble | Float | 0-0.4 | Maximum wobble intensity
Wobble Speed Move | Float | 0-1.5 | Wobble oscillation speed
Fill Amount | Float | 0-1 | Liquid fill percentage
Min Fill | Float | 0-1 | Minimum fill position (to adjust liquid to any shape)
Max Fill | Float | 0-1 | Maximum fill position (to adjust liquid to any shape)
Recovery | Float | 0-2 | Wobble damping speed
Thickness | Float | 0-5 | Wobble sensitivity threshold
Compensate Shape Amount | Float | 0-1 | Shape compensation factor (for asymmetrical complex shapes)
Mesh | Mesh | - | Potion mesh (auto-assigned)
Renderer | Renderer | - | Renderer component (auto-assigned)

Liquid component with Fill Amount slider and physics settings

#### How It Works

Physics Calculation (Update loop):

1. Calculate velocity from position change
2. Calculate angular velocity from rotation change
3. Compute wobble amounts using sine wave
4. Apply damping for natural settling
5. Update fill position based on lowest mesh point

Material Communication:

- Uses MaterialPropertyBlock for shared materials
- Writes directly to Material Instances when present
- Updates `_WobbleX`, `_WobbleZ`, `_FillAmount` properties
- Works with both URP and Built-in shaders seamlessly

#### Performance Features

- Framerate-independent physics (v1.0.0 includes fix)
- Velocity clamping prevents excessive wobble at high FPS
- Conditional updates (only when moving)
- Cached lowest point calculation (no per-frame mesh queries)
- Forced 60 FPS cap for consistent physics

#### Usage Tips

Basic Setup:

    // Attach to potion GameObject
    // Assign liquid material created with Liquid_Effect shader
    // Adjust Min and Max Fill and Fill Amount slider
    // Works automatically in both URP and Built-in!

Timeline Animation:

    // Animate "Fill Amount" property in Timeline
    // Wobble physics work automatically during animation
    // No pipeline-specific setup needed

Runtime Control:

    Liquid liquid = GetComponent<Liquid>();
    liquid.fillAmount = 0.75f; // 75% full
    liquid.MaxWobble = 0.05f;   // Increase wobble intensity

#### Framerate Fix (v1.0.0)

Problem Solved:

- High framerates (300+ FPS) caused excessive wobble
- Velocity calculations were frame-dependent

Solution Implemented:

- Application.targetFrameRate = 60
- QualitySettings.vSyncCount = 0
- Velocity magnitude clamping
- Delta time-based calculations

#### Known Limitations

- Requires Read/Write enabled on mesh (increases memory ~20%)
- Physics calculations are approximate (not real fluid simulation)
- Double-sided rendering on liquid shader (performance cost)

#### Pipeline Compatibility

- ✅ No code changes needed between pipelines
- ✅ Property names handled automatically
- ✅ MaterialPropertyBlock works in both pipelines
- ✅ Timeline integration identical in URP and Built-in

Potions with the property "Fill Amount" at 0, 0.5 and 1 respectively

### 5.3 MaterialIndexController

File: `MaterialIndexController.cs`

Purpose: Enables independent gradient animation per material slot in Timeline

Pipeline Support: Fully compatible with URP and Built-in

#### Component Properties

Property | Type | Description
--- | --- | ---
Index Material 0 | Float | Gradient index for material slot 0
Index Material 1 | Float | Gradient index for material slot 1
Index Material 2 | Float | Gradient index for material slot 2
Index Material 3 | Float | Gradient index for material slot 3

MaterialIndexController component showing independent gradient index sliders for multiple materials

#### When to Use

OPTIONAL for single material objects:

- Provides convenient slider for `_GradientIndex`
- Can animate directly via `Renderer > Material > _GradientIndex` instead - ⚠️If you don't see the material changing when animated you may need to Play/Stop to see the result

REQUIRED for multi-material objects:

- Without it, Timeline animates `_GradientIndex` on ALL materials together
- With it, each material slot can have independent animation

#### How It Works

1. Detects materials with `_GradientIndex` property
2. Checks if using Material Instances (required for Timeline)
3. Applies index values using MaterialPropertyBlock or Material Instances
4. Updates only when values change (performance optimized)
5. Pipeline-agnostic - works with both URP and Built-in shaders

#### Custom Inspector Features

Automatic Detection:

- Shows material count with `_GradientIndex`
- Displays helpful info messages
- Warns if Material Instances are not created
- No pipeline-specific warnings needed

Timeline Instructions:

- Provides step-by-step animation guide
- Different instructions for single vs multiple materials
- Identical workflow in URP and Built-in

#### Setup Workflow

Step 1: Create Material Instances

1. Find 'PotionTextureSetup' component
2. Click 'Prepare for Timeline' button
3. Material Instances will be created automatically

Step 2: Add MaterialIndexController

1. Add MaterialIndexController.cs component to the GameObject
2. Adjust individual index sliders
3. Each material now has independent control

Step 3: Animate in Timeline

1. Create Animation Track in Timeline
2. Drag GameObject to track
3. Add properties: 'Index Material 0', 'Index Material 1', etc. (or enable recording and change the slider values)
4. Each material animates independently!

### 5.4 ClearGrayscaleTextures (Optional Utility)

File: `ClearGrayscaleTextures.cs`

Type: Editor-only utility tool

Purpose: Clears `_GrayscaleTex` from material previews

Location: Tools > MesshingAround > Clear GrayscaleTex from Materials

#### What It Does

This optional editor tool removes the `_GrayscaleTex` property from all materials in your project. This is purely cosmetic and affects only the material preview thumbnails in the Project window.

#### When to Use

Use this tool if:

- ✅ Material previews show unwanted UV patterns
- ✅ You prefer clean, gradient-colored previews
- ✅ You have TOC (perfectionism) about material appearance

DO NOT use if:

- ❌ You're actively testing materials
- ❌ You don't mind the grayscale texture in previews
- ❌ You're worried about accidentally breaking materials

#### How It Works

1. Opens editor window: `Tools > MesshingAround > Clear GrayscaleTex from Materials`
2. Scans ALL materials in project
3. Finds materials with `_GrayscaleTex` property
4. Sets texture to null (clears it)
5. Saves changes to project

#### Safety Features

Warnings Displayed:

- ⚠️ Material Instances: May need to be recreated after clearing
- ⚠️ White Materials: Scene materials appear white until Play Mode
- ⚠️ Project-Wide: Affects ALL materials with `_GrayscaleTex`

Confirmation Dialog:

- Requires explicit confirmation before running
- Shows clear warnings about consequences
- Option to cancel at any time

#### After Running

Expected Behavior:

1. Material previews in Project window: Clean, gradient-colored
2. Materials in scene: May appear white temporarily
3. Runtime behavior: Unchanged - PotionTextureSetup re-applies textures automatically

Recovery Steps:

1. Enter Play Mode and Stop (refreshes materials)
2. If still white, re-assign material to Renderer
3. If using Timeline, re-run "Prepare for Timeline" if needed

#### Important Notes

This Tool is OPTIONAL:

- ✅ Core functionality works WITHOUT using this tool
- ✅ It's purely for visual cleanliness in Editor
- ✅ Does NOT affect runtime behavior
- ✅ PotionTextureSetup will re-apply textures at runtime

This Tool is INTRUSIVE:

- ⚠️ Modifies materials project-wide
- ⚠️ Cannot be undone (backup recommended)
- ⚠️ May require manual fixes for Material Instances

When NOT to Use:

- Never use mid-production without backup
- Don't use if you're unfamiliar with material system
- Avoid if you have custom workflows dependent on `_GrayscaleTex`

#### Pipeline Compatibility

- ✅ Works with both URP and Built-in materials
- ✅ Detects `_GrayscaleTex` property in any shader
- ✅ No pipeline-specific behavior

## 6. Setup from Scratch

### 6.1 Texture Configuration

Grayscale textures must be configured correctly for the gradient system to work.

#### Import Settings

    Texture Type: Single Channel
    Texture Shape: 2D
    Channel: Red
    Advanced:
      Generate Mip Maps: OFF  ⚠️ CRITICAL
      Wrap Mode: Clamp
      Filter Mode: Point (no filter)

      Max Size: 1024 (or your textures resolution)
      Format: Automatic
      Resize Alhorithm: Mitchell
      Compression: None  ⚠️ CRITICAL

    Why: We use the R channel to calculate where the gradients should be painted.
    Advanced and Compression settings will distort or generate visual errors if not configured like that.

CRITICAL: Grayscale texture settings

#### Why These Settings Matter

- Generate Mip Maps OFF: Prevents color banding in gradient lookup
- Wrap Mode Clamp: Prevents edge bleeding in LUT sampling
- Filter Mode Point: Sharp gradient transitions (stylized look)
- Compression None: Preserves grayscale accuracy

### 6.2 Model Import Settings

#### ⚠️ CRITICAL: Read/Write Must Be ON

    Model Import Settings:
    Meshes:
      ✓ Read/Write: ON  ⚠️ CRITICAL FOR LIQUID SHADER

    Why: Liquid.cs needs mesh access to calculate fill position
    Trade-off: Increases memory usage by ~20% per model
    Required: For liquid physics to work in BOTH pipelines

### 6.3 Material Creation

#### Shader Assignment by Pipeline

Material Type | URP Shader | Built-in Shader
--- | --- | ---
Cork/Metal/Leather... | Stylized Tint (URP) | Stylized Tint (Built-in)
Semi-Transparent materials | Stylized Tint OP (URP) | Stylized Tint OP (Built-in)
Glass, Plastic bottle... | Stylized Glass (URP) | Stylized Glass (Built-in)
Liquids | Liquid Effect (URP) | Liquid Effect (Built-in)

## 7. Timeline Animation

Animate potions dynamically using Unity's Timeline system. Works identically in both URP and Built-in!

### 7.1 Setup Timeline

Create and configure a Timeline sequence.

#### Timeline Creation

1. Create Timeline Asset

1. Select GameObject in Hierarchy
2. Window > Sequencing > Timeline
3. Click "Create" in Timeline window
4. Save as: [Name]_Timeline

2. Add Animation Track

1. Click "+" in Timeline window
2. Select "Animation Track"
3. Drag GameObject to track (binds automatically)

3. Record Animation

1. Click red Record button
2. Move playhead to desired time
3. Adjust properties in Inspector
4. Keyframes created automatically

Timeline window showing animation tracks for potion color transitions

Pipeline Note: Property animations works identically in URP and Built-in

### 7.2 Material Instances

Material Instances are required for Timeline to animate material properties.

#### Why Material Instances?

#### Without Instances

- Timeline modifies the SHARED material asset
- All objects using that material change together
- Changes affect ALL objects in the project
- Cannot animate different objects independently

#### With Instances

- Timeline creates unique material copies per object
- Each object has independent material properties
- Instances are SAVED with scene/prefab (persistent)
- Can animate different colors/properties per potion

#### Important: Material Instances are Persistent

When you create material instances using the "Prepare for Timeline" button:

- ✅ Instances are saved with the scene/prefab
- ✅ They persist after scene reload
- ✅ They work in both Edit Mode and Play Mode
- ✅ You can animate them in Timeline immediately
- ✅ Changes are not temporary - they're permanent scene data

#### When Instances ARE Temporary

Material instances are only temporary when created at runtime by code (not by Timeline):

- If a script creates instances during Play Mode
- These instances are destroyed when Play Mode stops
- This does NOT apply to instances created with "Prepare for Timeline"

#### Creating Material Instances

Automatic Method (Recommended):

1. Select GameObject with Renderer
2. Find PotionTextureSetup component
3. Click "Prepare for Timeline" button
4. Material Instances created automatically

Manual Method:

1. Select GameObject in Hierarchy
2. Inspector > Renderer > Materials
3. Drag material from Project to material slot
4. Unity creates instance automatically if needed for Timeline

#### Material Instance Behavior

When Created with "Prepare for Timeline":

- Instances are saved with scene/prefab
- Persist after scene reload
- Can be animated in Timeline immediately
- "(Instance)" suffix appears in material name

In Play Mode:

- Instances work identically to Edit Mode
- Timeline can modify properties freely
- Changes are visible in real-time

#### ✅ Benefits of Material Instances

- Each object can have different animated properties
- No conflicts between Timeline animations on different objects
- Original shared material remains unchanged
- PotionTextureSetup manages instances automatically

#### Removing Material Instances

If you want to restore the original shared materials:

1. Select GameObject
2. Find PotionTextureSetup component
3. Click "Remove Instances" button
4. Original materials restored

#### When to Remove Instances

- ⚠️ Object doesn't need Timeline animation
- ⚠️ Want to save memory (instances use slightly more memory)
- ⚠️ Want changes to affect all objects sharing the material
- ✅ Use "Remove Instances" button to restore shared materials

#### Pipeline Compatibility

- ✅ Material Instances work in both URP and Built-in
- ✅ Same workflow for both pipelines
- ✅ No pipeline-specific considerations

### 7.3 MaterialIndexController Usage

Use MaterialIndexController to animate gradients independently per material.

#### Single Material (Optional)

For objects with only 1 material:

Without MaterialIndexController:

    Timeline > Animation Track
    Animate: Renderer > Material > _GradientIndex
    Works in both URP and Built-in
    ⚠️ If you generate keys with this method and and the animations doesn't work, make a play/stop to fix it.

With MaterialIndexController:

    Timeline > Animation Track
    Animate: MaterialIndexController > Index Material 0
    (Provides cleaner inspector slider)
    Identical in both pipelines

#### Multiple Materials (Required)

For objects with 2+ materials that need independent gradient animation:

Setup:

1. Add MaterialIndexController component
2. Create Material Instances (Prepare for Timeline)
3. Timeline > Animation Track
4. Animate:
   - Index Material 0 (Cork gradient)
   - Index Material 1 (Metal gradient)
   - Index Material 2 (Liquid gradient)
   - etc.

#### Without MaterialIndexController

- All materials change to same gradient together
- Cannot animate independently

#### With MaterialIndexController

- Each material slot has independent control
- Full creative control

#### Animation Example

Health → Poison Transition:

    Time 0s:
      Index Material 0 (Cork): 10 (Red cork)
      Index Material 1 (Liquid): 28 (Red liquid)

    Time 2s:
      Index Material 0 (Cork): 15 (Green cork)
      Index Material 1 (Liquid): 42 (Green liquid)

    Result: Color changes over 2 seconds
    Works identically in URP and Built-in!

    (note, as you are animating a float value, you are not animating a smooth color transition, we recommend
    to select keys and r.click > both tangents > Constant to change from initial color to desired one,
    otherwise you will step into every index float between your initial color and the final one.)

#### Timeline Animation Tips

Preview in Edit Mode:

- Timeline preview can be unreliable with Material Instances
- Always test in Play Mode for accurate results
- Same limitation in both URP and Built-in

Pipeline Note: Timeline integration is 100% identical in URP and Built-in

### 7.5 Understanding Gradient Index Animation

#### ⚠️ CRITICAL: How Gradient Index Works

_GradientIndex is NOT a color value - it's an integer selector for which gradient row to use from the texture.

Each gradient is completely different from the next one. There is NO smooth color transition possible when animating the index.

#### The Problem with Default Timeline Interpolation

When you create keyframes in Timeline, Unity uses Linear interpolation by default. This causes major issues with gradient index animation.

#### ❌ What Happens (Default Behavior)

Timeline Setup:

    Keyframe 1: Index 23 (at 0s)
    Keyframe 2: Index 60 (at 2s)

What Actually Happens:

    0.0s → Index 23
    0.05s → Index 24
    0.10s → Index 25
    0.15s → Index 26
    ...
    1.95s → Index 59
    2.0s → Index 60

Result: The material rapidly flickers through 37 completely different gradients in 2 seconds. This looks chaotic and broken because each gradient has totally different colors.

#### ✅ What You Actually Want

Timeline Setup (Fixed):

    Keyframe 1: Index 23 (at 0s) [Constant]
    Keyframe 2: Index 60 (at 2s)

What Actually Happens:

    0.0s → Index 23
    ...
    1.99s → Index 23
    2.0s → Index 60 (instant jump)

Result: Material stays at Index 23 for 2 seconds, then instantly changes to Index 60 at exactly 2 seconds. This is the correct behavior.

#### How to Fix This: Constant Interpolation

ALWAYS use Constant interpolation for gradient index keyframes:

1. Open Timeline window
2. Find your gradient index keyframes
3. Right-click on the FIRST keyframe of the pair
4. Select "Both Tangents → Constant"
5. The keyframe will change from a diamond shape to a square shape

#### Visual Indicator

After setting to Constant, the Timeline curve will show:

- A flat horizontal line (no slope)
- A sudden vertical jump at the keyframe time
- Square-shaped keyframe icon instead of diamond

This confirms the index will hold its value until the keyframe, then instantly jump to the next value.

#### Example: Brewing Animation

Correct Setup with Instant Changes:

    Timeline Track: MaterialIndexController - "Index Material 3" (Liquid)

    0.0s  → Index 60  (Grass_Dark)      [Constant tangent]
    1.0s  → Index 75  (Arcane_Purple)   [Constant tangent]
    2.0s  → Index 90  (Blood_Crimson)   [Constant tangent]
    3.0s  → Index 31  (Gem_Sapphire)

    Result:
    - Green liquid for 1 second
    - Instant change to purple for 1 second
    - Instant change to red for 1 second
    - Instant change to blue

#### Why Can't You Make Smooth Color Transitions?

Because you're not animating a color - you're animating which gradient texture row to read.

Example gradients in sequence:

- Index 23: Metal_Obsidian (black)
- Index 24: Metal_RoseGold (pink)
- Index 25: Cork_Light (tan)
- Index 26: Cork_Dark (brown)

These are completely unrelated colors. Animating from 23 to 26 will just flicker through black → pink → tan → brown rapidly. There is no "smooth transition" possible.

#### What If I Need Smooth Color Transitions?

If you need a smooth fade between two colors, you have two options:

#### Option 1: Animate Color Properties Directly

Instead of animating `_GradientIndex`, animate the shader's color properties in Timeline:

- Animate `Top Color` in the liquid material
- Animate `Bottom Color` in the liquid material
- This gives you smooth RGB color transitions
- Requires Material Instances (cannot use MaterialPropertyBlock)

#### Option 2: Create Custom Gradient Rows

Edit the LUT texture to add a custom sequence of gradients that fade smoothly:

- Add new rows to the gradient texture with colors that gradually transition
- Example: Row 110 = Red, Row 111 = Red-Orange, Row 112 = Orange, etc.
- Then animate Index 110 → 115 with Linear interpolation
- See Section 8.1 - Custom Gradient Colors

#### Summary

- ✅ ALWAYS use Constant interpolation for gradient index keyframes
- ✅ Right-click keyframe → Both Tangents → Constant
- ✅ This creates instant jumps between gradients (correct behavior)
- ❌ Linear interpolation causes chaotic flickering (wrong behavior)
- ❌ You cannot make smooth color transitions by animating the index
- 💡 For smooth fades: animate color properties directly, not the index

## 8. Advanced Topics

### 8.1 Custom Gradients (LUT)

Add your own gradient colors to the LUT texture.

#### LUT Structure

Current LUT: 256x110 pixels

- Width (256px): Gradient transition (color spectrum)
- Height (110px): 110 different gradients (rows 0-109)

#### Adding New Gradients

Method 1: Modify Existing LUT

1. Open: Textures/LUT_textures/GradientLUT_256x110.tga
2. Image editor: Photoshop, GIMP, Krita, etc.
3. Add new row at top (add a 1px height) (increases height to 111px)
4. Paint gradient ONLY in that new pixel line: Left → Right (desired colors)
5. Save as .TGA/PNG file
6. Reimport to Unity
7. ⚠️ Update _GradientCount in ALL materials: 111
8. New gradient accessible at index 110
9. If you want to permanently save the 111 index count, you must edit the shaders default value from 110 to 111 (or more if you created new ones)

Method 2: Create New LUT

1. Create image: 256x[N] pixels (N = number of gradients)
2. Each row (px)= one gradient
3. Each gradient: 256 pixel horizontal transition
4. Create a new gradient from left to right
5. Save as .TGA/PNG
6. Import to Unity with correct settings
7. Update _GradientCount in all materials

#### LUT Texture Settings

    Texture Type: Default (Color Texture)
    Texture Shape 2D
    sRGB: ON (for color accuracy)
    Alpha Source: None
    Advanced:
    Non-Powe of 2: None ⚠️ CRITICAL
    Generate Mip Maps: OFF ⚠️ CRITICAL
    Wrap Mode: Clamp
    Filter Mode: Point (no filter)
    Max Size: Match texture dimensions
    Resize: Mitchell
    Format: Automatic
    Compression: None

Pipeline Note: LUT texture settings are IDENTICAL for URP and Built-in

#### Gradient Design Tips

Stylistic Consistency:

- Match art style of existing gradients
- Consider color harmony across all gradients
- Test in various lighting conditions

Technical Requirements:

- Smooth transitions (avoid hard edges)
- 256 pixels wide minimum (can be wider)

#### Using Custom Gradients

1. Assign new LUT to material: _GradientTexture or _GradientTexture_LUT
2. Update _GradientCount to match new row count
3. Set _GradientIndex to new gradient row
4. Test across all material types
5. Works in both URP and Built-in automatically!

### 8.2 Custom 3D Models

Use your own 3D models with the potion shader system.

#### Model Requirements

Geometry:

- Low-poly recommended: 500-2000 tris (performance)
- Clean topology: Avoid ngons, overlapping faces
- Proper normals: Smooth where needed

UV Mapping:

- Channel 0 (UVMap): Required for texture projection
- Proper unwrapping: Minimal stretching
- 0-1 UV space: No negative or >1 UVs

Materials:

- One material slot per visual component
- Example: Cork, Metal, Glass, Liquid = 4 slots

#### Workflow

Step 1: Modeling (Blender/Maya/3ds Max)

1. Model bottle shape
2. Separate components: Cork, Glass, Liquid
3. UV unwrap each component
4. Export as FBX:
   - Apply modifiers
   - Triangulate
   - Y-up, -Z forward

Step 2: Unity Import

1. Import FBX to Unity
2. Model import settings:
   - ✓ Read/Write: ON (for liquid shader)
   - ✓ Generate Colliders: Optional

Step 3: Texture Creation

1. Bake AO/curvature to grayscale texture or directly handpaint textures 1 difusse/base color map
2. Hand-paint details in grayscale
3. Save as 1024x1024 .TGA
4. Import to Unity with proper settings (see 5.1)

Step 4: Material Assignment (Choose Pipeline)

For URP:

1. Create materials with URP shaders
2. Assign:
   - Cork, Metal, other materials you've created: Stylized Tint / Stylized Tint OP (URP)
   - Glass: Stylized Glass (URP)
   - Liquid: Liquid Effect (URP)
3. Assign textures and LUT
4. Set _GradientIndex

For Built-in:

1. Create materials with Built-in shaders
2. Assign:
   - Cork, Metal, other materials you've created: Stylized Tint / Stylized Tint OP (URP)
   - Glass: Stylized Glass (Built-in)
   - Liquid: Liquid Effect (Built-in)
3. Assign textures and LUT
4. Set _GradientIndex

Step 5: Script Setup

1. Add PotionTextureSetup to all meshes you have (assign grayscale texture)
2. Add Liquid.cs component to your Liquid material
3. Configure Fills ranges
4. Test wobble physics

Pipeline: Scripts work identically in both!

#### Special Considerations

Liquid Mesh Shape:

Liquid Mesh Shape:

- Should match interior of bottle
- Slightly smaller than glass mesh (no z-fighting)
- Flat top surface for clean fill line

Glass Transparency:

- Avoid excessive overlap (sorting issues)
- Keep geometry simple
- Test from multiple angles

Cork/Cap:

- Can be separate GameObject (easy to hide/show)
- Add hinge joint for physics interaction

#### Testing Checklist

- ✓ Liquid fills from bottom to top correctly
- ✓ Wobble physics feel natural
- ✓ Gradient colors display properly
- ✓ Glass transparency sorts correctly
- ✓ Performance acceptable (draw calls, tris)
- ✓ Works in target pipeline (URP or Built-in)

Pipeline Note: Custom models work identically in URP and Built-in once appropriate materials are assigned.

### 8.3 MaterialPropertyBlock (MPB)

#### ✅ Automatic - No Configuration Needed

MaterialPropertyBlock is already integrated into all scripts and works automatically. You don't need to enable, disable, or configure anything - it just works out of the box for optimal performance.

#### What is MaterialPropertyBlock?

MaterialPropertyBlock (MPB) is Unity's built-in system for:

- Overriding material properties per-renderer
- Without creating material copies
- Maintaining GPU Instancing batching
- Reducing draw calls significantly

#### Why This Matters for Performance

Without MPB:

- 100 potions with different colors = 100 material instances = 200-300 draw calls
- Each potion needs its own material copy (~5KB each)
- High memory usage and poor batching

With MPB (automatic in this package):

- 100 potions with different colors = 1 shared material = ~10-15 draw calls (GPU instanced)
- All potions share the same material (~5KB total)
- Excellent performance and memory efficiency

#### How This Package Uses MPB Automatically

Liquid.cs uses MPB to update liquid physics in real-time:

    // Automatically updates wobble and fill without material copies
    mpb.SetFloat("_WobbleX", wobbleAmountX);
    mpb.SetFloat("_WobbleZ", wobbleAmountZ);
    mpb.SetVector("_FillAmount", fillPosition);
    renderer.SetPropertyBlock(mpb);

MaterialIndexController.cs uses MPB for gradient color changes:

    // Automatically updates gradient index per object
    mpb.SetFloat("_GradientIndex", currentIndex);
    renderer.SetPropertyBlock(mpb, materialSlot);

PotionTextureSetup.cs uses MPB to assign textures:

    // Automatically assigns grayscale texture per object
    mpb.SetTexture("_GrayscaleTex", grayscaleTexture);
    renderer.SetPropertyBlock(mpb);

#### Automatic Detection System

Smart Timeline Detection:

The scripts automatically detect if you're using Timeline animation and adapt accordingly:

- ✅ No Timeline: Uses MaterialPropertyBlock (best performance)
- ✅ Timeline Detected: Switches to Material Instances automatically
- ✅ Detection checks for "(Instance)" suffix in material names
- ✅ No manual configuration required

#### MPB vs Material Instances - Automatic Handling

Feature | MaterialPropertyBlock | Material Instances
--- | --- | ---
Performance | ✅ Best (GPU Instancing) | ⚠️ Good (more draw calls)
Memory Usage | ✅ Low (shared material) | ⚠️ Higher (material copies)
Timeline Animation | ❌ Not compatible | ✅ Required
Runtime Changes | ✅ Very efficient | ✅ Works
Configuration | ✅ Automatic (default) | ✅ Automatic (when Timeline detected)

#### When Each System is Used

#### MaterialPropertyBlock (Default)

Automatically used when:

- No Material Instances detected
- Runtime gameplay (not Timeline animation)
- Scripts modify properties via code

Best for:

- Performance-critical scenarios
- Many objects with shared materials
- Runtime color/property changes

#### Material Instances (Timeline)

Automatically used when:

- "Prepare for Timeline" button clicked
- Material name contains "(Instance)"
- Timeline animation required

Best for:

- Timeline property animation
- Per-object persistent changes
- Keyframe-based animations

#### MPB Limitations (Technical Info)

While MPB is excellent for performance, it has some technical limitations:

- ❌ Cannot animate with Timeline directly (scripts detect this and switch automatically)
- ❌ Changes don't persist in Editor (only during Play Mode)
- ❌ Not visible in Material Inspector
- ⚠️ Harder to debug (no visual feedback in Inspector)

Solution: This package handles these limitations automatically by switching to Material Instances when Timeline is detected.

#### Pipeline Compatibility

MaterialPropertyBlock works identically in both render pipelines:

- ✅ Universal Render Pipeline (URP)
- ✅ Built-in Render Pipeline
- ✅ No code changes needed between pipelines
- ✅ GPU Instancing compatible in both
- ✅ Same performance benefits in both

#### Summary: You Don't Need to Do Anything

MaterialPropertyBlock is fully integrated and automatic:

- ✅ Works out of the box with zero configuration
- ✅ Provides best performance by default
- ✅ Automatically switches to Material Instances when Timeline is used
- ✅ Compatible with both URP and Built-in
- ✅ Just use the scripts normally - MPB handles optimization behind the scenes

### 8.4 Pipeline Migration

Switch between URP and Built-in without losing work.

#### URP → Built-in Migration

Step 1: Backup Project

1. Duplicate entire Unity project folder
2. Test migration on duplicate first

Step 2: Remove URP

1. Project Settings > Graphics
2. Remove URP Renderer asset
3. Set to Built-in Render Pipeline
4. Window > Package Manager
5. Remove Universal RP package

Step 3: Replace Materials

1. Find all materials using URP shaders
2. For each material:
   - Note current _GradientIndex and settings
   - Assign equivalent Built-in shader:
     - Stylized Tint → Stylized Tint (Built-in)
     - Stylized Tint OP → Stylized Tint OP (Built-in)
     - Stylized Glass → Stylized Glass (Built-in)
     - Liquid Effect → Liquid Effect (Built-in)
   - Reapply settings and gradient index

Step 4: Update Demo Scene

1. Use DemoScene_BuiltIn instead of DemoScene_URP
2. Install Post Processing Stack v2 if needed
3. Configure Post Process Profile

Step 5: Test

- ✓ All potions render correctly
- ✓ Liquid wobble works
- ✓ Timeline animations function
- ✓ Colors match previous URP version

#### Built-in → URP Migration

Step 1: Backup Project

1. Duplicate entire Unity project folder
2. Test migration on duplicate first

Step 2: Install URP

1. Window > Package Manager
2. Install "Universal RP"
3. Create URP Asset:
   - Right-click > Create > Rendering > URP Asset
4. Project Settings > Graphics
5. Assign URP Asset to Scriptable Render Pipeline Settings

Step 3: Replace Materials

1. Find all materials using Built-in shaders
2. For each material:
   - Note current _GradientIndex and settings
   - Assign equivalent URP shader:
     - Stylized Tint (Built-in) → Stylized Tint
     - Stylized Tint OP (Built-in) → Stylized Tint OP
     - Stylized Glass (Built-in) → Stylized Glass
     - Liquid Effect (Built-in) → Liquid Effect
   - Reapply settings and gradient index

Step 4: Update Demo Scene

1. Use DemoScene_URP instead of DemoScene_BuiltIn
2. Remove Post Processing Stack v2 components
3. Add Volume component for URP post-processing

Step 5: Test

- ✓ All potions render correctly
- ✓ Liquid wobble works
- ✓ Timeline animations function
- ✓ Colors match previous Built-in version

#### Property Name Mapping

When migrating, be aware of property name differences:

Liquid Effect Shader:

    Built-in Property → URP Property
    _LUTTex → _GradientTexture
    _Tint → _BottomColor
    _Line → _FoamWidth
    _LineSmooth → _Foam_Smoothness
    _Freq → _Frequency
    _RimPower → _Rim_Power
    _RimColor → _Rim_Color

Stylized Tint:

    Built-in Property → URP Property
    _GradientTexture → _GradientTexture_LUT
    _Smoothness → _Smoothness_Glossy

Important: Scripts handle property name differences automatically. Manual adjustment only needed for material assets.

### 8.5 Gradient Reference - 110 Colors

The pack includes 110 pre-made gradient colors organized into 8 thematic categories. All gradients work identically in both URP and Built-in pipelines.

#### How to Use Gradients

- Set `_GradientIndex` property to the number (0-109)
- Animate via Timeline using MaterialIndexController
- Change at runtime via MaterialPropertyBlock

#### LEATHERS (1-10)

Index | Name | Description
--- | --- | ---
0 | Leather_DarkBrown | Rich dark brown leather
1 | Leather_Reddish | Warm reddish-brown leather
2 | Leather_WornGrey | Aged grey weathered leather
3 | Leather_LightTan | Light tan natural leather
4 | Leather_Olive | Greenish olive leather
5 | Leather_CoolGrey | Cool-toned grey leather
6 | Leather_Mahogany | Deep mahogany brown
7 | Leather_Yellowed | Aged yellowed leather
8 | Leather_Charcoal | Dark charcoal leather
9 | Leather_DeepWine | Rich wine-colored leather

#### METALS (11-25)

Index | Name | Description
--- | --- | ---
10 | Metal_IronDark | Dark iron grey
11 | Metal_Steel | Standard steel grey
12 | Metal_SilverPolished | Bright polished silver
13 | Metal_Gold | Classic gold
14 | Metal_Bronze | Warm bronze
15 | Metal_Copper | Reddish copper
16 | Metal_RustyIron | Oxidized rusty iron
17 | Metal_ColdSteelBlue | Blue-tinted cold steel
18 | Metal_DarkSilver | Tarnished dark silver
19 | Metal_Platinum | Bright platinum
20 | Metal_Gunmetal | Dark gunmetal grey
21 | Metal_Pewter | Dull pewter grey
22 | Metal_VerdigrisCopper | Green-patina copper
23 | Metal_Obsidian | Black obsidian metal
24 | Metal_RoseGold | Pink rose gold

#### CORKS (26-30)

Index | Name | Description
--- | --- | ---
25 | Cork_Light | Natural light cork
26 | Cork_Dark | Dark aged cork
27 | Cork_Weathered | Weathered greyish cork
28 | Cork_Red | Reddish-tinted cork
29 | Cork_Ashen | Ashy grey cork

#### GEMS (31-45)

Index | Name | Description
--- | --- | ---
30 | Gem_Ruby | Deep red ruby
31 | Gem_Sapphire | Rich blue sapphire
32 | Gem_Emerald | Vibrant green emerald
33 | Gem_Amethyst | Purple amethyst
34 | Gem_Amber | Warm orange amber
35 | Gem_TopazBlue | Blue topaz
36 | Gem_Citrine | Yellow citrine
37 | Gem_RoseQuartz | Soft pink quartz
38 | Gem_Onyx | Black onyx
39 | Gem_Aquamarine | Light blue aquamarine
40 | Gem_Garnet | Dark red garnet
41 | Gem_Peridot | Olive green peridot
42 | Gem_Moonstone | Iridescent moonstone
43 | Gem_Turquoise | Bright turquoise
44 | Gem_Obsidian | Glossy black obsidian

#### BONES (46-50)

Index | Name | Description
--- | --- | ---
45 | Bone_Clean | Clean white bone
46 | Bone_Aged | Yellowed aged bone
47 | Bone_Burnt | Charred black bone
48 | Bone_Yellowed | Old yellowed bone
49 | Bone_Dirty | Dirt-stained bone

#### OTHER MATERIALS (51-70)

Index | Name | Description
--- | --- | ---
50 | Wood_DarkOak | Dark oak wood
51 | Wood_Pine | Light pine wood
52 | Wood_Ash | Ashen grey wood
53 | Stone_Basalt | Black basalt stone
54 | Stone_Granite | Grey granite stone
55 | Stone_Sandstone | Warm sandstone
56 | Stone_Marble | White marble
57 | Mud_Wet | Dark wet mud
58 | Mud_Dry | Light dried mud
59 | Sand_Desert | Desert sand tan
60 | Grass_Dark | Dark grass green
61 | Grass_Bright | Bright grass green
62 | Lava_Rock | Dark volcanic rock
63 | Lava_Glow | Glowing lava red
64 | Ice_Clear | Clear ice blue
65 | Ice_Frosty | Frosted white ice
66 | Cloth_Red | Red fabric
67 | Cloth_Blue | Blue fabric
68 | Cloth_White | White fabric
69 | Cloth_Black | Black fabric

#### FANTASY (71-90)

Index | Name | Description
--- | --- | ---
70 | Fairy_Pink_Glow | Glowing magical pink
71 | Ocean_Candy | Sweet ocean blue
72 | Poison_Mist | Toxic green mist
73 | Lava_Burst | Explosive lava orange
74 | Dream_Sky | Dreamy sky blue
75 | Arcane_Purple | Mystical arcane purple
76 | Toxic_Slime | Neon toxic green
77 | Bubblegum | Bright bubblegum pink
78 | Sunset_Mirage | Warm sunset gradient
79 | Frozen_Crystal | Icy crystal blue
80 | Neon_Flame | Electric neon fire
81 | Slime_Shock | Electric slime yellow
82 | Galaxy_Dream | Cosmic galaxy swirl
83 | Arcade_Glow | Retro arcade neon
84 | Crystal_Candy | Crystalline candy colors
85 | Emerald_Fire | Green flame
86 | Magic_Forest | Enchanted forest green
87 | Lightning_Pop | Electric lightning blue
88 | Cosmic_Rainbow | Rainbow cosmic spectrum
89 | Candy_Shock | Shocking candy colors

#### DARK FANTASY (91-110)

Index | Name | Description
--- | --- | ---
90 | Blood_Crimson | Deep blood red
91 | Cursed_Violet | Dark cursed purple
92 | Rotten_Slime | Decayed green slime
93 | Ashen_Steel | Ashen grey steel
94 | Necrotic_Flesh | Sickly necrotic grey
95 | Wraith_Blue | Spectral wraith blue
96 | Hellfire | Infernal red-orange
97 | Shadow_Curse | Cursed shadow black
98 | Plague_Green | Sickly plague green
99 | Twilight_Ash | Twilight ashen grey
100 | Haunted_Mist | Haunted fog grey
101 | Obsidian | Pure black obsidian
102 | Poison_Fang | Venomous green
103 | Burnt_Bone | Charred bone grey
104 | Phantom_Flame | Ghostly blue flame
105 | Infernal_Bronze | Hellish bronze
106 | Abyssal_Deep | Deepest abyss black-blue
107 | Corrupted_Gold | Tainted gold
108 | Ethereal_Frost | Ghostly ice blue
109 | Soulfire | Spiritual blue-white fire

#### Adding Custom Gradients

See Section 8.1 - Custom Gradient Colors for instructions on adding your own gradients to the LUT texture.

## 9. Use Cases & Examples

### 9.1 Health/Mana Potions

Create classic RPG potions with distinct colors using the gradient system.

#### Health Potion (Red)

Materials (Works in Both Pipelines):

- Cork: Index 28 (Cork_Red)
- Metal: Index 10-12 (Metal_IronDark, Metal_Steel, or Metal_SilverPolished)
- Glass: Index 30 (Gem_Ruby) with Alpha: 0.1-0.2 for red tint
- Liquid: Index 30 (Gem_Ruby) or Index 90 (Blood_Crimson)

#### Glass Transparency Settings

For the glass material, set the `_Alpha` property to a low value (0.1-0.2) to see the liquid inside while maintaining a subtle color tint. Higher alpha values will make the glass more opaque.

Liquid Settings:

    Top Color: Bright Red (#FF3030)
    Bottom Color / Tint: Dark Red (#8B0000)
    Foam Color: Pink (#FFB6C1)
    Fill Amount: 0.8 (80% full)

#### Mana Potion (Blue)

Materials (Works in Both Pipelines):

- Cork: Index 25 (Cork_Light) or Index 26 (Cork_Dark)
- Metal: Index 12 (Metal_SilverPolished) or Index 19 (Metal_Platinum)
- Glass: Index 31 (Gem_Sapphire) with Alpha: 0.1-0.2 for blue tint
- Liquid: Index 31 (Gem_Sapphire) or Index 95 (Wraith_Blue)

Liquid Settings:

    Top Color: Bright Blue (#00BFFF)
    Bottom Color / Tint: Deep Blue (#000080)
    Foam Color: Cyan (#00FFFF)
    Fill Amount: 0.75 (75% full)
    Rim Color: Electric Blue (glow effect)

#### Alternative Color Schemes

#### Stamina Potion (Green)

- Cork: Index 4 (Leather_Olive)
- Metal: Index 14 (Metal_Bronze)
- Glass: Index 32 (Gem_Emerald), Alpha 0.15
- Liquid: Index 32 (Gem_Emerald)

#### Poison Potion (Toxic Green)

- Cork: Index 29 (Cork_Ashen)
- Metal: Index 23 (Metal_Obsidian)
- Glass: Index 76 (Toxic_Slime), Alpha 0.2
- Liquid: Index 72 (Poison_Mist) or 98 (Plague_Green)

#### Magic Potion (Purple)

- Cork: Index 9 (Leather_DeepWine)
- Metal: Index 13 (Metal_Gold)
- Glass: Index 33 (Gem_Amethyst), Alpha 0.15
- Liquid: Index 75 (Arcane_Purple) or 91 (Cursed_Violet)

#### Fire Potion (Orange)

- Cork: Index 8 (Leather_Charcoal)
- Metal: Index 16 (Metal_RustyIron)
- Glass: Index 34 (Gem_Amber), Alpha 0.2
- Liquid: Index 73 (Lava_Burst) or 96 (Hellfire)

#### Implementation

Static Setup (In Editor):

1. Create prefab variant: `Potion_Health_[Pipeline]`
2. Assign materials with appropriate gradient indices
3. Configure liquid colors in Inspector
4. Set fill amount and alpha values
5. Save prefab

Runtime Switching (Via Script):

    // Health potion setup
    MaterialIndexController controller = GetComponent<MaterialIndexController>();
    controller.indexMaterial0 = 28;  // Cork_Red (cork material)
    controller.indexMaterial1 = 10;  // Metal_IronDark (metal cap)
    controller.indexMaterial2 = 30;  // Gem_Ruby (glass with low alpha)
    controller.indexMaterial3 = 30;  // Gem_Ruby (liquid)

    // Mana potion setup
    controller.indexMaterial0 = 25;  // Cork_Light
    controller.indexMaterial1 = 12;  // Metal_SilverPolished
    controller.indexMaterial2 = 31;  // Gem_Sapphire (glass with low alpha)
    controller.indexMaterial3 = 31;  // Gem_Sapphire (liquid)

    // Works identically in URP and Built-in!

#### Important: Glass Alpha Setting

The glass material has a separate `_Alpha` property that controls transparency:

- Alpha 0.0: Fully transparent (invisible glass, inner/outer rims and specular stills shows, shows liquid)
- Alpha 0.1-0.2: Subtle tint (recommended for colored potions)
- Alpha 0.5: Semi-opaque (strong color tint)
- Alpha 1.0: Fully opaque (solid colored glass)

Adjust this value to control how visible the glass is while maintaining the gradient color tint.

#### Pipeline Compatibility

Colors and gradients work identically in both URP and Built-in pipelines. The same gradient indices produce the same colors regardless of which render pipeline you're using. You can even migrate projects between pipelines without changing gradient settings!

#### Quick Reference: Common Potion Colors

Potion Type | Liquid Index | Glass Index (Low Alpha)
--- | --- | ---
Health (Red) | 30 (Gem_Ruby) or 90 (Blood_Crimson) | 30, Alpha 0.15
Mana (Blue) | 31 (Gem_Sapphire) or 95 (Wraith_Blue) | 31, Alpha 0.15
Stamina (Green) | 32 (Gem_Emerald) or 86 (Magic_Forest) | 32, Alpha 0.15
Poison (Toxic) | 76 (Toxic_Slime) or 98 (Plague_Green) | 76, Alpha 0.2
Magic (Purple) | 75 (Arcane_Purple) or 91 (Cursed_Violet) | 33, Alpha 0.15
Fire (Orange) | 73 (Lava_Burst) or 96 (Hellfire) | 34, Alpha 0.2

See Section 8.5 - Gradient Reference for complete list of 110 gradients.

### 9.2 Crafting System

Animate potion brewing process using Timeline with instant color changes and smooth fill animations.

#### Brewing Animation Sequence

Phase 1: Empty Bottle (0-2s)

    Fill Amount: 0
    Glass: Clear
    Liquid: Any gradient (not visible when empty)

Phase 2: Base Ingredient Appears (2-4s)

    Fill Amount: 0 → 0.3 (smooth animation)
    Liquid Gradient: Index 60 (Grass_Dark - green base)
    Timeline: Animate Fill Amount smoothly

Phase 3: Instant Color Change (4s exactly)

    Fill Amount: 0.3 → 0.6 (smooth animation)
    Liquid Gradient: Index 60 → Index 90 (INSTANT change at 4s)
    Timeline: Use Constant interpolation for gradient
    Effect: Ingredient reacts and changes color instantly

Phase 4: Final Product (6-8s)

    Fill Amount: 0.6 → 0.9 (smooth animation)
    Liquid Gradient: Index 90 (Blood_Crimson - health potion)
    Emission: 0 → 1 (glowing effect)
    Cork: Animate position down (seal bottle)

#### ⚠️ Important: Gradient Index Changes Must Be Instant

Remember from Section 7.5: Gradient index is NOT a color value. When changing from Index 60 to Index 90, you MUST use Constant interpolation on the keyframe, otherwise it will flicker through 30 different gradients.

Right-click keyframe → Both Tangents → Constant

#### Timeline Setup (Correct Configuration)

    Track 1 (Liquid.cs Component): Fill Amount
      Keyframe 0s:  0.0   [Linear interpolation OK]
      Keyframe 2s:  0.0   [Linear interpolation OK]
      Keyframe 4s:  0.3   [Linear interpolation OK]
      Keyframe 6s:  0.6   [Linear interpolation OK]
      Keyframe 8s:  0.9   [Linear interpolation OK]

      → Fill amount can use smooth linear interpolation

    Track 2 (MaterialIndexController): Index Material 3 (Liquid)
      Keyframe 2s:  60 (Grass_Dark)      [CONSTANT interpolation]
      Keyframe 4s:  90 (Blood_Crimson)   [CONSTANT interpolation]

      → Gradient changes MUST use constant interpolation
      → Right-click each keyframe → Both Tangents → Constant

    Track 3 (Cork Transform): Position Y
      Keyframe 6s:  0.5 (open position)
      Keyframe 8s:  0.2 (closed/sealed)

      → Cork movement can use smooth linear interpolation

#### What Gets Smooth Animation vs Instant Changes

Property | Interpolation Type | Reason
--- | --- | ---
Fill Amount (0-1) | ✅ Linear (smooth) | Float value, smooth transition looks natural
Gradient Index | ❌ Must be Constant (instant) | Integer selector, interpolation causes flickering
Cork Position | ✅ Linear (smooth) | 3D position, smooth movement looks natural
Emission Intensity | ✅ Linear (smooth) | Float value, smooth glow fade looks good

#### Pipeline Compatibility

This brewing system works identically in both URP and Built-in pipelines:

- ✅ Timeline animation system is pipeline-agnostic
- ✅ Gradient indices produce same colors in both pipelines
- ✅ Fill Amount animation works identically
- ✅ Particle systems compatible with both
- ✅ No code or setup changes needed between pipelines

#### Common Mistake to Avoid

❌ WRONG: Animating gradient index with linear interpolation

    4s: Index 60 [Default Linear]
    6s: Index 90

    Result: Flickers through 30 gradients (60→61→62...→90)

✅ CORRECT: Animating gradient index with constant interpolation

    4s: Index 60 [Constant]
    6s: Index 90

    Result: Stays at 60, then instantly jumps to 90 at exactly 6s

See Section 7.5 - Understanding Gradient Index Animation for detailed explanation.

### 9.3 Shop Display

Create attractive store displays with variety.

#### Display Layout

Shelf Arrangement:

- Row 1: Health potions (all red, different sizes)
- Row 2: Mana potions (all blue, different sizes)
- Row 3: Specialty potions (mixed colors)
- Row 4: Rare potions (glowing, unique colors)

Visual Variety:

- Different bottle shapes (10 models available)
- Different fill amounts (20%, 50%, 80%, 100%)
- Different cork colors (leathers, woods, bones)
- Different metal bands (gold, silver, bronze)

#### Lighting Setup

URP Lighting:

    Directional Light:
      Type: Directional
      Intensity: 1.0
      Color: Warm white
      Angle: 45° from top

    Spot Light (Rim):
      Type: Spot Light
      Intensity: 2.0
      Color: Blue/Cyan (magical feel)
      Range: Adjust per potion

    Environment:
      Skybox: Custom or gradient
      Ambient Source: Skybox
      Reflection Probes: Bake for glass reflections

Built-in Lighting:

    Directional Light:
      Type: Directional
      Intensity: 1.0
      Color: Warm white
      Angle: 45° from top

    Spot Light (Rim):
      Type: Spot Light
      Intensity: 2.0
      Color: Blue/Cyan
      Range: Adjust per potion

    Environment:
      Environment Lighting: Gradient
      Sky Color: Dark purple
      Horizon: Deep blue
      Ambient Mode: Skybox

#### Material Highlighting

Liquid Rim Glow:

    Rim Color: Bright version of liquid color
    Rim Intensity: 0.5-1.0

Cork/Metal Emission (Tint Materials Only):

    Emission Color: Complementary to liquid
    Emission Strength: 0.3-0.5

#### Emission Support

- ✅ Stylized Tint / Tint OP: Full emission support
- ✅ Liquid Effect: Rim glow only and HDR Colors (intensity parameter)
- ❌ Stylized Glass: No emission (UnLit shader)

#### Performance Optimization

Batching:

- Use shared materials where possible
- MaterialPropertyBlock for color variations
- Static batching for non-moving potions
- Works in both URP and Built-in

Culling:

- Frustum culling: Automatic in both pipelines
- Occlusion culling: Bake for complex stores
- Camera far plane: Adjust based on store size

#### URP Optimization

- Use Forward Rendering for transparency
- Enable GPU Instancing on materials
- Configure Universal Renderer settings

#### Built-in Optimization

- Use Forward Rendering path
- Enable GPU Instancing on materials
- Configure Quality Settings

### 9.4 Post-Processing Setup

Add visual polish to your scenes.

#### URP Post-Processing

Setup:

1. Create Volume GameObject in scene
2. Add "Volume" component
3. Check "Is Global"
4. Create Volume Profile asset
5. Add Post-Processing effects

Recommended Effects:

    Bloom:
      Intensity: 0.2-0.5
      Threshold: 1.0
      Scatter: 0.7
      Tint: Slight warm color

    Vignette:
      Intensity: 0.3-0.4
      Smoothness: 0.4
      Rounded: OFF

Camera Setup:

    Main Camera:
      ✓ Post Processing enabled (checked in Camera component)
      ✓ Anti-aliasing: FXAA or SMAA
      ✓ Render Post Processing: ON

#### Built-in Post-Processing

Prerequisites:

1. Install Post Processing Stack v2 via Package Manager (com.unity.postprocessing)

Setup:

1. Create Post-Processing Profile asset
   - Right-click > Create > Post-processing Profile
2. Configure effects in Profile
3. Create empty GameObject in scene
4. Add "Post-process Volume" component
5. Assign Profile to Volume
6. Check "Is Global"
7. Configure Camera

Recommended Effects:

    Bloom:
      Intensity: 2-5
      Threshold: 1.0
      Soft Knee: 0.5
      Diffusion: 7

    Vignette:
      Intensity: 0.3-0.4
      Smoothness: 0.4
      Rounded: OFF

Camera Setup:

    Main Camera:
      Add "Post-process Layer" component
      Layer: Everything
      Anti-aliasing: FXAA or SMAA

#### Important Files

Profile Location: Assets/MesshingAround/PPProfiles/

Demo Profile: StylizedPotions_PostProcess.asset

#### Testing Post-Processing

- ✓ Bloom visible on glowing emission
- ✓ Vignette darkens edges naturally
- ✓ No performance issues
- ✓ Consistent look between pipelines

Pipeline Parity: With similar settings, URP and Built-in can achieve very similar visual results. Adjust intensity values to match appearance.

## 10. Troubleshooting & FAQ

### 10.1 Common Issues and Solutions

#### Liquid Not Moving / Wobble Not Working

Symptoms:

- Liquid surface is static
- No wobble when moving potion
- Fill amount doesn't change

Solutions:

#### Check 1: Read/Write Enabled

    Model import settings:
    ✓ Read/Write: Must be ON
    Location: Inspector > Model > Meshes > Read/Write

    Why: Liquid.cs needs mesh access to calculate fill position
    Fix: Enable Read/Write, click Apply

#### Check 2: Liquid Component

- ✓ Liquid.cs attached to GameObject
- ✓ Mesh assigned (auto-assigned usually)
- ✓ Renderer assigned (auto-assigned usually)

Fix: Remove and re-add Liquid component

#### Check 3: Material Shader

- ✓ Liquid material uses correct Liquid Effect shader
- ✓ URP project: Liquid Effect (URP)
- ✓ Built-in project: Liquid Effect (Built-in)
- ✓ Material assigned to correct mesh/submesh

Fix: Reassign shader, verify material slot

#### Check 4: Script Errors

Check Console for errors (Ctrl+Shift+C)

Common error: "Mesh is not readable"

Fix: Enable Read/Write on model

#### Colors Look Wrong / Gradient Not Applied

Symptoms:

- Flat colors instead of gradients
- Banding/posterization
- Colors don't match gradient index

Solutions:

#### Check 1: Texture Settings

    Grayscale texture:

    Texture Shape 2D
    sRGB: ON (for color accuracy)
    Alpha Source: None
    Advanced:
    Non-Powe of 2: None ⚠️ CRITICAL
    Generate Mip Maps: OFF ⚠️ CRITICAL
    Wrap Mode: Clamp
    Filter Mode: Point (no filter)
    Max Size: Match texture dimensions
    Resize: Mitchell
    Format: Automatic
    Compression: None

    LUT texture:

    Texture Shape 2D
    sRGB: ON (for color accuracy)
    Alpha Source: None
    Advanced:
    Non-Powe of 2: None ⚠️ CRITICAL
    Generate Mip Maps: OFF ⚠️ CRITICAL
    Wrap Mode: Clamp
    Filter Mode: Point (no filter)
    Max Size: Match texture dimensions
    Resize: Mitchell
    Format: Automatic
    Compression: None

    Fix: Reimport textures with correct settings

#### Check 2: Material Configuration

- ✓ _GrayscaleTex assigned
- ✓ _GradientTexture (Built-in) or _GradientTexture_LUT (URP) assigned
- ✓ _GradientCount = 110 (matches LUT height)
- ✓ _GradientIndex in valid range (0-109)

Fix: Verify all texture slots assigned

#### Check 3: Shader Compatibility

- ✓ Using correct shader for your pipeline
- ✓ URP project: Use URP shaders
- ✓ Built-in project: Use Built-in shaders
- ✓ No shader compilation errors in Console

Fix: Assign correct shader for active pipeline

#### Check 4: Pipeline Mismatch

- ✓ Don't use URP shaders in Built-in projects
- ✓ Don't use Built-in shaders in URP projects
- ✓ Check Project Settings > Graphics for active pipeline

Fix: Use shaders matching your render pipeline

#### Glass/Liquid Rendering Issues

Symptoms:

- Glass renders on top of liquid
- Sorting issues with transparency
- Z-fighting/flickering

Solutions:

#### Check 1: Render Order

    Glass material:
      Render Queue: Transparent (3000)

    Liquid material:
      Render Queue: Transparent (3001) in URP
      Render Queue: Geometry in Built-in (with AlphaToMask)

    Liquid should render AFTER glass in URP
    Built-in uses different approach with alpha clipping

    Fix: Manually set render queue if needed

#### Check 2: Mesh Overlap

Liquid mesh should be:

- Slightly smaller than glass interior
- No exact face-to-face overlaps
- Offset by 0.01-0.02 units minimum

Fix: Adjust mesh in 3D modeling software

#### Check 3: Unity 6 Transparency Bug (Known Issue)

Some Unity 6 versions have transparency sorting issues

Workaround:

1. Select all glass materials
2. Move any slider value slightly
3. Liquid sorting will correct itself

Better fix: Keep Unity 6 LTS updated

#### Check 4: Pipeline-Specific Issues

URP: Uses standard Transparent queue

Built-in: Liquid uses Geometry queue with alpha clipping

If sorting issues persist:

- Verify correct shader for pipeline
- Check material render queue
- Test in clean scene

#### Timeline Animation Not Working

Symptoms:

- Material properties don't animate
- Changes affect all objects together
- Animation doesn't show in Play Mode

Solutions:

#### Check 1: Material Instances

- ✓ Material names have "(Instance)" suffix
- ✓ Created via PotionTextureSetup "Prepare for Timeline"

Fix:

1. Find PotionTextureSetup component
2. Click "Prepare for Timeline"
3. Verify "(Instance)" appears in material names

#### Check 2: MaterialIndexController

For objects with 2+ materials:

- ✓ MaterialIndexController component added
- ✓ Animating correct property names:
  - "Index Material 0"
  - "Index Material 1" etc.

Fix: Add component, animate controller properties

#### Check 3: Timeline Track Binding

- ✓ Animation Track bound to correct GameObject
- ✓ Properties appear in Track list
- ✓ Keyframes visible on Timeline

Fix: Delete and recreate Animation Track

#### Performance Issues / Low FPS

Symptoms:

- Frame rate drops
- Stuttering movement
- High draw call count

Solutions:

#### Check 1: Draw Calls

    Window > Analysis > Frame Debugger
    Check draw calls:
      - Each potion: 2-4 draw calls expected
      - 100+ draw calls: Problem

    Fix: Use MaterialPropertyBlock instead of Material Instances
         (Only use Instances when Timeline animation needed)

#### Check 2: Transparency Overdraw

Too many overlapping transparent objects

Fix:

- Reduce glass complexity
- Simplify liquid mesh
- Use Stylized Tint OP sparingly

#### Check 3: Profiler Analysis

    Window > Analysis > Profiler
    Check:
      - CPU: Liquid.cs Update() time
      - Rendering: Shader compilation
      - Memory: Material instance count

    Fix based on bottleneck identified

#### URP Performance

- Check Universal Renderer settings
- Disable unnecessary features (shadows on small objects)
- Use Forward rendering (not deferred)
- Enable GPU Instancing

#### Built-in Performance

- Check Quality Settings
- Use Forward rendering path
- Disable expensive features
- Enable GPU Instancing

#### Post-Processing Not Working

Symptoms (Built-in Only):

- No Bloom or Vignette visible
- Console errors about post-processing

Solutions:

#### Check 1: Package Installation

Built-in requires Post Processing Stack v2:

    Window > Package Manager
    Search: "Post Processing"
    Install: com.unity.postprocessing

    URP: Post-processing built-in, no extra package needed

#### Built-in Setup

- ✓ Post-process Profile asset created
- ✓ Post-process Volume component in scene
- ✓ Volume "Is Global" checked
- ✓ Profile assigned to Volume
- ✓ Post-process Layer on Camera
- ✓ Layer set correctly

#### URP Setup

- ✓ Volume component in scene
- ✓ Volume "Is Global" checked
- ✓ Volume Profile created
- ✓ Effects added to Profile
- ✓ Camera has "Post Processing" enabled

#### Check 3: Effects Configured

- ✓ Bloom enabled and configured
- ✓ Vignette enabled and configured
- ✓ Intensity values not zero

Fix: Check Profile asset for enabled effects

#### Material Preview Issues

Symptoms:

- Material thumbnails show UV patterns
- Grayscale texture visible in previews
- Messy project window

Solutions:

#### Optional: Use ClearGrayscaleTextures Tool

Tools > MesshingAround > Clear GrayscaleTex from Materials

⚠️ WARNING: This is intrusive and optional!

- Only use if you want clean material previews
- Does NOT affect runtime functionality

#### Alternative: Ignore Preview Issue

- Material previews are cosmetic only
- Runtime appearance is correct
- PotionTextureSetup handles textures automatically
- No impact on game functionality

### 10.2 FAQ

#### Q: Do I need MaterialIndexController if I have only 1 material?

A: No, it's optional. You can animate `_GradientIndex` directly via `Renderer > Material > _GradientIndex`. The controller just provides a cleaner slider.

#### Q: Do I need MaterialIndexController if I have 2+ materials?

A: YES, it's required if you want to animate `_GradientIndex` independently per material. Without it, all materials will change together.

#### Q: Can I use URP shaders in Built-in projects?

A: No. Each pipeline requires its own shaders:

- URP projects: Use shaders in `Shaders/URP/` folder
- Built-in projects: Use shaders in `Shaders/Built-in/` folder

#### Q: Can I migrate between URP and Built-in?

A: Yes! See section 7.4 for complete migration guide. Scripts work identically in both pipelines; only materials need updating.

#### Q: Do I need Post Processing Stack v2?

A: Only for Built-in demo scene. URP has post-processing built-in. Core potion functionality works without any post-processing in both pipelines.

#### Q: What's the difference between Stylized Tint and Stylized Tint OP?

A: Stylized Tint OP adds an `_Alpha` property for full opacity control (0-1). Use it when you need semi-transparent materials that aren't glass.

#### Q: Can I use this system with my custom shaders?

A: Yes! As long as your shader has exposed properties named consistently (e.g., `_GradientIndex`, `_GrayscaleTex`), the scripts will work. You'll need versions for both URP and Built-in if supporting both pipelines.

#### Q: Why does the liquid wobble too much at high framerates?

A: v1.0.0 includes framerate capping (60 FPS) and velocity clamping to fix this. If still experiencing issues, enable VSync in Project Settings > Quality.

#### Q: Does this work on mobile?

A: Yes! Tested on mid-range+ Android devices. Performance tips:

- Limit active Liquid.cs scripts
- Lower texture resolutions to 512x512
- Works in both URP and Built-in mobile

#### Q: Can I save Material Instances as assets?

A: No. Instances are temporary scene-only materials. For permanent variants, create new material assets instead.

#### Q: My animation doesn't show in Edit Mode but works in Play Mode. Bug?

A: No, this is normal Unity behavior with Material Instances. Timeline preview in Edit Mode is unreliable. Always test in Play Mode for accurate results. This applies to both URP and Built-in.

#### Q: Will this work in Unity 2022.3 LTS?

A: Partial compatibility currently. Liquid shader requires minor adaptations for Unity 2022.3. Full official support planned for future update. Use Unity 6 LTS for guaranteed stability.

#### Q: Should I use ClearGrayscaleTextures tool?

A: Only if material preview appearance bothers you. It's completely optional and cosmetic. Runtime functionality is unaffected whether you use it or not.

#### Q: What if I made changes but don't see them immediately?

A: Unity Editor sometimes requires a refresh:

1. Enter Play Mode and Stop
2. This forces Unity to reload material instances and property blocks
3. Standard Unity Editor behavior when working with materials

#### Q: Can I mix URP and Built-in materials in the same scene?

A: No. Unity projects use ONE render pipeline at a time. All materials must match the active pipeline. Use appropriate shader versions for your project's pipeline.

#### Q: Do scripts work differently in URP vs Built-in?

A: No! All scripts (Liquid.cs, PotionTextureSetup.cs, MaterialIndexController.cs) work 100% identically in both pipelines. No code changes needed.

## 11. Technical Specifications

### 11.1 Platform Compatibility

#### ✅ Fully Tested

- Windows 10/11 (DirectX 11/12)
- WebGL (Chrome, Firefox, Edge)
- Android 11+ (OpenGL ES 3.0+/Vulkan)

Both URP and Built-in

Performance: Excellent

Known Issues: None

#### ⚠️ Build Compatible

- macOS (Metal API)
- iOS (Metal API)
- Linux (Vulkan/OpenGL)

Expected: Full compatibility

Status: Not extensively device-tested

#### ❌ Not Supported

- Android GLES2 (legacy)
- Unity versions older than Unity 6
- HDRP(planned for future)

### 11.2 Performance Notes

#### Draw Calls per Potion

Configuration | Draw Calls | Batching | 100 Potions
--- | --- | --- | ---
MaterialPropertyBlock (Recommended) | 2-3 per potion | ✓ Yes | ~10-15 draw calls
Material Instances (Timeline) | 2-3 per potion | ✗ No | 200-300 draw calls

#### Polygon Count

- Minimum: 320 tris (Potion_03_ThinSmall)
- Maximum: 1152 tris (Potion_08_ThinNeckBig)
- Average: ~680 tris per potion

#### Memory Usage

Per Potion (MaterialPropertyBlock):

- Textures: ~2MB (1k grayscale + shared LUT)
- Mesh: ~50KB (with Read/Write enabled)
- Materials: Shared (minimal overhead)
- Total: ~2.05MB per unique potion type

### 11.3 Known Limitations

#### Technical Limitations (Both Pipelines)

- Read/Write Requirement: Liquid shader requires mesh Read/Write enabled (~20% memory increase)
- Double-Sided Rendering: Liquid shader uses Cull Off (slight performance cost)
- Transparency Sorting: Glass shader may have sorting issues with other transparent objects

#### Render Pipeline Limitations

Built-in Pipeline:

- ✓ Fully supported and feature-complete
- ⚠️ Requires Post Processing Stack v2 for demo scene

Universal Render Pipeline (URP):

- ✓ Fully supported and feature-complete
- ✓ Post-processing built-in

Not Supported:

- ❌ HDRP (planned for future update)

## 12 Support & Updates

### 12.1 Contact Information

#### Publisher Information

Publisher: MesshingAround

Email: messhingaround@gmail.com

Response Time: 3 - 5 business days

*Response time may vary depending on support workload.

#### Bug Reports

When reporting bugs, please include:

1. Unity version (exact build number)
2. Render pipeline (URP or Built-in)
3. Platform (Windows, Mac, WebGL, etc.)
4. Steps to reproduce
5. Error messages from Console
6. Screenshots or video if applicable
7. Whether issue occurs in both pipelines or just one

### 12.2 Roadmap

#### v1.1.0 (Q2 2026) - Unity 2022.3 LTS Support

- Full Unity 2022.3 LTS compatibility
- Liquid shader adaptations for 2022.3
- Compatibility testing across both pipelines
- Performance optimization
- Documentation updates

#### v1.2.0 (Q3 2026) - Content Expansion

- 4 new potion models (16 total)
- 40 new gradients (150 total)
- Additional props (example: shelves, ingredients, cauldron)
- New prefab variants
- Mobile optimization pass

#### v2.0.0 (Q4 2026 - If Successful)

- HDRP support (third pipeline!)
- Advanced liquid physics ** (splashing, dripping)
- Particle effects integration
- Documentation video tutorials
- Cross-pipeline material converter tool **

**It is possible that after an initial investigation, these updates cannot be made for various reasons.

### 12.3 Changelog

#### v1.0.0 (November 2025) - Initial Release

Features:

- 10 unique potion bottle models
- 1 alchemy table prop + 1 potion display stand
- Dual Pipeline Support: URP + Built-in fully functional
- 8 total shaders (4 URP + 4 Built-in)
- 6 scripts (3 core + 2 editor + 1 utility)
- 110 gradient presets across 8 categories
- MaterialPropertyBlock integration
- Timeline animation support
- 12 ready-to-use prefabs

Shaders (URP):

- Stylized Tint (URP) - PBR Lit, Opaque
- Stylized Tint OP (URP) - PBR Lit, Transparent
- Stylized Glass (URP) - UnLit, Transparent
- Liquid Effect (URP) - Unlit, Transparent

Shaders (Built-in):

- Stylized Tint (Built-in) - Surface Shader, Opaque
- Stylized Tint OP (Built-in) - Surface Shader, Alpha
- Stylized Glass (Built-in) - Custom Unlit, Transparent
- Liquid Effect (Built-in) - Custom Unlit, Transparent

Scripts:

- PotionTextureSetup.cs - Texture assignment system
- Liquid.cs - Real-time physics with framerate fixes
- MaterialIndexController.cs - Timeline helper
- PotionTextureSetupEditor.cs - Custom inspector
- MaterialIndexControllerEditor.cs - Custom inspector
- ClearGrayscaleTextures.cs - Material preview cleaner

Demo Scenes:

- DemoScene_URP - Full showcase with URP Volume post-processing
- DemoScene_BuiltIn - Full showcase with Post Processing Stack v2
- Both scenes: 5 interactive demonstrations, Timeline examples, 2 cameras

Performance:

- MaterialPropertyBlock optimization (both pipelines)
- GPU Instancing support (both pipelines)
- Framerate-independent physics (60 FPS cap)
- Mobile-friendly (tested on mid-range devices)
- Identical performance in URP and Built-in

Known Issues:

- Unity 2022.3 LTS requires minor adaptations (planned for v1.1.0)
- Some Unity 6 versions may have transparency sorting issues (workaround documented)

Notable Features:

- ✅ Feature Parity: URP and Built-in have identical functionality
- ✅ Pipeline-Agnostic Scripts: No code changes between pipelines
- ✅ Opacity Shader: New Stylized Tint OP for semi-transparent materials
- ✅ Material Preview Cleaner: Optional tool for neat project organization
- ✅ Ready-to-Use Prefabs: Drag-and-drop functionality

## 13. License & Legal

### 13.1 Terms of Use

When you buy Stylized Potions Pack from the Unity Asset Store, you get a license to use it in your projects following Unity's standard Asset Store EULA (End User License Agreement).

#### ✅ What You CAN Do

- Use in commercial projects - Games, apps, films, client work - all good!
- Modify everything - Change models, textures, shaders, scripts however you want
- Ship in your products - Include in published games, DLC, updates
- Use in unlimited projects - No per-project licensing
- Switch between pipelines - Convert freely between URP and Built-in
- Client/freelance work - Use for game dev services you provide

#### ❌ What You CANNOT Do

- Resell the pack - Can't redistribute the asset package to others
- Share individual files - Can't distribute models, textures, or shaders separately
- Upload to other stores - Can't sell on other asset stores or marketplaces
- Use as template/tool - Can't make competing asset packs using this content
- Share with teammates - Each team member needs their own license

#### Simple Rule

You can use this asset to make and sell your own games/projects. You cannot resell or share the asset itself. That's it!

#### Team/Multi-Seat Licensing

Working with a team?

- Each developer working with the asset needs their own license
- One license = One developer, unlimited projects by that developer
- This follows Unity Asset Store's standard licensing

#### Example Scenarios

✅ OK: You buy the pack and use it in 10 different games you publish

✅ OK: You modify the shaders and use them in your client's game

❌ NOT OK: You buy the pack and share it with your 3 teammates (they each need a license)

❌ NOT OK: You extract the potion models and sell them on another marketplace

#### Full Legal Terms

The complete legal agreement is Unity's Asset Store EULA, available at:

https://unity.com/legal/as-terms

This summary is provided for convenience but does not replace the official EULA. When in doubt, the official Unity Asset Store EULA takes precedence.

### 13.2 Warranty Disclaimer

AS-IS Provision:

THIS ASSET PACKAGE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.

No Guarantees:

- No guarantee of compatibility with future Unity versions
- No guarantee of specific performance metrics
- No guarantee of bug-free operation
- No guarantee of platform compatibility beyond tested platforms
- No guarantee of compatibility with specific pipeline versions

User Responsibility:

- Test assets in your specific project before production use
- Backup projects before importing assets
- Verify compatibility with your target platforms
- Test in your chosen render pipeline (URP or Built-in)
- Read documentation before use

### 13.3 Credits & Attribution

### Original Tutorial Credits

#### MinionsArtTutorials

Website: https://minionsart.github.io/tutorials/

Provided Base Materials:

- Glass Shader (URP & Built-in): Base shader implementation and concepts
- Liquid Shader (URP & Built-in): Base shader implementation and liquid physics concepts
- Liquid Script (Base): Original script for liquid fill effect

What We Did:

Starting from these tutorial materials, we extensively modified, improved, and expanded upon them to create a complete production-ready asset package. The final shaders and scripts have been significantly enhanced with additional features, optimizations, dual pipeline support, and integration with Unity's Timeline and MaterialPropertyBlock systems.

Thank you to MinionsArt for providing excellent educational resources that served as the foundation for this project!

## 14. AI Development Disclosure

### Transparency Statement

In accordance with Unity Asset Store guidelines, this project was developed with the assistance of AI tools in specific areas of development.

### 14.1 AI Tools Used

Claude (by Anthropic) - AI assistant used during development

### 14.2 AI-Assisted Development Areas

- Shader Enhancement: Improvement and optimization of base shaders provided by MinionsArtTutorials (Glass and Liquid shaders for URP and Built-in)
- Script Optimization: Enhancement of base Liquid script and development of additional utility scripts (PotionTextureSetup, MaterialIndexController)
- Code Refactoring: Improvements to code structure, readability, and performance
- Documentation: Assistance in creating comprehensive technical documentation
- General Development: Problem-solving, debugging assistance, and implementation guidance throughout the project

### Original Content

The following content is 100% original and NOT AI-generated:

- All 3D models (potions, glass bottles, corks, stands, table)
- All textures (grayscale maps, gradient LUT textures)
- Visual design and art direction
- Shader concepts and artistic vision
- Scene composition and lighting setup

### 14.3 Development Process

This asset represents a significant expansion and improvement over the original tutorial materials from MinionsArtTutorials. While the base shaders and script concepts came from those tutorials, the final implementation includes:

- Complete dual pipeline support (URP + Built-in) with feature parity
- Extended functionality beyond original tutorials
- MaterialPropertyBlock integration for performance
- Timeline system integration
- Custom editor tools and utility scripts
- 110 gradient variations
- Stylized_Tints Shaders and LUT system, implemented in all shaders also.
- 10 unique potion + 1 Alchemy table prop + 1 Potion display stand with complete prefab system
- Comprehensive documentation and support infrastructure

#### Created By

MesshingAround

- 3D modeling, texturing, and asset creation
- Shader development (URP Shader Graph + Built-in code)
- Script programming (C#)
- Documentation and support
- Dual pipeline implementation

#### Tools Used

Development:

- Unity 6 (Game Engine)
- Blender (3D Modeling)
- Krita (Texturing)
- Visual Studio Code (Programming)
- Shader Graph (URP shaders)

Technologies:

- Universal Render Pipeline (URP)
- Built-in Render Pipeline
- Surface Shaders (Built-in)
- Shader Graph (URP)
- Timeline System
- MaterialPropertyBlock API
- Post Processing Stack v2 (Built-in)

#### Attribution (Optional)

While not required, we appreciate attribution if you choose to credit assets in your project:

    "Stylized Potions Pack" by MesshingAround
    Available on Unity Asset Store
    Supports URP and Built-in Render Pipeline

#### Special Thanks

Thank you to the Unity community and Asset Store users for your support and feedback during development!

Special thanks to users who requested Built-in Pipeline support - this dual pipeline release wouldn't exist without your feedback.

#### Copyright

© 2025 MesshingAround. All rights reserved.

- Assets: Copyright MesshingAround
- Unity: Trademark of Unity Technologies
- Asset Store: Platform operated by Unity Technologies
- URP/Built-in: Unity rendering technologies

### Quick Reference Card

#### URP Shaders

- Stylized Tint (URP) - PBR Lit, Opaque
- Stylized Tint OP (URP) - PBR Lit, Transparent
- Stylized Glass (URP) - UnLit, Transparent
- Liquid Effect (URP) - Unlit, Transparent

#### Built-in Shaders

- Stylized Tint (Built-in) - Surface Shader, Opaque
- Stylized Tint OP (Built-in) - Surface Shader, Alpha
- Stylized Glass (Built-in) - Custom UnLit
- Liquid Effect (Built-in) - Custom Unlit

#### Core Scripts (Pipeline-Agnostic)

- PotionTextureSetup.cs
- Liquid.cs
- MaterialIndexController.cs

Work identically in both pipelines

#### Support

Email: messhingaround@gmail.com

Version: 1.0.0

Release: November 2025

Unity: Unity 6 LTS (6000.0.60f1+)

### Important Reminders

- ✅ Read/Write must be ON for liquid physics to work
- ✅ Generate Mip Maps must be OFF on textures
- ✅ Use correct shader for your active pipeline (URP or Built-in)
- ✅ Material Instances required for Timeline animation
- ✅ Scripts work identically in both pipelines

### Document Information

- Version: 1.0.0
- Last Updated: November 2025
- Pipeline Support: URP + Built-in
- Total Pages: 115 pages (original PDF)
- Format: Complete HTML Documentation

© 2025 MesshingAround. All Rights Reserved.

## End of Documentation

Thank you for purchasing Stylized Potions Pack!

We hope this asset helps bring your creative visions to life, whether you're working in URP or Built-in Render Pipeline.

If you have any questions, issues, or feedback, please don't hesitate to contact us at messhingaround@gmail.com

Happy Creating!