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

Reuse parts of outcome as constraints, and still obtain the same outcome? #66

Closed
bitinn opened this issue Jun 21, 2020 · 5 comments
Closed

Comments

@bitinn
Copy link

bitinn commented Jun 21, 2020

Screen Shot 2020-06-21 at 13 05 36

Screen Shot 2020-06-21 at 13 05 42

WFC allows us to set some initial constraints to limit outcomes.

One thing I would like to do, is to use parts of an outcome as constraint, then generate again.

The only problem is, given the same seed and parts of its outcome as constraints, I cannot obtain the same outcome again, because observation order is now different (initial entropy are different).

Can I satisfy this requirement without modifying WFC's underlying algorithm? I think I just need a smart way to do weighted randomization at observation step?

(This is assuming the random input is order-independent, for example, if we use a seeded hash function instead of random number generator.)

@mxgmn
Copy link
Owner

mxgmn commented Jun 21, 2020

The only problem is, given the same seed and its outcome, I cannot obtain the same outcome again

Please help me understand your question. By seed you mean a PRNG seed or seed as the constrained part?

@bitinn
Copy link
Author

bitinn commented Jun 21, 2020

The only problem is, given the same seed and its outcome, I cannot obtain the same outcome again

Please help me understand your question. By seed you mean a PRNG seed or seed as the constrained part?

The same seed here mean 2 things: (1) The PRNG seed we feed to the WFC run remains the same. (2) Since the constrained seed for each tile is derived from the PRNG seed and tile index, we can guarantee those seeds are order independent as well.

The problem is weight probability has changed due to constraint propagation. So we can no longer obtain the same tile observation result.

My StackOverflow question might be better phrased:

https://stackoverflow.com/questions/62490854/order-independent-weighted-random-selection

@mxgmn
Copy link
Owner

mxgmn commented Jun 21, 2020

My StackOverflow question might be better phrased

I see. So you're trying to get the same result from 2 different constrained parts. Just interesting, why would you want to do this?

You can fix the order of observation. Or you can generate result from the first constraint, save this result, and use the choices from the save when generating from the second constraint.

@bitinn
Copy link
Author

bitinn commented Jun 21, 2020

My StackOverflow question might be better phrased

I see. So you're trying to get the same result from 2 different constrained parts. Just interesting, why would you want to do this?

You can fix the order of observation. Or you can generate result from the first constraint, save this result, and use the choices from the save when generating from the second constraint.

Imagine this workflow: generate a texture, pick a part of it as constraint, use them to generate again.

Preferably, you want the 2nd result to remain the same, and then you change the seed to get different output.

But in reality the 2nd result won't match, because constraints reduce entropy, so we cannot obtain the same result even though we know it's one of possible solution.

So yeah, it looks like I need to save some more information.

@mxgmn
Copy link
Owner

mxgmn commented Jun 21, 2020

Imagine this workflow: generate a texture, pick a part of it as constraint, use them to generate again. Preferably, you want the 2nd result to remain the same, and then you change the seed to get different output.

I see. Yeah, the simplest solution would be to just save the first result, or save the order of observation.

@mxgmn mxgmn closed this as completed Jun 21, 2020
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