2
\$\begingroup\$

I really like the idea of modelling pieces of a 3D environment as parts of a modular set and then sticking them together. I would make pieces of wall that were, for arguments sake, 3x3m and then stitch them together.

The thing I can't understand is what happens when you have a level where you can see both the interior and exterior of a wall. If a wall has any thickness then an external corner will be longer than an internal corner which will wreck my grid if I model the interior and exterior walls separately. If I model them together with the origin in the middle of the wall then that destroys the modular advantage by needing to maintain solid (2 sided) versions of the wall.

So my question is how can I model interior and exterior modular walls while still respecting the grid for snapping?

\$\endgroup\$
4
  • 2
    \$\begingroup\$ You might be interested in Oskar Stålberg's advice to model tiles "on the dual grid". So rather than walls cutting along the edges of your grid, think of walls going through the middle of each grid square. \$\endgroup\$
    – DMGregory
    Commented Nov 20, 2022 at 23:44
  • \$\begingroup\$ @DMGregory, Your simplification requires doubling of the grid size.The "dual grid" has no benefit over an offset grid. Let me know if I missed something about that post. \$\endgroup\$
    – user122973
    Commented Nov 21, 2022 at 3:24
  • 1
    \$\begingroup\$ No, a dual grid is the same size as the original grid. (It is its dual in the graph theory sense) In the case of a square grid, the dual is an offset grid, shifted over by one half tile width. \$\endgroup\$
    – DMGregory
    Commented Nov 21, 2022 at 3:40
  • \$\begingroup\$ @DMGregory a "try at persuading" eh? As soon as I saw that I was already convinced it was a good idea. And I've never heard of it before. Unfortunately my game has object-like interaction with walls and floors, so it's not applicable. \$\endgroup\$ Commented Nov 23, 2022 at 14:20

1 Answer 1

2
\$\begingroup\$

Walls with zero thickness (i.e. plane) should be avoided in most instances, since they don't exist in reality, and on the flip-side the non-displayed wall sides should be culled before render.

Onto the answer

Model each wall segment (plane) offset by a small amount (1 or .01) with respect to the interior direction, and sides (plane) covering the small distance as necessary to provide doorways, corners, and the like. The origin being the the center of the square.

The materials slots for the sides needs to be different from each other face to allow consistent materials corners and edges.

Twelve wall blocks four per direction (Flat, L, inverse L and U). To reduce draw calls this needs to be instanced or make larger blocks.

The modular components for each shape become the building blocks since every square becomes internal wall.

The only restriction is the camera grid collision can not be closer than the small amount to any wall.

This maintains grid integrity while providing visibility for both sides of a wall when needed.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .