Some image processing debug art:
Just learned that I can use a SubViewportContainer to display (and edit!) the children of a SubViewport. That helps a lot!
Here I’m trying different arrangements. I’ve applied a blur and assigned a score. The lower the score the better the match.
These images are 160 x 160 but I think I can get away with smaller. I’m gonna have to test at different rotations which is gonna explode the number of pixel comparisons so I gotta optimize here.
Here’s 64 x 64:
And with less blur:
Now 32 x 32:
And less blur still:
And here it is at 32x32 with the build matching the table really closely.
And the legs too far apart:
Or both legs on the same side:
So here’s a problem with this method. Both those last cases are considered equally bad. The legs on the same side actually get a better score than just legs farther apart. If we’re trying to judge this image’s “tableness” then having both legs on one side should be an utter failure.
I increased the blur a bit and it performs a lot better now. Looks like I can use as the threshold something between 0.035 and 0.04.
Cool!
…
Just had a thought. I might be able to get the player to rotate the piece into the right orientation if the UI is really clear that I’m comparing them at the given angle. Like, if I show the build and the schema side by side or animate the schema moving toward and overlapping the build. That would communicate to the player pretty clearly that orientation matters and it seems reasonable to expect them to do that.
…
Got a better blur implementation. Thanks, Nikhil Bhargav. https://www.baeldung.com/java-fast-gaussian-blur
…
Heck ya. I got my test scene to go through each test case, compare it against the schema, and assign a score and success flag. The first time I ran it I saw it go through all the cases, generating images for the pipeline in a split second and got super excited.
I’m glad it’s fast and it’s so cool to be able to run this in-editor. It made finding the right threshold for the “what’s your tableness?” really fast.
I slowed the video by half before converting to a GIF so it’s easier to see what’s going on.
I better try out some other build schemas so I can see whether each one will need its own threshold. And make sure the process for creating these is as painless as possible.
Then I can integrate it into the game actual. Getting antsy to work more directly on the game. I feel like I’m a little ways out on a limb and there isn’t much time for dilly dally.