Comments (4)
Hi! To constrain the output, you need to:
- Ban all unwanted options.
- Call
Propagate()
to propagate the bans.
For an example, see how I constrain ground pixels here.
from wavefunctioncollapse.
Could you just explain the snippet of code you linked so that I can write my own?
from wavefunctioncollapse.
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="False"
in samples.xml and see what happens.
Ground pattern is the last pattern in the input, so its index equals T-1
.
- In the first interior
for
in the code, we ban all non-ground (that is,t != T-1
) patterns from the ground level. - In the second
for
, we ban the ground pattern from non-ground (that is,y != MY-1
) levels.
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.
from wavefunctioncollapse.
Thanks, now I understand.
from wavefunctioncollapse.
Related Issues (20)
- [not an issue] using this algorithm in a game engine plug-in HOT 1
- potentially erroneous entropy calculation HOT 1
- Java implementation HOT 1
- Neighbor constraints do not always appear to be enforced HOT 6
- Can't run it on Mac OS HOT 4
- Deadlock when collapsing HOT 4
- "Voxel models generated with WFC and other algorithms will be in a separate repo." HOT 2
- Reuse parts of outcome as constraints, and still obtain the same outcome? HOT 5
- Implementation in C HOT 2
- Description of entropy HOT 1
- Return value of Propagate HOT 5
- How to generate an XML data file for simpletiled from an image file? HOT 1
- Unable to get the program to work in Windows 10 HOT 11
- 太棒了!!!
- Please comment the code! HOT 6
- This project is using the name "Wave function collapse" for a process that is not the physics Wave Function Collapse HOT 2
- N values above 3 hang HOT 1
- Suggestion for a different name: Sudoku Collapse HOT 2
- What is the best way to enforce some tiles (simple tiled model) to not be rotated? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wavefunctioncollapse.