Procedural castle with geometry nodes

Hello @pitibonom, and thank you very much for the nice comments !

I’ll try to make a little technical breakdown :
The overall method can probably be made simpler.
Wood structures are relatively simple to do with GN in general, and quite fun too ! you should definitely try it at some point !

One method could be to start with a grid and separate horizontal and vertical edges. That’s something I used to do when working on my abandoned house project.

Here I wanted to try something a bit different, and the idea was to try to reset transforms first to make the job easier. That’s a technique I explored in different places during the project.
It’s along the same lines as how I did my procedural flowers, but in a bit more elaborated fashion.

So , My input is a bunch of faces :

Here are the same faces but with most of their transforms cancelled :


and eventually I get to that result :

I think a much simpler way to do that would be to UV-Unwrap the mesh,
in that case I preferred to make my own solution, the only advantage is that I can make sure the faces stay oriented the same way (up/down), so I can use the same system for other things like doors for instance ! And anyway the main goal of that project was to try to do things the hard way …

Ok, so this transform cancellation is really the most complicated step in the process.
And now I can take advantage of that simplified setup :

A face :

turned into planks :

This is how I do it :
First, I separate the topmost edge :


This is easy since all the faces lays into the ground thanks to the simplified setup.
So if a point got it’s Z location ~= 0 , we can remove it, and we can convert the remaining edge into a curve.

We can resample that curve and get an array of curves :
Here again , we can take advantage of the fact that the faces lays on the ground, so we can set the Z position of the endpoints of the curves to 0.

Then I use a few utility nodegroups, one that allows to split curves in half, the other allows to transform curves using either their start, center, or end :

That way it’s super easy to add randomness,
Here is how these groups looks like:

In the meantime, I do something a bit similar with horizontal lines:

They got their share of splitting and randomization :

And eventually I delete nearly all of these and merge that with the previous curves :

And when everything is passed through a curve to mesh it looks like that :

There is one last trick to make the cuts a little bit slanted, but this one is a bit longer to explain :


From there it’s all about adding details… Here there are some nails, that are made by taking the planks curves and converting them to points.

I also added an optional frame structure :


Which is using the original face’s edges, and reused a few curves made earlier.

Thanks to the transform cancellation, it’s more of a 2D problem than anything else.

The last element was some hanging ropes, which is one of my main personal mantra : “It always looks cooler with hanging ropes”.

And while everything else was easier to do because everything was aligned to the world and kind of 2D, in that case I had to do a few juggling to get the original face’s orientation so the ropes can hang in the right direction. Which looks a bit weird with the transform cancellation.

Finally once everything is done, I can transfer the original faces position and rotation, and put everything back into place :

That same basic technique to cancel face transform was used in other places , like to generate these doors :

Since I was trying a lot of stuff, I won’t say that it’s the best way to make a setup like that.
If I had to redo the same thing in a more professional environment I’d probably try to make some stuff in a much more simpler way, or maybe I’ll realize that I don’t even need to cancel transforms ( or that it’s possible to do it in a more simpler way).
A good example is the ropes, I was probably possible to add them once the transforms was restored, but I though it was a fun challenge to try to orient them before resetting transform.

Don’t hesitate to ask if you have further questions !

18 Likes