So let us assume I have a 3D model of a window and I would like to stretch it like a 9 sliced sprite. How would you go by doing 9 slice on meshes? All I found online was about quads. What about more complicated meshes?

  • \$\begingroup\$ What prevents you from writing a vertex shader to scale specific regions of the mesh differently? \$\endgroup\$
    – Ocelot
    Jul 1, 2019 at 8:25
  • \$\begingroup\$ Cyan used a form of this they called "Stretchables" in building Obduction - you can see them describe it starting around 21 minutes into this GDC Vault video. In their case it looks like an edit-time feature: they bake two sets of UVs in the mesh, one that stretches with the mesh, and one that tiles at a fixed frequency. Then their shader uses the stretched maps to add edge-aware shape detail to the tiling texture of the base map. \$\endgroup\$
    – DMGregory
    Jul 1, 2019 at 16:02
  • \$\begingroup\$ I've just made a tutorial showing one method of doing this: youtube.com/watch?v=ExNRbEjVT-8 \$\endgroup\$
    – Ben Rolfe
    Sep 28, 2019 at 6:03

1 Answer 1


As far as I know, this is not as popular as 9-slicing images, so it doesn't come with popular engines.

Having said that, you can always do this manually. Editing a mesh is easier than editing an image, so it's not difficult to separate a mesh into 9 pieces (like you would an image) and either scale the in-between meshes, or tile them, or a combination of both. You don't have to mess with shaders or anything complicated, just the basic transformations of a 3D object are enough.

The process is the same as when using an image, and maybe you can do a "27-slice" if you want the same effect on 3D.

  • \$\begingroup\$ How come defining few planes and passing it to the shader is complicated? \$\endgroup\$
    – Ocelot
    Jul 1, 2019 at 9:39
  • 2
    \$\begingroup\$ @Ocelot some programmers are not familiar enough to be comfortable using shaders. A question of "how to do 9-slice with meshes" hints to me that the OP might not be that experienced, so I provided a beginner-friendly answer. If I was wrong, and OP is experienced with shaders, then other users viewing this question could benefit from it instead. In both cases, OP can solve their problem. \$\endgroup\$
    – TomTsagk
    Jul 1, 2019 at 9:43
  • \$\begingroup\$ @Ocelot care to write an answer? \$\endgroup\$
    – Joe Robert
    Jul 1, 2019 at 19:32
  • \$\begingroup\$ So Tom you are saying, I slice the mesh then scale the mesh in the center? \$\endgroup\$
    – Joe Robert
    Jul 1, 2019 at 19:33
  • \$\begingroup\$ @JoeRobert I don't use Unity \$\endgroup\$
    – Ocelot
    Jul 2, 2019 at 3:53

You must log in to answer this question.

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