I have been working on a little sack collection for the Unreal Marketplace. Its only a small project, to be priced at the lowest band available. It took a few days to do as just a fun project, so I thought that maybe it will save someone else a few days of time if its something they needed. The project was to practice some cloth sims to produce some fabric items. I decided to make a collection of sacks which wrapped themselves around potatoes, grains and apples. In the end I ended up simulating the cloth around a proxy potato like shape, and then using particles to actually fill the sacks with the potatoes and apples.
The idea for the marketplace was to turn it into a reusable, modular asset that could be as cheap as possible, while still maintaining a high quality result. As such, I made 4 sacks, and 2 variations of materials for the sacks. The best result was hand painting each one, so sadly they do not share textures, even though their UV’s are extremely similar. The potatoes and apple use an overlapping UV set, and have a second UV for lightmaps. Basically I copied the overlapping UVs which were nice and tidy, and then used an auto-arrange UV to lay them out without overlaps. This gave a much cleaner result than a auto-unwrap or letting Unreal generate its own.
The contents of the sack are unique to each sack, as the shape of the potatoes, apples and grains had to carefully match the shape of the sack. However I designed the UVs so they would all take the same textures, this will save massive amounts of HDD and gpu memory to share those textures, while different meshes that are only a few hundred polys wont hurt it, so I think I struck a good balance on performance.
Lastly since you need to place your content as the same location as the bag, I decided to just make a blueprint script that auto generates a bag, a material and a content for you, so you can just place the blueprint around and it will do the work for you. Because the blueprint script runs in the construction script, random nodes will give a different outcome on every run, so to get around this I used a random seed. With the seed fixed the randoms are not random, so you can get a reliable result every time. To generate a new random I used a bool which you tick on, which forces the construction script to re-run, the bool being true allows a new seed to be generated, and then sets the bool to false.