Skip to content
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

Is it possible to specify colors at positions in the overlapping model? #2

Open
Keristero opened this issue Jul 21, 2019 · 2 comments

Comments

@Keristero
Copy link

Keristero commented Jul 21, 2019

I always want my output to be bordered by a specific color, I've tried modifying the array returned by model.graphics() between iterations, but that clearly is not the way to do this... is there any way to do this currently? something like.

let model = new OverlappingModel(data, width, etc);
let startingArr = model.gaphics();
//Set RGB of first pixel to (0,0,0)
startingArr[0] = 0;
startingArr[1] = 0;
startingArr[2] = 0;
//Overwrite existing graphics array
model.setGraphics(startingArr);
@kchapelier
Copy link
Owner

kchapelier commented Jul 21, 2019

Currently there is no way to do this (whether in this port or in the original C# library/algo), and implementing this would not be trivial. The graphics array is only generated when requested, internally the algorithm works by segmenting the example pattern (data) in smaller chunks/patterns and storing the probability for each pixels of those patterns to be a correct choice for each pixels of the result image.

I'm leaving this issue open as it would be an interesting feature to try and implement.

In the mean time you might be interested to check Brian Bucklew's GDC 2019 presentation on how the algorithm is used and controlled in Cave of Qud. The "texture mode" Brian mentions is the overlapping model. Also, if you're still testing the water for your own procedural content generation system, you might want to check the js/webgl port of the ConvChain algorithm it's fast and supports pre-set "immutable cells", but this algorithm only handles 1bit/black and white maps. Hopefully you'll find a suitable solution for your problem at hand.

@Keristero
Copy link
Author

Thanks, I'll certainly watch that talk and check out ConvChain. In the meantime I've hacked together a solution involving combining several of the same output image and cropping to the largest contiguous image. Very slow but it sort of works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants