JannisX11 / blockbench

Blockbench - A low poly 3D model editor
https://www.blockbench.net
GNU General Public License v3.0
3.05k stars 271 forks source link

[Suggestion] Spline/Curve based meshes #2313

Open Azagwen opened 1 month ago

Azagwen commented 1 month ago

Detailed description of your suggestion

This suggestion refers to a common tool general modeling apps tend to implement pretty early on, being "curve" or "spline" objects which can then be "extruded" into mesh "tubes" or "profiles" with a variety of parameters

This type of tool can be very particularly useful for modeling things like

Splines have handles, which can be of a few types

Bezier

NURBS

Something to know

Bezier and NURBS are technically programmatically identical, but the UX of them is very different, as Bezier may feel more natural where NURBS might be more confusing and difficult to handle for users

And here are the different "stages" of rendering a curve in most softwares

image

Parameters that are commonly found within Splines in other softwares

Resolution U

How detailed the resulting tube will be, less resolution equals a less smooth curve

Resolution V

How many edges the radius of the resulting tube will have, less edges for more geometric shapes, more for circular looks

Point size

How big a given point on the curve is, usually also affects the actual mesh this curve will render

Tilt

This property controls the orientation of each point along the spline's normal Useful to get twists and control if a flatter profile is properly oriented

Profile shape

Not always present, but usually available in generalist modeling apps, this defines the shape of the resulting tube, and causes the curve's native V property to be ignored in favor of the profile's resolution. The profile can usually either be a mesh or another curve

From Spline to mesh

The last point of implementing a spline system, is to have it be easily converted to a static mesh, which most softwares will tend to do in at least one of two ways (often both for more professional oriented packages)

Splines preview meshes, and can be converted once finished

(This is the method all screenshots above have used, except for the last one)

In this scenario, the curve's mesh is never editable as a mesh until it is explicitly made "static", after which the spline stops affecting the mesh (or straight up disappears like in Blender), and the resulting mesh becomes editable with conventional polygonal tools. One downside can be that the user may wish to edit their curve again, scrapping whole pieces of it after various edits (this could be argued to be an organization issue on the user's end though, rather than a UX issue).

image

Splines independent of mesh

In this scenario, the spline is always separate from the mesh, and the mesh gets mapped onto the spline like a spaghetti, this method has ups and downs, it preserves the original mesh's integrity while deforming it non-destructively. But it will also deform in quite drastic ways if a turn is too tight. It may also cause stretching or squashing.

image

Azagwen commented 1 month ago

After 10 million edits, this should be complete enough :D

Azagwen commented 1 month ago

also worth mentioning #1921 has suggested this a while ago, but admittedly in a much less comprehensive manner. As splines don't really need to be able to map meshes along their normal, they'd mostly be useful for wire/rope-like objects in a majority of use cases.

Larger applications (roads, train tracks...) could easily be hand-crafted without a requirement for direct mesh mapping if the basic principle was to be implemented

Azagwen commented 1 month ago

Adding this

A few examples of work done in Blockbench that could have been helped by Spline mesh support

The roots here took much longer to make than they would have if we had access to splines, as they required a lot of careful editing of each individual tube, extruding repeatedly, and touching up UVs every time we wanted a slight shape change. The snake also took a good 4 hours to model by extruding and carefully shifting faces around, before UVs and touchups

AZASHROOMYUNDERWATER_smoller

In this one, the tree branches and train Pipes also took a good chunk of the overall workload, the pipes in particular required a lot of support edge loops to be spawned and followed carefully to do perfect 90° rounded turns, something that would have been much easier using splines

Aza_Shroomy_bbsplashscreen_final_touch_ups_smoller

Partho29 commented 3 days ago

I am in dire need of a spline based tool in Blockbench. Can @Azagwen please point out the way I should go so that I can implement it on my own as a plugin. Will it be easy or hard to implement. Thank You.

Azagwen commented 1 day ago

I am in dire need of a spline based tool in Blockbench. Can @Azagwen please point out the way I should go so that I can implement it on my own as a plugin. Will it be easy or hard to implement. Thank You.

Something you can look at to begin with is Bézier Curves, there is a lot of documentation online so I'm sure you should find some.

I can also strongly recommend this comprehensive deep dive on splines by Freya Holmér (youtube) for a more sensible explanation of the mathematical concepts behind splines in general