- Home /
Believable cube destruction, with voxels or otherwise
Hi,
I'm currently working on an application where a user can chip away at a block that can be moved around. The aim is to have believable looking modification of the block (i.e. hitting the block with a circular hammer will produce a circular hole).
The main problem I have is that I'm making the block out of smaller blocks, however, as this needs to run on the HoloLens, the block is very low resolution (12x12x12) so doesn't produce believable shaped holes.
I did have a system previously where I could render a block of a much higher resolution (50x50x50, still not quite high enough), however since it relied on the SetActive command to hide blocks that weren't visible, moving the block around was not possible. I've reduced the load somewhat by having no rigidbodies and using raycasters to destroy the small cubes that make up the block, but according to the profiler it's the combination of tracking the block and rendering the cubes that is slowing the application down.
A method that was suggested to me was to "fake" the destruction using shaders to make it look like the block had been modified, but I'm not sure how that would work.
For reference, the system I'm currently using is based off this tutorial:
I have modified it for my own needs (the object culling had to be completely removed) but I'm not sure this is the way to go. A lot of tutorials are more focused on random terrain generation, and this isn't quite what I'm trying to do.
Should point out that any sort of cool destruction physics is beyond the scope of what I'm trying to do, literally just making a hole appear at the correct size and depth is good enough.
Any help would be greatly appreciated!
You may want to use voxels with values other than binary (kind of a distance field, when you damage you reduce it's "health" based on the distance of the attack), then generate an isosurface (eg. using marching cubes algorithm, and smoothing the surface using the distance field). Similar techniques are used for visualizing $$anonymous$$RI volumetric data
Your answer
Follow this Question
Related Questions
How to render a Cube using Shaders? 0 Answers
Cube botttom transparent with shader? 1 Answer
How to achieve the shader used in MagicaVoxel? 2 Answers
Shader to change Vertex Colors 0 Answers
Shader works only on Cubes properly (Alpha problem) 1 Answer