Model synthesis: Difference between revisions

Content deleted Content added
m Jack4576 moved page Model Synthesis (algorithm) to Model Synthesis: The bracket "(algorithm)" is not needed, as a disambiguation is not needed. it was a hangover from when a disambiguation was needed from when this was called wave function collapse
ce
 
(20 intermediate revisions by 11 users not shown)
Line 1:
'''Model Synthesissynthesis''' {{A.k.a}} '''wave function collapse''' or '''<nowiki/>'wfc'''' isare names for a family of [[Constraint solving|constraint-solving]] [[algorithm]]s commonly used in [[procedural generation]], especially in the [[Videovideo game industry|videogame industry]].
 
Some video games known to have utilized variants of the algorithm include ''[[Bad North]]'', ''[[Townscaper]]'', and ''[[Caves of Qud]]''.
The algorithm was first described by Paul Merrell, who named it 'model synthesis' in a 2007 PhD thesis, later presented at the 2008 [[SIGGRAPH conference]]. The name 'wave function collapse' later became the popular term for the algorithm, after an implementation by Maxim Gumin was published in 2016 on Github [[Repository (version control)|repository]] bearing that name. Variants of the algorithm have become widely adopted and adapted by technical artists and game developers, especially following Gunim's popularisation of the algorithm.<ref>{{Cite conference |last1=Alaka |first1=Shaad |last2=Bidarra |first2=Rafael |chapter=Hierarchical Semantic Wave Function Collapse |date=2023 |title=Proceedings of the 18th International Conference on the Foundations of Digital Games |chapter-url=https://doi.org/10.1145/3582437.3587209 |journal=Foundations of Digital Games 2023 (FDG 2023) |pages=2 |doi=10.1145/3582437.3587209 |isbn=978-1-4503-9855-8 |quote=In 2016, Maxim Gumin unleashed the WFC algorithm, publishing a repository containing his initial implementation. Since then, WFC has had a profound impact on technical artists and game developers, getting adopted, adapted and used in commercially published and upcoming projects (Caves of Qud, Townscaper, Matrix Awakens).}}</ref>
 
