PersonTheCat / OreStoneVariants

A powerful utility for generating new blocks when given a foreground and background.
GNU General Public License v3.0
7 stars 8 forks source link

Improve getDifference Algorithm #4

Closed pupnewfster closed 6 years ago

pupnewfster commented 6 years ago

This just makes getDifference more accurate in general it does not address the rest of #2 yet.

pupnewfster commented 6 years ago

Actually hold off on accepting the pull request as I seem to have broken Coal ore working

pupnewfster commented 6 years ago

This pull can now be merged as I fixed Coal Ore again.

PersonTheCat commented 6 years ago

This works pretty well, but I do find that a few textures which could previously be generated no longer can be. A threshold of 0.3 seems to have a wider range of compatibility, but I still haven't tested it with ores like those from Biomes O' Plenty and Glass Hearts, which are styled differently than normal stone is. I may try to set it up to where it generates a second overlay, if the first one is mostly empty. Another option would be to get input from somewhere to tell it what value to use for alphaPercent, but I worry it's just such a picky value that managing it that way wouldn't make a lot of sense.

On the other hand, I don't really mind having to manually create textures for any block that would benefit from it, but obviously the goal is to increase support for new ores without having to put in more work, so I am conflicted as to how we should proceed.

pupnewfster commented 6 years ago

That is fair about manually creating textures for blocks; however, what I am trying to do is for the purposes of people adding their own ores give them the best chance of having an accurate extraction so that they do not have to create their own textures.

Edit: I have found that 0.4 gives a slightly wider range of support even if in places it is missing a pixel or two. Though I only tested 10 or so ores.

PersonTheCat commented 6 years ago

Oh no, I agree. I'm just saying we don't have to find one single setup that works for all ores, if that's what it comes to. But we do also want to increase support for added blocks, absolutely. That being said, when I was testing this, I noticed that BaseMetals' lead and pewter were blank, whereas some other lighter ores were also missing pixels. I can see how it's more effective for some blocks, but my question now is how do we meet in between so that we continue to support blocks that previously did work while also adding more / better support for others? The best thing I've thought of is to have it generate a second texture if the first one is mostly alpha, but that just seems inefficient.

pupnewfster commented 6 years ago

I will do some more testing then. From what I have seen unlike before this one gives a lot better results for thermal foundation ores and base support of things like BOP

PersonTheCat commented 6 years ago

I think I actually am going to do it that way. We'll start with alphaPercent = 0.4, get the average alpha value, and if that isn't above a certain threshold, we'll regenerate it using alphaPercent = 0.3 or even 0.27 or something. I'll look into that today. Thinking back on it, it really isn't a perfect solution, but it also usually wouldn't even be necessary, so I don't think it'll really matter in the end.

Thanks again for submitting both the original and revised algorithm, by the way. I've gotten more help from you than I expected to get in total from the community.

PersonTheCat commented 6 years ago

I'm gonna go ahead and merge this change temporarily, but not submit a build to curseforge.com yet. Let's start another discussion if you still want to take this further.