For this project we were required to create 3 biomes using landscape painting, a road via splines, and a village via splines. I learned about PCG data assets to randomize my house meshes further.
The ground materials I used already came as functions, so I was able to plug them into the landscape layer right after adding an output for the height. These layers appear as double/float attributes in the PCG, which we can filter off of.
The overall formula for everything is the same: sampling the surface, culling points that overlap with the future road and village houses, filtering out the other biomes and getting the distance against those, and adding a point grid around those points and spawning smaller foliage on them.
To make a nicer falloff gradient for smaller foliage like my grass and flowers, I lerped between the distance gradient and some noise. I set the noise max very low and used Density Filter to get rid of everything below 0.2.
This was one of my first attempts to use Shape Grammar, though I couldn't figure out what I did wrong. I intended to randomize which one out of 2 meshes would be spawned, but it defaults to only one of them. I did still learn how to spawn spline meshes through an attribute rather than in the node itself.
Looking at the attribute list here, we can see the mesh path has 2 variations. Since I'm spawning a spline mesh, I have to turn the points back into a spline, which loses the attributes. Attempting to copy the attributes back on only brings back one mesh variation.
Spawning meshes based on attribute for a spline mesh works slightly differently from the static mesh spawner. There's an option on the node for override descriptions, and you tell it which attribute to target through that.
This was the most interesting part for me. I used Quixel's Medieval Village project, which includes an example world with buildings scattered around. These houses were built with modkits, not a single static mesh.
By converting the selected meshes/houses into a level instance (right click), the selected area can become its own asset to use. Then right click on it in the content browser, go to Asset Actions and chose Create PCG Assets.
You can now bring the PCG asset into your graph with the Load PCG Data Asset node! copy its points to your target points, and set your static mesh spawner to use attributes.
But the really neat thing is tags. Inside the level instance, you can tag meshes (and groups) just like you could with actors. I tagged things like moss, fences, and clutter. Then with attribute filters I randomized how many features actually would appear on each individual house.
I scattered some wagons, benches, and crates around based off a circular space around each house. The Create Points Sphere can spawn a circle if you set the Latitudinal start and end angles to 0.