Web / Interaction Project

ScratchFX

A browser-based scratch-off game designed to feel like scratching a real lottery ticket.

Highlights

  • Real-time scratch interaction that reveals prize content
  • Weighted prize system that mirrors real lottery odds
  • Mouse and touch input for precise, responsive control
  • Runs directly in the browser with no installation required

Tech

Unity C# Shaders WebGL

Scratch FX: Shader vs Object Instantiation

ScratchFX started with spawned mask objects at the cursor, but moved to a shader-driven reveal for cleaner logic, less scene overhead, and more consistent performance.

Initial Approach

The first version instantiated mask prefabs while the player scratched, visually erasing the surface through overlapping objects.

Instantiate(maskPrefab, clickPosition, Quaternion.identity);

Why It Changed

Per-frame spawning added overhead, increased scene clutter, and made tuning scratch behavior harder than it needed to be.

Final Approach

A custom shader samples a scratch mask texture and drives transparency directly in the material, revealing the image without spawning new objects.

col.a *= (1 - mask);