The first example of this type of algorithm was first described by Paul Merrell, who namedtermed it 'model synthesis' first in ahis 2007 PhDi3D thesis,paper later<ref>{{cite book |last1=Merrell |first1=Paul |chapter=Example-based model synthesis |title=Proceedings of the 2007 symposium on Interactive 3D graphics and games |date=April 2007 |pages=105–112 |doi=10.1145/1230100.1230119 |isbn=978-1-59593-628-8 |url=https://paulmerrell.org/wp-content/uploads/2021/06/model_synthesis.pdf}}</ref> and also presented at the 2008 [[SIGGRAPH conference]] and his 2009 PhD thesis.<ref>{{cite book |last1=Merrell |first1=Paul |title=Model Synthesis |date=2009 |location=Chapel Hill |url=https://paulmerrell.org/wp-content/uploads/2021/06/thesis.pdf}}</ref> The name 'wave function collapse' later became the popular termname for thea variant of that algorithm, after an implementation by Maxim Gumin was published in 2016 on Githuba GitHub [[Repository (version control)|repository]] bearingwith that name. Variants of the algorithm have become widely adopted and adapted by technical artists and game developers, especially following Gunim's popularisation of the algorithm.<ref name=":0">{{Cite conferencebook |last1=Alaka |first1=Shaad |last2=Bidarra |first2=Rafael |chapter=Hierarchical Semantic Wave Function Collapse |date=2023 |title=Proceedings of the 18th International Conference on the Foundations of Digital Games |chapter-url=https://doi.org/10.1145/3582437.3587209Hierarchical |journal=FoundationsSemantic ofWave DigitalFunction GamesCollapse |date=2023 (FDG 2023) |pages=2 |doi=10.1145/3582437.3587209 |isbn=978-1-4503-9855-8 |quote=In 2016, Maxim Gumin unleashed the WFC algorithm, publishing a repository containing his initial implementation. Since then, WFC has had a profound impact on technical artists and game developers, getting adopted, adapted and used in commercially published and upcoming projects (Caves of Qud, Townscaper, Matrix Awakens). |chapter-url=https://doi.org/10.1145/3582437.3587209}}</ref> Gumin's implementation significantly popularised this style of algorithm, with it becoming widely adopted and adapted by technical artists and game developers over the following years.<ref name=":0" />
Gunim's initial implementation was inspired by Paul Merrell's dissertation, the ideas of [[quantum mechanics]], and [[convolutional neural network]] style transfer.<ref>{{Cite YouTube |url=https://www.youtube.com/watch?v=FG3LbcOGHqw |title=Procedural Modeling Using Graph Grammars |date=Aug 6, 2023 |last=Merrell |first=Paul |type=Video |language=English |time=3:13}}</ref><ref>{{Cite web |date=2021-03-21 |title=Implementing Wave Function Collapse & Binary Space Partitioning for Procedural Dungeon Generation |url=https://blog.shaankhan.dev/implementing-wave-function-collapse-binary-space-partitioning-for-procedural-dungeon-generation/ |access-date=2024-03-24 |website=Shaan Khan |language=en |quote=In the case of WFC it is inspired off three distinctive but functionally similar algorithms& concepts; Texture Synthesis (Specifically Discrete Synthesis), Markov Chains & Quantum Mechanics. WFC was also additionally inspired by convolution neural network style transfer (CNN Style Transfer).}}</ref> The popular name for the algorithm, 'wave function collapse', comes from an analogy drawn from the concept of [[Superposition principle|superposition]] in [[quantum mechanics]].<ref name=GitHub-Gumin>{{Citation |last=Gumin |first=Maxim |title=Wave Function Collapse Algorithm |date=September 2016 |url=https://github.com/mxgmn/WaveFunctionCollapse |access-date=2024-03-24}}</ref><ref>{{Cite web |title=The Wavefunction Collapse Algorithm explained very clearly |url=https://robertheaton.com/2018/12/17/wavefunction-collapse-algorithm/ |access-date=2024-03-24 |website=Robert Heaton |language=en}}</ref> Whilst inspired by quantum physics, the algorithm doesn't rely on ideas from that field. One innovation in Gunim's implementation was the use of overlapping patterns of tiles instead of individual tiles, allowing a single image as an input to the algorithm.<ref>{{Citation |last=Gumin |first=Maxim |title=Wave Function Collapse Algorithm |date=2016-09 |url=https://github.com/mxgmn/WaveFunctionCollapse |access-date=2024-03-25}}</ref>
 
Gunim'sThere initialwere implementationa wasnumber inspiredof byinspirations Paulto Gumin's implementation, including Merrell's PhD dissertation, the ideas offrom [[quantum mechanics]], and [[convolutional neural network]] style transfer.<ref>{{Cite YouTubeAV media |url=https://www.youtube.com/watch?v=FG3LbcOGHqw |title=Procedural Modeling Using Graph Grammars |date=Aug 6, 2023 |last=Merrell |first=Paul |type=Video |language=English |time=3:13}}</ref><ref>{{Cite web |date=2021-03-21 |title=Implementing Wave Function Collapse & Binary Space Partitioning for Procedural Dungeon Generation |url=https://blog.shaankhan.dev/implementing-wave-function-collapse-binary-space-partitioning-for-procedural-dungeon-generation/ |access-date=2024-03-24 |website=Shaan Khan |language=en |quote=In the case of WFC it is inspired off three distinctive but functionally similar algorithms& concepts; Texture Synthesis (Specifically Discrete Synthesis), Markov Chains & Quantum Mechanics. WFC was also additionally inspired by convolution neural network style transfer (CNN Style Transfer).}}</ref> The popular name for the algorithm, 'wave function collapse', comesis from an analogy drawn frombetween the algorithm's method and the concept of [[Superposition principle|superposition]] and observation in [[quantum mechanics]].<ref name="GitHub-Gumin">{{Citation |last=Gumin |first=Maxim |title=Wave Function Collapse Algorithm |date=September 2016 |url=https://github.com/mxgmn/WaveFunctionCollapse |access-date=2024-03-24}}</ref><ref>{{Cite web |title=The Wavefunction Collapse Algorithm explained very clearly |url=https://robertheaton.com/2018/12/17/wavefunction-collapse-algorithm/ |access-date=2024-03-24 |website=Robert Heaton |language=en}}</ref> WhilstSome inspiredinnovations by quantum physics, the algorithm doesn't rely on ideas from that field. One innovationpresent in GunimGumin's implementation wasincluded the useusage of overlapping patterns of tiles instead of individual tiles, allowing a single image to be used as an input to the algorithm.<ref>{{Citation |last=Gumin |first=Maxim |title=Wave Function Collapse Algorithm |date=September 2016-09 |url=https://github.com/mxgmn/WaveFunctionCollapse |access-date=2024-03-25}}</ref>
Prior to the algorithm's popularisation by Gumin, Merrell & Moncha's implementation didn't catch on in popularity to the same degree. Some have speculated that this may have been due to their implementation's lower accessibility, its 3D focus, or computing constraints at the time.<ref>{{Cite conference |last=Alaka |first=Shaad |chapter=Hierarchical Semantic Wave Function Collapse |date=2023 |title=Proceedings of the 18th International Conference on the Foundations of Digital Games |chapter-url=https://doi.org/10.1145/3582437.3587209 |journal=Foundations of Digital Games 2023 (FDG 2023) |pages=2 |doi=10.1145/3582437.3587209 |isbn=978-1-4503-9855-8 |quote=Years before, Merrel had published the conceptually identical Model Synthesis algorithm, though it did not catch on as much as WFC did, possibly due to its lower accessibility, main 3D focus and computing requirements at the time.}}</ref>
 
PriorSome tohave thespeculated algorithm'sthat popularisationthe byreason Gumin, Merrell & Moncha's implementation didn'tproved catchmore onpopular inthan popularity to the same degree. Some have speculated that thisMerrell's, may have been due to theirthe 'model synthesis' implementation's lower accessibility, its 3D focus, or perhaps the general public's computing constraints at the time.<ref>{{Cite conferencebook |last=Alaka |first=Shaad |chapter=Hierarchical Semantic Wave Function Collapse |date=2023 |title=Proceedings of the 18th International Conference on the Foundations of Digital Games |chapter-url=https://doi.org/10.1145/3582437.3587209 |journal=Foundations of Digital Games 2023 (FDG 2023) |pages=2 |doi=10.1145/3582437.3587209 |isbn=978-1-4503-9855-8 |quote=Years before, Merrel had published the conceptually identical Model Synthesis algorithm, though it did not catch on as much as WFC did, possibly due to its lower accessibility, main 3D focus and computing requirements at the time.}}</ref>
One of the differences between Merrell & Gunim's implementation and 'wave function collapse' lies in the decision of which cell to 'collapse' next. Merrell's implementation uses a scanline approach, whereas Gunim's always selects as next cell the one with the with the lowest number of possible outcomes.<ref name=Merrell2021>{{Cite web |last=Merrell |first=Paul |date=28 July 2021 |title=Comparing Model Synthesis and Wave Function Collapse |url=https://paulmerrell.org/wp-content/uploads/2021/07/comparison.pdf |quote=The first difference is in the step where we choose a cell and pick a label. The cells are chosen in a different order. Model synthesis sweeps through the grid in scanline order. WFC chooses the lowest entropy cell.}}</ref>
 
One of the differences between Merrell & GunimGumin's implementation and 'wave function collapse' lies in the decision of which cell to 'collapse' next. Merrell's implementation uses a scanline approach, whereas GunimGumin's always selects as next cell the one with the with the lowest number of possible outcomes.<ref name=Merrell2021>{{Cite web |last=Merrell |first=Paul |date=28 July 2021 |title=Comparing Model Synthesis and Wave Function Collapse |url=https://paulmerrell.org/wp-content/uploads/2021/07/comparison.pdf |quote=The first difference is in the step where we choose a cell and pick a label. The cells are chosen in a different order. Model synthesis sweeps through the grid in scanline order. WFC chooses the lowest entropy cell.}}</ref>
 
== Description ==
The WFC or 'model synthesis' algorithm has some variants.<ref Gunimname="GitHub-Gumin" /> Gumin and Merrell's implementations are described below, and other variants are noted:
 
=== GunimGumin's implementation<ref name=GitHub-Gumin/> ===
 
# The input bitmap is read, and the patterns present within the bitmap are counted.
Line 24 ⟶ 26:
 
=== Merrell's implementation ===
Merrell's earlier implementation is substantially the same as GunimGumin's with some minor differences.
 
(1) In Merrell's version, there is no requirement to select the cell with the lowest number of possible output states for collapse. Instead, a scanline approach is adopted. According to Merrell, this results in a lower failure rate of the model without any negative effect on quality.<ref name=Merrell2021/> Some commentators have noted however that the scanline approach to 'collapse' tends to result in directional artifacts.<ref>{{Cite AV media |url=https://www.youtube.com/watch?v=zIRTOgfsjl0 |title=Procedural Generation with Wave Function Collapse and Model Synthesis {{!}} Unity Devlog |date=Apr 17, 2023 |last=DV Gen |type=Video |language=English |time=15:13 |quote=Unfortunately, this method can introduce directional artifacts.}}</ref>
 
(2) MerrelMerrell's implementationapproach is capable of performingperforms the algorithm in blockschunks, rather than all-at-once. ForThis thisapproach reason,greatly itreduces isthe lessfailure likelyrate tofor result in failure formany large complex models in a reasonable amount of time; especially forin a 3D space.<ref name=Merrell2021/>
 
== Developments ==
Line 37 ⟶ 39:
== References ==
{{Reflist}}
 
== External links ==
* https://github.com/mxgmn/WaveFunctionCollapse
 
[[Category:Combinatorial algorithms]]
Line 44 ⟶ 49:
 
{{Software-stub}}
{{VideogameVideogaming-stub}}
{{Algorithm-stub}}