Lazy Model Generation

Bachlor Theses topic
by Maarten Behn


Idea: extend Paper from Paul Merrell



Model Synthesis Algorithm

  1. Give every node every value
  2. Pick a node and choose one Value
  3. Check all other nodes values if they can still exist
  4. Go to 2
  5. Every node has been picked done


Problems with Model Synthesis

  • No partial regeneration when rules change
  • Very hard to write your own rules

Shader Graph / Blender Geometry Nodes / etc.

Every possible configuration is valid?


My Idea


Valid solutions


Dependency


calculate path to all dependencies once in template.


Value types

  • Number (Integer)

  • Number Set

  • Position (Vector3)

  • Position Set

    • All Positions in Volume on a
      • Grid
      • Poissons sampling
  • Build


Amount is defined

  • n global
  • n per other node
  • by other node

Value is defined

  • at Template generation
  • callback at evaluation (Hook)
  • by other node

Implementation

let builder = Builder::new()  
	.number_range(<Name>, |b|{b  
		.ammount(OneGlobal(<Name>))  
		.value(Const(3..=8))  
		.depends_on(<Name>)  
		.knows(<Name>)  
	})  
	  
	.pos(<Name>, |b|{b  
		.ammount(OnePer(<Name>))  
		.value(Hook)  
	})  
	  
let template = builder.build();  

let collapser = template.get_collasper();  
  
for hook in collapser {  
    match hook {  
		NumberRangeHook { index, name } => {  
			let value = collapser.get_dependent(index, <OtherName>)   
			  
		},  
		PosSetHook { name } => {  
			match name {  
				<Name> => {  
				  
				},  
				<Name> => {  
				  
				}  
			}  
		},  
		PosHook { name } => {  
			  
		},  
		Build { name } => {  
			  
		},  
		Undo { name } => {  
			  
		},  
		None => {},  
	}   
}  
  

Generating Geometry

  • Naive: passing a valid solution
  • OR: generating geometry while searching for a valid solution
    • more complex
    • interactive
    • solution search can run in the background
    • system can be used for LOD based generation


Voxel DAG Raytracer


Keep partially collapsed versions on the GPU for fast undo.


Sources

https://paulmerrell.org
https://github.com/mxgmn/WaveFunctionCollapse
https://unity.com/de/features/shader-graph