unity-wave-function-collapse icon indicating copy to clipboard operation
unity-wave-function-collapse copied to clipboard

How to use?

Open selfsame opened this issue 8 years ago • 16 comments

Feel free to ask general questions in this issue!

selfsame avatar Oct 29 '16 15:10 selfsame

Is it possible to use this with 3d tilesets?

aman-tiwari avatar Nov 04 '17 20:11 aman-tiwari

@aman-tiwari yes you can use 3d objects as tiles, but the algorithm works on a 2D grid

selfsame avatar Nov 04 '17 20:11 selfsame

Ah okay, I meant generating stuff over a 3D grid. Thank you!

aman-tiwari avatar Nov 05 '17 03:11 aman-tiwari

Could you please cover how to create the prefabs required as input for the tile painter?

hmihalis1 avatar Jul 21 '18 09:07 hmihalis1

@hmihalis1 The prefabs need to be under a Resources directory so they can be instantiated during generation. (You drag an object into a directory in the hierarchy to convert it to a prefab.)

In the tile painter, you drag prefabs into the pallet property to make them available for painting (You can drag an entire folder of prefabs as well.)

The pallet options will then show up in a row below the TilePainter grid, and you can select a "color" by holding 'S' and clicking on them in the inspector.

Let me know if you have any more questions, I might do a better youtube tutorial at some point as well.

selfsame avatar Jul 21 '18 11:07 selfsame

Hi Joseph, thanks for responding. I followed the tutorial you made on procjam and have so far got the overlapping model working with a basic cube. In the youtube tutorial you also have a triangle polygon, which you use to create slightly more complicated shapes, it would be good to know how to go about producing these prefabs, as the process of producing and importing geomettry from 3d platforms into unity is always rife with errors and difficulties in my experience. I will try to get the tiling example working tomorrow, and will let you know what problems I run into. It would also be great to know how to work with 3d shapes and how to stop the algorithm and export the generated geomettry. Many thanks, H

hmihalis1 avatar Jul 21 '18 20:07 hmihalis1

@hmihalis1 oh that's more of a general unity question. I use blender for object modelling, but most programs that can export obj or fbx files should be suitable.

I don't know of any way to export object groups from Unity, perhaps there's a plugin out there.

selfsame avatar Jul 22 '18 22:07 selfsame

thanks, i'm having a bunch of troubles replicating your tutorial setup, is there any chance you could send the unity project or just the simple resources folder you are using for it?

On Sun, Jul 22, 2018 at 11:44 PM, Joseph Parker [email protected] wrote:

@hmihalis1 https://github.com/hmihalis1 oh that's more of a general unity question. I use blender for object modelling, but most programs that can export obj or fbx files should be suitable.

I don't know of any way to export object groups from Unity, perhaps there's a plugin out there.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/selfsame/unity-wave-function-collapse/issues/1#issuecomment-406902947, or mute the thread https://github.com/notifications/unsubscribe-auth/AJWgWykqm8f1hCQ7YyCjwNT9JdeM6EjGks5uJQBRgaJpZM4KkImh .

hmihalis1 avatar Jul 27 '18 15:07 hmihalis1

Do you by chance know how to go about modifying the SimpleTiledWFC script to force it place tiles with a specific tag in a slot before running the algorithm? For example placing a "terrain" tile on all [width, 0] slots to generate levels for a 2D side scroller.

I'm really new to Unity and coding in general, and I'm using this algorithm for a school project (btw thanks so much for doing the work to get this into Unity and be so user friendly!)

jasonmulligan3 avatar Mar 27 '19 02:03 jasonmulligan3

@jasonmulligan3 hey sorry for the delay.

If you just want a ground row the Overlap model has a foundation property that will do a row with a specific tile. You have to experiment with the number to find the right tile type because it corresponds to the internal chunk index, not the tile index.

The Tiled model doesn't have a foundation prop, but both algorithms should be moddable to work with 'constraints', or preset tiles that it solves around. I failed trying to implement that with the Overlap but the Tiled might be easier because your working with single tiles not chunks.

User constraints = setting some of wave coefficients to false.

Here's a few notes from the WFC creator on constraints:

11 Jun 2017 User constraints = setting some of wave coefficients to false.

Ground is a custom constraint: we set all non-ground patterns at the bottom row to false and the ground pattern at the non-bottom rows to false.

Just don't forget to propagate those changes

If you do look into it and get something working let me know!

selfsame avatar Mar 30 '19 00:03 selfsame

@selfsame No worries! Thanks for responding. I'm going to be playing around with it to see if I can get everything working over the next couple days

jasonmulligan3 avatar Mar 30 '19 13:03 jasonmulligan3

Fixed! I really need to learn how to take whole tilesets and use those as object inputs for the generation.

TheodoreGalanos avatar May 17 '20 03:05 TheodoreGalanos

Hi Theodore,

Not sure what your trying to use it for but there’s a new implementation of this code in Houdini with a detailed video tutorial on it. Just google Houdini wave function collapse. :)

On Sun, 17 May 2020 at 04:12, TheodoreGalanos [email protected] wrote:

I wish this was made a bit clearer in the video. I understand I belong to the few that don't know much about Unity but I found myself trying to figure out how to import an .obj file and make the scene work (I'm creating both 2d and 3d objects in Rhino, saving as .obj.

I keep getting a null object when trying to use them as tiles, they also don't appear under the grid like in your video.

I wonder if there can be a small additional part with information on this part?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/selfsame/unity-wave-function-collapse/issues/1#issuecomment-629736135, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACK2AWYU4RTIDDJXLXHJB7TRR5IZVANCNFSM4CUQRGQQ .

hmihalis1 avatar May 17 '20 08:05 hmihalis1

Hi,

I'm trying to recreate the Flowers example from the original implementation but I'm struggling with it. I'm using Overlap model, N = 3 and it works fine with periodic input and output and it usually doesn't spawn the dirt at the ground level (as expected). In the original repo, there are always two layers of dirt at the bottom. However, when I turn off the periodic input and output trying to match it, the generation will fail almost every time. When I go over the generation, most of the time it won't generate a ground at all and then it will get stuck.

My question is whether this is intentional or if it should record the tiles on the boundries with periodic input and output set to false? Then those tiles would have the lowest entropy and would be placed first assuming we would start with the propagation from borders.

I wasn't able to make it work using foundation.

Here is a link to original repo image.

Thanks for your time.

fileho avatar Nov 02 '21 15:11 fileho

@fileho Yes i see what you mean, it would need a foundation to recreate those images. It does look like there is something broken with my unity adaptation, AFAIK i had modified it a bit becuase our grid is reversed on the Y axis. Opened an issue to look into repairing it: https://github.com/selfsame/unity-wave-function-collapse/issues/12

selfsame avatar Nov 03 '21 23:11 selfsame

@selfsame Hi, I'm figuring out your code around OverlappingModel, it works, but there are three variables whose purpose is not completely clear to me. They are symmetry, ground and N. I have found values where everything works fine, but I would like to fully understand what is going on. For example, if I set symmetry to something other than 1, Model class crashes somewhere inside with an error when trying to divide by 0. Can you describe what these variables do?

Fluidios avatar Oct 08 '23 13:10 Fluidios