All Projects → Ideefixze → Dterrain

Ideefixze / Dterrain

Licence: mit
Destructible terrain in Unity

Projects that are alternatives of or similar to Dterrain

Terrain Topology Algorithms
Terrain topology algorithms in Unity
Stars: ✭ 266 (+18.75%)
Mutual labels:  unity, terrain
Unity3d Ai And Procedural Generation Framework
Unity3D AI and Procedural Generation Framework.
Stars: ✭ 58 (-74.11%)
Mutual labels:  unity, terrain
Marching Cubes Terrain
Marching Cubes terrain implementation in Unity using the Job System and the Burst compiler
Stars: ✭ 292 (+30.36%)
Mutual labels:  unity, terrain
Unity Texture Packer
🔨 Utility to combine color channels from different textures into a single output.
Stars: ✭ 429 (+91.52%)
Mutual labels:  unity, texture
Pvtut
Procedural Virtual Texture with Unity Terrain
Stars: ✭ 125 (-44.2%)
Mutual labels:  unity, terrain
Unity Shader Basics Tutorial
A introduction into creating shaders for Unity
Stars: ✭ 243 (+8.48%)
Mutual labels:  unity, texture
Dungeontemplatelibrary
🌏: Dungeon free resources (terrain & roguelike generation)
Stars: ✭ 595 (+165.63%)
Mutual labels:  unity, terrain
Proceduralterrain
Procedural voxel terrain generation in Unity
Stars: ✭ 237 (+5.8%)
Mutual labels:  unity, terrain
Interactive Erosion
Interactive erosion in Unity
Stars: ✭ 117 (-47.77%)
Mutual labels:  unity, terrain
Terrain proj
unity 大地形切割、加载、AB
Stars: ✭ 103 (-54.02%)
Mutual labels:  unity, terrain
Massivegrass
Unity Terrain に沿って大量の草を生やす(shader 非依存)
Stars: ✭ 79 (-64.73%)
Mutual labels:  unity, terrain
Unity resources
A list of resources and tutorials for those doing programming in Unity.
Stars: ✭ 170 (-24.11%)
Mutual labels:  unity, terrain
Unity Texture Curve
✏️ Example showing how to bake an AnimatedCurve into a Texture and use it in a shader.
Stars: ✭ 149 (-33.48%)
Mutual labels:  unity, texture
Nvjob Water Shader Simple And Fast
#NVJOB Simple Water Shaders. Free Unity Asset.
Stars: ✭ 172 (-23.21%)
Mutual labels:  unity, texture
Hololens facial recognition
A Unity hololens app to detect faces and display their attributes
Stars: ✭ 217 (-3.12%)
Mutual labels:  unity
Unitybubblegame
BubbleGame《天天萌泡泡》是一款简单好玩的消除游戏,点击三个或以上同颜色、相连接的泡泡来进行消除,简单而有趣。
Stars: ✭ 216 (-3.57%)
Mutual labels:  unity
Unity Meshsaver
A C# Editor Script that allows you to save a usable Mesh .asset file into your project.
Stars: ✭ 215 (-4.02%)
Mutual labels:  unity
Noiseball2
A small example of procedural modeling with compute shaders.
Stars: ✭ 215 (-4.02%)
Mutual labels:  unity
Xrtk Core
The Official Mixed Reality Framework for Unity
Stars: ✭ 219 (-2.23%)
Mutual labels:  unity
Gamedev Resources
An updated collection of useful resources to resources to design, develop and market games.
Stars: ✭ 219 (-2.23%)
Mutual labels:  unity

DTerrain

Destructible terrain in Unity

Simple destructible terrain in Unity based on bitmaps and Quadtree. Pretty efficent and works with Unity Colliders. Very reusable and customizable for your own needs. This beginner friendly tool will take your game to the next level. If you want to use it, clone this repository and see example scene.

Also provides additional functionalities as painting on customizable layers.

Demo

FAQ

How destructible terrain works?

I use Ranges: [min;max] Then I make a list of ranges called Column. I fill those ranges using image (if color.alpha>threshold I fill it and use range to remember it effectively). Now I have a list of Columns that make a single Chunk. Layer is made of chunks and when any changes are made to the Layer - it changes the certain chunk (or chunks).

There are many ways you can handle destruction: if I have shape (list of Columns) I can manually remove each pixel, or use ranges of this shape to delete effectively bigger areas of terrain.

Each Chunk has their sub-texture made from original Texture. I found out that changing a few smaller Textures is much, much faster than changing one big texture.

Whenever a change is made (destruction) each Chunk recalculates sub-textures based on their Columns and recreates BoxColliders2D using Quadtree to fit new terrain.

Would it work in realtime game?

Yes. Example scene rarely goes below ~80 FPS druing per frame destruction on my machine.

How I can make it work even faster?

Slightly increase number of chunks or reduce number of operations done on world per frame. Reduce unnecessary per frame changes to the terrain as it makes chunk to recalculate it's colliders. Recalculating colliders takes about 90% of all computation for DTerrain, keep that in mind. Also, chunks are based on SpriteRenderers meaning the more chunks camera sees the slower it will work. To reduce lag separate typical collision layer into two layers: visible (only sprite renderer - one big chunk) and logic (only collision - many chunks). See SampleScene2Optimized to see the idea behind it.

I can't access any of the components from this package.

Make sure you add using DTerrain; at the begining of you scripts.

Will it work with my Unity version?

It should as code is universal and doesn't use version specific tweaks in Unity (only BoxColliders2D, SpriteRenderers and SpriteMasks).

Can I use it for free?

Yes. Now and forever. You don't have to credit me, but I'd really like to know if you built something meaningful with it.

Special thanks:

  • /u/idbrii for pointing out a fix that nearly doubled the FPS.

Features in the future:

  • Rewriting the whole code to be more expandable (DONE ✔️)
  • Adding mesh optimization (DONE ✔️ - separate collision logic and visible layers: see SampleScene2)
  • Adding wiki on how to use it (IN PROGRESS 🔜)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].