WIP: Terrain quality assist (plugin)

Hey all!

(I will create a seperate thread to put in #tutorials when this plugin is ready for the wild.)

I’ve been working on a plugin that I think is really cool. I made it because of some issues I had with the default tools involving how things like smoothing are handled, especially with usage of the grow and erode tool.

This plugin has a multitude of tools in it. The first one is a crude occupancy visualizer. It reads a region the user passes in and draws boxes to visualize occupancy. The outer black box is used to visualize grid space, while the inside colored box represents occupancy with both size and color.

Click for an example.

This tool has proven to be very useful in situations when using the grow and erode tools.

For instance, while something may look fine visually, the occupancy values are generally out of whack and can have some bad results when you have bits of terrain close to eachother, and we all know how much of a hassle that is to deal with. This is one of the more minor reasons that LOD can look strange on small, isolated sections of terrain, I’ve found. This is also the reason why using the smooth tool on hills causes little ridges to form.

Click for an image of visual appearance alone vs. showing occupancy

Now, don’t get me wrong when I say this issue is a huge hassle at times. Who would I be to not design a feature to fix this?

The second part of this plugin is an occupancy calculator and editor. While this part isn’t QUITE yet complete, it has some interesting functions: An occupancy editor (and, with the editor, an automatic fixer / calculator)

The calculator and editor work together. Think of them as an automatic vs manual mode for this specific feature. When in the editor, the user will be able to click on a terrain voxel (likely one that has been highlighted with the visualizer, since I’m using BoxHandleAdornment). From then, a UI element will show. The user will be able to set a percentage value. This feature will allow you to fine-tune the occupancy of your terrain to ensure that it behaves as you want it.

As for the calculator, this is the feature that will be the most used, I think. In the calculator, the user will select a region of terrain they want to fix. From then, they can specify a threshold for how small voxels have to be in order to be affected. When they run it, the calculator will clear away any voxels within threshold (i.e. the ridiculously tiny ones shown in the image above).

What do you all think? I’ll have a release later today, probably.

6 Likes

A bit of a followup, but I have a feeling some are going to ask about performance and such. I have that covered!

Since having an excessive amount of instances of this type is generally an issue (They aren’t really intended to be used in massive groups like this), I have the reader set up to only render what matters.

Here's an example of that. The red part is what I used for my region.

As you can see, I have the system not render voxels that are surrounded. The way it’s calculated is by getting the 6 adjacent voxels to the one I’m checking and seeing if their occupancy adds up to a value over 4.35 (Where 6 means all surrounding voxels are 100% full) - if it does, that means the voxel is surrounded and it will not render. It does have backup checks too, so it can check if there’s a random hole (imagine a sudden hole that is just a random voxel with its occupancy set to 0.)

Here's an example of that system in action.

c0ff5d87f9ee944dc5fb83de349318c7079e2707.jpg

That little black square is a voxel that I set the occupancy of to 0. All surrounding voxels have 100% occupancy.

b62cfd130f569984bf32c392d5a49798f6183299.jpg

As you can see, it detected there was a hole there so it rendered the surrounding voxels’ occupancy.

It works well in caves, too!

1 Like

I’ve been doing testing of this feature quite a lot. I’d say it’s definitely working. (I had visualization off for this one)

Also, I re-did visualization because it was 2 studs too high in all axis in its position.

What it can do now

https://i.gyazo.com/fa5aa59928d1bded98a2da56ea086687.gif

Release coming shortly. I just have to make it a plugin. It’s already a module.

3 Likes

I love this

I couldn’t find this one thing tho – will we be able to edit occupancy of one voxel?

I was considering that and I did have an idea either involving handles, or a slider as a UI element. Fine-tuning like that would certainly be something I add.

I’m almost ready to release it, but the second GIF I posted of it fixing the terrain was using a terrain sharpening method. It recreates the terrain in the region by omitting any fine changes, as well as omitting any sudden changes. That’s why it was able to remove those holes from the terrain. It allows mid-range changes (where voxel occupancy of adjacent voxels changes by about 30%) to be sustained.

The issue is that I would also like to include a smoothing function, but that may take longer than expected to get desired results.

1 Like

This is really cool, and I bet it can be quite handy as well.
Working with smooth terrain can be painful if you are trying to be precise. It’s sometimes hard to understand where the various voxels begin and end, and thus you usually get clunky results in the weirdest places.

Good effort and nice idea!