Elemental Surfaces OFFICIAL SALE

Overview

Inspired by gameplay surface mechanics in games such as Baldur's Gate 3 and Divinity Original Sin 2, this system bakes a grid of cells from scene colliders, allowing you to place and simulate dynamic ground surfaces such as fire, water, ice, oil, and more.


Beyond visuals, surfaces could influence gameplay — for example, you could get the current cell at a character's position and have them take damage if they're standing on fire.


📕 - DOCUMENTATION

🎮 - WEBGL DEMO



⚙️ How It Works

The system generates a grid that stores the surface type at each cell. This grid can then power both gameplay logic and visual rendering. The Unity Job System and Burst are utilized for fast baking and rendering. A combination of decal projectors and prefab spawning is used to bring the visuals to life and behaviors are used to add dynamic and emergent gameplay.


Core Features

  • Data
    • SurfaceZone which designates a volume to use for the grid. Customize grid and cell size (recommended cell size is 0.5). It can be queried at runtime to set/get surface types to/from cells. Grid data is baked into an asset file (SurfaceZoneData) rather than the scene file to help with version control management. Surface types are stored as data assets (SurfaceData) as well and can be contained in multiple libraries (SurfaceLibrary).
    • ISurfaceZoneListener - rendering and behaviors implement this interface to read and get updates regarding the data.
  • Rendering
    • SurfaceDecalRenderer uses a DecalProjector and a specialized decal shadergraph shader that handles rendering of the surface decals. Allowing for height based fading, organic noise based displacement and blending, as well as standard PBR inputs.
    • SurfacePrefabSpawner random weighted prefab spawning system for creating and managing the lifetime of prefabs across a surface type.
    • System data is entirely separate from the rendering system so you could supply your own stylized rendering for the surfaces if you wanted.
  • Behavior
    • There are 2 examples included with the demo
      • PropagationExample - spreads one surface type into another such as ice freezing water or fire igniting oil.
      • RegionDecayExample - a complex region based lifetime tracking system that transforms one surface type into another over time such as ice melting to water or fire crumbling to ash.


🧱 Included Surface Types

  • 🔥 Fire – spreads through oil and eventually burns into ash
  • ❄️ Ice – freezes nearby water and melts over time
  • 🌊 Water – reflective surface that can be frozen
  • 🛢️ Oil – flammable surface that ignites when exposed to fire
  • Ash – the remnants left after fire burns out
  • There are plans to add more surface types to this asset pack as development continues.


✏️ Easily create your own surface types

  • Create SurfaceData assets for new surfaces and create custom behavior using ISurfaceZoneListener.
  • Duplicate and tweak included materials/shaders or create and use your own.
  • Easily spawn custom prefabs across surfaces using the included SurfacePrefabSpawner.
  • Supply custom textures (albedo, smoothness etc) for PBR rendering of the decals or create your own decal shaders for entirely customised visuals.


🚀 Runtime Control

Grids require baking, either at editor time or at runtime (e.g. after a procedural environment has been generated), but the cell surface values can be modified at runtime, enabling:

  • Dynamic environmental hazards
  • Puzzle mechanics
  • Elemental interactions
  • Strategy and simulation gameplay