Elemental Surfaces is a system for creating and managing gameplay altering ground surface effects such as fire, water, ice, oil or anything else you can imagine.The system's data management is render pipeline agnostic. However, the included surface rendering system currently has dependencies on URP (decal projectors and URP shaders).There are future plans to add support for HDRP if there is a demand for it.✨ OverviewThis 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 WorksThe 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 FeaturesDataSurfaceZone 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.RenderingSurfaceDecalRenderer 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.BehaviorThere are 2 examples included with the demoPropagationExample - 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 outThere are plans to add more surface types to this asset pack as development continues.✏️ Easily create your own surface typesCreate 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 ControlGrids 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 hazardsPuzzle mechanicsElemental interactionsStrategy and simulation gameplay🖥️ TechnicalsThe system has separate data and rendering handling. The rendering side is done using URP's shaders and decal system. It would require some work but it should be possible for users to adapt this and modify the shaders and decals for use with HDRP's decal system if needed.The grid that is generated by each surface zone is effectively 2D. It works by raycasting downwards from the top of the zone. A limitation of this is that surface effects can not be at multiple overlapping heights. This is a limitation that is currently being investigated for future development. For now, multiple SurfaceZones can be used at varying heights if overlap is required.Cell positions/heights are baked in the local space of the SurfaceZone. This means you can have surfaces on a dynamic moving platform by parenting the SurfaceZone to the platform.Each surface zone currently has a maximum size of one million cells. But you can always create more surface zones if more space is needed.The Unity Job System and Burst are used heavily for optimum performance. It's worth noting that as Unity does not support Burst in WebGL builds that performance may not be as good there. But the webgl demo still runs well in our tests.📕 - DOCUMENTATION🎮 - WEBGL DEMO📚 Source codeAll source code is included.



