-
Notifications
You must be signed in to change notification settings - Fork 117
Adding an Image-based Cellular Sampler for the Image-Library addon #520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…temporarily increment version for testing
remove debug
I might have put the wrong log file at the moment but it should have outputted all the return types with valid outputs |
Also added an alignment value either NONE or CENTER |
Is there any way to get a BufferedImage out of the dfsek Image interface? |
...main/java/com/dfsek/terra/addons/image/config/noisesampler/CellularImageSamplerTemplate.java
Show resolved
Hide resolved
...rary-image/src/main/java/com/dfsek/terra/addons/image/noisesampler/CellularImageSampler.java
Outdated
Show resolved
Hide resolved
...rary-image/src/main/java/com/dfsek/terra/addons/image/noisesampler/CellularImageSampler.java
Outdated
Show resolved
Hide resolved
...rary-image/src/main/java/com/dfsek/terra/addons/image/noisesampler/CellularImageSampler.java
Outdated
Show resolved
Hide resolved
common/addons/library-image/src/main/java/com/dfsek/terra/addons/image/util/KDTree.java
Outdated
Show resolved
Hide resolved
public void doKDTree() { | ||
treeFutures.computeIfAbsent(hash(), h -> CompletableFuture.supplyAsync(() -> { | ||
List<Vector2> whitePixels = extractWhitePixels(image); | ||
return new KDTree(whitePixels); | ||
})).thenAccept(tree -> { | ||
this.tree = tree; | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is kinda awful tbh
why does treeFutures
need to even exist at all?
there's also a probably race condition waiting to happen here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been trying to figure out how to only create the Tree once per image on pack load, as I've observed multiple instances of the sampler gets called which bogs down my server. This is jank rn and I'm trying to figure out what soluton can be done as I need some sort of check if the tree has been made already and maps to an image in an efficient way
what do you need it for? because an image can either be a real |
Ah I see. I was wondering how to extract a specific color faster from the images as I've been trying to solve 2 things
|
I don't know where I could put the enums, should I put it under api? |
Should we trade performance for absolute safety on startup or just let the user do their own hashing in the config? I'd be pissed if the image takes a really long time to render if it was me trying to render maps with huge images like what i'm doing |
most definitely not. imo they should stay where they originally were. |
Will try to re-target this pr for 7.0 and Seismic later when I move in my apartment |
Pull Request
Description
This adds an NoiseSampler "CELLULAR_IMAGE" Where the image parameters can specify the feature points to create a form of customizable Worley Noise
Changelog
Adds CellularImageSampler and its template based off CellularNoiseSampler and the other image samplers
Adds a K-D Tree utility class for it (Should be faster and more appropriate than the brute force method the cellular sampler currently uses)
Keeps all of the Cellular return types for compatibility
TODO:
Check if it actually creates proper spot biomes/supplants Cellular noise (Currently don't know how to properly test it)Tested https://discordapp.com/channels/715448651786485780/820420254727274556/1394673432234295357Proper Input Parameters and changes to the image parameter (Might use a ColorSampler instead)Decided to keep the image parameter and added an alignment configuration akin to ColorSampler insteadPerformance and cache improvements to the KD Tree and how it loads the image (Need to make KD-Tree initialize first before noise function doing anything else judging from the logs)should initialize first nowProper testing of the sampleran actual default value for Lookup parameter due to the sampler being in image-library and not config-noise-functionDoneServer logs with debug of the output of the sampler:
(https://mclo.gs/axT2iDq)
Checklist
Mandatory checks
ver/
prefix)or is a branch that is intended to be merged into a version branch.
CONTRIBUTING.md
document in the root of the git repository.
Types of changes
Compatibility
Documentation
Testing
Licensing
release it under GPLv3.
released under GPLv3 or a compatible license.
This was tested in a modified Overworld 2.0 pack in which spot.yml was modified to have the CELLULAR_IMAGE sampler and large spot biomes have been removed from the pipeline
worldX = 4173 - 2500 = 1673
worldZ = 2500 - 348 = 2152
Spot Image in which each white pixel is a feature point(They're really tiny so you've got to zoom in)

the formula for world coords if align: CENTER