Help distributing procudurally windows along wall

So far, I have a procedural building system that places windows along the surface of a wall using spline points for the length. But I can’t seem to find a way to get them to spread along the whole surface. Anyone have any ideas?

This is what it looks like so far.

I’d switch to integers for width and height count with a double for loop. Splines are much more complicated to work with. I only use them if I need meshes to bend.

In this case where the building is flat the spline is kinda useless

In practice there could be a better possibility but that needs some work to prepare - your own custom BP that will lay it around, it’s not that hard to create, more time consuming

Normally buildings meshes come already with windows xD

And it makes sense as having multiple actors separately instead of having a full model (that you can also modify to be a less detailed mesh by distance) is just power consuming to update them all at all times

The less actors the better, I know that because placing 10k static mesh planes (yes, a single flat square) drops to ~10fps

But after I used an Instanced Static Mesh I used only one actor that I drew over the viewport a fractal - I had still over 20fps with over 200k of those planes

The problem was so called “draw calls” and you may encounter that too if you will overhaul the map with actors that are totally unnecessary instead of using proper meshes

Can you show how you are distributing them?

I cannot show as I don’t do it

I mean, I have no projects for something like that as for me there’s no point in adding a cube then windows afterwards (besides if the Window should have any functionality)

If windows are static - I wouldn’t recommend what you try to achieve

If Windows are BP’s (so you can f.ex. Open and close them) - you would need a new Actor with its own rules

I would personally use some line traces on Construction Script to detect walls, if no wall is found behind - don’t add any window, if there was - add some

Also you would need some math for distributing them along all 3 axis - XYZ

So basically it’s just unnecessary work that’s additionally inefficient for the Game (not for your placement because if you make such working Actor it will work for you but later in the game it may suck out your Memory and add Draw Calls) :man_shrugging:

Yeah using the spline mesh component was kinda useless.

@UnrealSolver I am now using splines to draw the shape of the building and then made a few template meshes for the windows and walls. Then used the double for loop and width from @Astaraa suggestion. Instead, I used the H-instanced static mesh coz it has LOD just to squeeze some extra performance out of it. Thanks for the suggestions

Building

1 Like