Trying to create a roof generator: some questions

Hi all,
I’m trying to create a roof generator using GN and as I’d like to create by myself I’d like to have some hints that could me drive to the goal.
The goal is to distribute the roof tiles on a low poly model of the roof.
At the moment I’m stuck with some problems and I’m not able to clearly understand how to proceed.
I’ve seen some tutorials about this subject but any of these adapts the distribution following the base mesh.
For example there is a tutorial that uses mesh line node to create the roof tiles grid and here the first question: is it possible to create a grid using mesh line that could be positioned and rotated for every face of the base mesh?
At the moment I’m quite satisfied with finding a way to read the face orientations but now I can’t create a grid.

I have another idea how to orient a grid for every face and I’m thinking to use the sharp attribute I set in the base mesh.
immagine

Am I near the best approach to do this kind of task or am I really out-of-track ?
Thanks in advance for any helps

It’s hard to tell if you are in a dead end until you hit the wall…

I’ve tested two approach :
The simplest is to create UV on your lowpoly mesh and use those to position the tiles. This works well and allow to deal with different kind of shapes.

The second one is the one I used in my house generator, and the technique is basically to instance a grid on each face. This works ok but it’s a bit harder than it sounds to make it work well. At least I can help and describe a bit more how it works if needed. Even tho I think UV are simpler and works better.

Thank you for sharing your experience.
A question about UV method.
Do you create the UV dynamically using GN or do you create manually?
These UVs, should they be create in an orthogonal way? I mean, U and V directions must be 90° each other?

1 Like

Yes the idea is that you create the UV manually, it’s very similar to projecting a texture but instead you create geometry.

Yeah probably, basically you want as less deformation as possible, unless that’s what you want.

Another thing to keep in mind is that you don’t want UVs to overlap as you’ll get errors : A texture can repeat itself over and over but with geometry it doesn’t work that way.

Anyway, once you know how to project geo onto another object you’ll find many application of that technique !

Good luck and feel free to ask further questions if needed !

I’ve made a bit of research and I’ve quite understood the logic behind this.
Seems that the UV method uses the Sample UV surface.
Now I’m here

Is it something similar the method you suggested me before?

1 Like

Yeah that’s it ! well done !
My approach was using splines instead of a grid :

But looking at what you did using a grid might be simpler.
The main advantage of the spline is that you can resample them to the size of the tile. You also have access to the curve’s tangent to orient them.
That said, I don’t think I managed to get the spacing of each splines, so that value had to be entered manually…

But in your case you can probably capture the normal of the grid just before the point conversion, and there are probably some ways to automate some stuff too.

Keep up the good work !

4 Likes

I’d like to found a way to do it as the grid node has just outputs and, until now, I wasn’t able to do it… I’ve to study more and more :slight_smile:

hum, the normal node give you the normal of any geometry, and you can capture that with capture attribute node before the mesh to point conversion…
I’ll try to make an example if you’re still stuck !

1 Like

I’ll check… I’m quite sure I’ve tried but with no luck…but wait, I’ll check again and I’ll retry…If I’ll still stuck I’ll try to call an help from home (I don’t know if the TV quiz outside Italy uses this option… :slight_smile: )

hahaha calling a friend seems famous in many TV quiz indeed !

I saw that @zeroskilz suggested this tutorial.

I think I have to watch it before going on because actually there are some key concepts still not so clear in my mind…and as yesterday I’ve tried again, with no luck, to rotate the points according to the face normals, I’ve to consider to improve my knowledge so I’ll study that tutorial.

I’m continuing my study about this and arise one consideration and question:
as I’d like to have a system where I can add this GN to a multifaces object that represent the roofs of several houses, I’m thinking that an UV way to distribute the tiles will be a little a pain… In my mind, I’m imaging a system that “analyze” every face of this multifaces object, measure the area, divide it by the roof tile dimensions (so I can found how many of them I need)… so it’s more flexible and doesn’t need any human interaction.
Do you think it make sense?

1 Like

Well, does the issue comes from having to manually UV unwrap all objects, or just the multi-object handling ?

I agree that it might become a bit tricky depending on your level and the amount of insight you need.
Basically the trick here is to do some procedural modification on the UV to put them one after the other , so kind of packing if you will, so they don’t overlap.

Or you might try the other option I mentioned earlier that was instancing a well subdivided grid on each face and remove what’s outside.
It’s simple at the beginning but there are a few caveat not easy to solve…

Finally if you have things working for one object, you can always makes things work for multiple by using a repeat node.

hope that helps to get you on track again !

Well, I’ve found that the way the UVs are made, obviously influences the points distribution and scale.

I’m already facing 2 problems :slight_smile:
First is to pass the normal of the underlying geometry to the roof tile
Second to orient the roof tile following the orientation of the longest edge of every face.
I’m quite sure that this is more due to my (un)knowledge :slight_smile:

I’ve thougth to this but reading @zeroskilz suggestions in another thread I’ve shift my thoughts to another approach… Do you think that suggestions suited to my project or not?

Yes, it helps to clear my mind.

The simplest way is to do a sample nearest surface , so you transfer the normal of your base object to the instances. There are probably more clever ways , but this should at least give you a quick and dirty result.

Not sure you really need that. You can use an align euler to vector node and use 0,0,1 as vector, this will assume the houses are always oriented naturally to the Z axis.
From there, you just have to account for the normal, so with a second align euler to vector you take care of that final orientation.
Didn’t check so take these advice with a grain of salt, but that’s probably something along these lines.

Hum , giving it a quick look this could work but I’d probably try something else.
Maybe do a quick test to see if that sound like a promising road to take.

1 Like

Yeah, I agree with Sozap - I would use curve lines as the base building block - the only thing you can really take from that other thread is to store values on faces that you can use later.

Good luck!

Wait, before you waist your time…as suggestion I mean that zeroskilz suggests this “Abusing the repeat-zone as you have is exactly the way the devs have asked us not to use geometry nodes as it goes against SIMD”…
But if you found something useful in that post… I’ll leave you to explore your ideas :slight_smile:

There are ways you can approach this problem without the Repeat Zone… but at the end of the day you need to do what makes sense to you.

I have been working on a roof generator for a long time and as you can see I’ve had to resort to a Repeat Zone to do the edge culling:

Good luck.

3 Likes

Ok, sorry we might misunderstood each other, I though you where suggesting using a tessalate node/approach to add the tiles.

That’s true indeed since it tends to make things slower, on the other hand abusing this node might help a lot in some situation to get a result in a much simpler way.

You might not need super fast performances (like with an animation setup) and it’s always possible to prototype with this methods and once you have something working you look for better way of getting the same result !

2 Likes

I’d like to avoid to add misunderstanding over misunderstanding but in that specific phrase I was relating to the dange of “abuse” of the repeat zone, but… another approach I was thinking was to tessellate every face to get the face center where instance the roof tiles… too many approaches in my head and too low GN knowledge to prototipe them… :slight_smile: