Wall building in a level-editor

Yes, it’s a great game. I’m fascinated by its complexity.
Isn’t the math to do such an extrusion quite complex on a triangular mesh in order to not get any hidden faces or overlapping lines? I tried doing it in Blender for testing, but that was difficult.

Not really, but it was a bit tricky to find a general solution. I might publish the library when i have time, the simplest thing to with it is building the mesh. Maintaining the layout and the actual mesh are 2 different steps.

I’m not exactly sure how it is done in Sims exactly, it could be just based on a grid as you always are working in one and you’re limited to 2 axes + diagonal. For the mmo i’m using it for i use a raster and a few other restrictions too so people don’t get too crazy.

What you also want to avoid (especially with a different wall thickness) is edge cases where a thick wall would intersect into another wall, or 2 very steep joining walls sticking with their tip through another wall. You can either reject this or use a solution like caps, though you shouldn’t waste time thinking about union something another time, having always a wall baseline with it’s segments is managable. In my game you can also auto-lower or hide the walls where the camera is viewing inside, there needs to be a definition of what is a wall, the mesh is just a visual representation.

1 Like

It’s impressive. I don’t understand why I haven’t found more people doing it this way. Maybe it’s just too creative.

1 Like

Its not a problem I managed to solved before I gave up.

And this is how Sweet Home 3D solves it.

1 Like

Different thinkess isn’t a issue ^^ what i meant is a wall so thick, that it starts to absorb the wall of the other side of a room.

How did you deal with UV coordinates and texturing? I discovered a problem when one wall was twice as long as another, and repeating the texture wouldn’t solve it, as that would repeat it for the whole mesh, and mess up the shorter wall. I can’t see how changing UV coordinates for individual vertices could fix this either, as there are six vertices per plane no matter the length of the wall.

The segments lengths/offsets of the room outline are known, the wall texture is made for the minimum length a wall and can break at corners or relax/stretch across the patch to close seamlessly (distortion not visible if the texture isn’t too long, depending on how much it can vary there might be some displacement changes though when adding more walls to a room). When working restrictive in a raster with fixed units and a fixed wall thickness none of that is necessary.

There should be 4 ^^

Yes, everything is known. That’s not the issue. The issue is repeating the pattern in practice. I usually use texture.repeat(). But if I do that here, then it will repeat twice as much as required on a wall half the length. You meantion stretch instead of repeat, is that because you don’t tile your textures? I have a seamless texture for the smallest possible segment.

Each plane should be triangulated, but after tutorials on this particular subject I’m also seriously confused (but that’s for another thread). I might have misunderstood, but I’m unable to build a GeometryBuffer that’s not triangulated, and thus not able to build a plane which is not triangulated either.

In a indexed geometry you only define 4 positions/vertices and define the triangles connecting these.

The texture is repeated in the UVs not in the texture. When you build the geometry and a wall is 4 times the base length the UVs go from 0 to 4 plus the offset of the previous segment.

Oh! I’m new to the game.

That’s really cool! I didn’t know I could do that. I just thought of UV from 0 to 1. I don’t have much experience outside of 3D software where it’s just visual.

Hey, I also did a wall editor, but for now, its only capable of connecting two walls at a time. I basicly have a list of points, I calc the angle between two of them, make a quad and apply the rotation to it. After that im connecting the walls to each other, two at a time. I move the vertices of the quads to the calculated intersecting points, which works great.
But now I want to extend my editor, that each corner can have multiple walls connected with arbitrary angles as you did @Fyrestar. Each wall should still be a single mesh.

I started from zero and im kinda stuck here… I came up with nodes. Nodes can connect to other nodes. Then I can calc the angle and basicly do the same thing as before, make quads and rotate them. But there is the first issue, which node is the starting point and which the end, which node gonna draw the actual wall? This is solvable, but had gave me a little hadache.
The other problem im having is finding the walls that are directly next to each other, to calculate the intersection point.

Would be great if you could lead me in the right direction. Id be happy with any article or code you can give me.
This image made me look up how photoshop or any other vector graphics sw is joining multiple paths, but didnt find anything useful.

If i’m correct contour in your function is an array of the corner points. But what profileShape array did you pass to create a nice square wall? Also when you hide a wall would there be an edge or not ?

Your question is not entirely clear to me.

(Related to Construction of frames with contour/profile and ProfiledContourGeometry MultiMaterial)

The program codes were not specifically used to build walls. But you can create simple walls with certain values. You can test it with customized values.

Try out what happens if you also use a totally transparent material.

I created special walls with openings and other things there: Showrooms easy to generate from data of a construction drawing or dimensional sketch - now on Github

I’m also looking into how to build walls. (Used your code here)
With your code createProfiledContourUV or createProfiledContourMMgeometry it’s possible.
But i have a hard time to understand what the values for the shape are or should be to just create a square wall like in your example.

After so many years, I also had to look at how I used the coordinates.

I should have documented it better. :roll_eyes:

You also have to rotate the mesh by 90°, as walls behave in the same way as door and window frames (for which the coordinates were intended).

Picture: 36er walls 2.5 high

profileShape2: cross-section around the origin
contour2: around the origin

const profileShape2 = [ 
    -0.36,  2.5, 
     0.36,  2.5, 
     0.36, -2.5,
    -0.36, -2.5, 
    -0.36,  2.5 
];

const contour2 = [
     -10, -6,
      10, -6,     
      10,  5,
      
       3,  5,
       3,  9,
      -8,  9,
      -8,  6,
      
     -10,  6,
     //use contourClosed true     
];

const frame2 = ProfiledContourUV( profileShape2, contour2, materials, false, true, true );
frame2.rotateX( Math.PI / 2 );
frame2.position.y = 2.5;
scene.add( frame2 );

const axesHelper = new THREE.AxesHelper( 5 );
scene.add( axesHelper );

But as already mentioned, wall openings such as windows and doors are not possible here.

Wow, that works really good!!
Is it also possible to have no stretched UV on the wider wall?
Because i cant work with repeat values here cause it changes the whole mesh.
The adjustment to the UV has to be made while creating the geometry somehow right?