-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Generate from a pre-defined output image #85
Comments
Hi! To constrain the output, you need to:
For an example, see how I constrain ground pixels here. |
Could you just explain the snippet of code you linked so that I can write my own? |
Sure! if (ground)
{
for (int x = 0; x < MX; x++)
{
for (int t = 0; t < T - 1; t++) Ban(x + (MY - 1) * MX, t);
for (int y = 0; y < MY - 1; y++) Ban(x + y * MX, T - 1);
}
Propagate();
} This code executes in examples where we need to fix the ground level. That is, in examples like Skyline, Flowers and Platformer, where we see the picture from the side and not from the top. If we omit this code, the ground level could appear anywhere in the output (like in the middle of an image), or there could even be multiple ground levels. Try changing to Ground pattern is the last pattern in the input, so its index equals
And then we propagate the bans. In your example, to generate islands, you need to ban all non-water patterns from the border of the image, and then propagate. I guess I'll reopen the issue because this is a common question. |
Thanks, now I understand. |
Hi,
I'm trying to implement a way to give the algorithm a pre-defined output image containing fixed (already put in place) tiles (in overlap mode).
I do not understand the code very well but I have some ideas.
So on this line the output image is created:
WaveFunctionCollapse/OverlappingModel.cs
Line 116 in a6f79f0
Is it possible to fill the
observed
array with our pre-defined image (before running the algorithm)?What does the array
observed
do?Another option would be to put it in inside the
init
orobserver
function.EDIT:
My use-case is specifying an output image where the border is filled with "water" so that you can guarantee that the algorithm always generates "islands". Same goes with "rooms".
The text was updated successfully, but these errors were encountered: