3
\$\begingroup\$

I have a mesh and I would like to quickly create planes (or boxes) that have cutouts in the shape of the silhouette that mesh, but rotated at various angles. I would like to have a system to which I can feed any mesh and it will output these cutout planes, either for random or predefined rotations of the mesh.

In the game I'm making, you have a 3D object, like a chess piece, that you rotate and translate to try to fit it in a hole in a wall that has the shape of the object. But the hole can be in the shape of any rotation of that object. For instance, in the case of a pawn, the hole can look like an upright pawn, so you wouldn't have to rotate the pawn at all; or it could just be a circle the size of the base of the piece, so you would have to rotate the pawn so it either goes in feet or head first. I want a program to procedurally generate walls with these kinds of holes for any mesh I give it.

\$\endgroup\$
3
  • \$\begingroup\$ It's hard to understand what you're trying to achieve. Maybe an image/illustration of what you're trying to do would help? \$\endgroup\$
    – bummzack
    Mar 29, 2015 at 17:04
  • \$\begingroup\$ In the game I'm making, you have a 3D object, like a chess piece, that you rotate and translate to try to fit it in a hole in a wall that has the shape of the object. But the hole can be in the shape of any rotation of that object. For instance, in the case of a pawn, the hole can look like an upright pawn, so you wouldn't have to rotate the pawn at all; or it could just be a circle the size of the base of the piece, so you would have to rotate the pawn so it either goes in feet or head first. I want a program to procedurally generate walls with these kinds of holes for any mesh I give it. \$\endgroup\$
    – Jordak
    Mar 29, 2015 at 17:47
  • \$\begingroup\$ Hi Jordak, I removed the parts of your question that asked which tech to use; those are considered to be off-topic for this site. Feel free to revert my edit or further revise your question. \$\endgroup\$ Apr 5, 2015 at 6:19

1 Answer 1

1
\$\begingroup\$

What you are describing is performed by the GPU every time 3d geometry is drawn onto the screen. The 3d points must be translated to 2d positions. You can do this translation manually, and then construct a mesh from the resulting points.

  1. Multiply each vertex position from the object by a projection matrix. This will yield all the points within a 2d plane.
  2. Filter the set of points to only those that make up the convex hull of their outline.
  3. Generate a "hole" mesh from the outline points. Details for implementing this step depend entirely on your goals for project.

You could carry out this procedure for a predefined or random set of rotations by constructing the projection matrix for those rotations. You could implement this procedure in any language you choose. And because you only have to generate the mesh once rather than every frame, you conceivably could do it at runtime within your game (for example, in a loading screen).

\$\endgroup\$

You must log in to answer this question.

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