Neos-Metaverse / NeosPublic

A public issue/wiki only repository for the NeosVR project
197 stars 9 forks source link

SDF Modeling #3818

Open lxw404 opened 1 year ago

lxw404 commented 1 year ago

Is your feature request related to a problem? Please describe.

There's undoubtedly many different ways to implement in-game modeling, however I'm not sure if Signed Distance Functions (SDFs) have been discussed as a way of doing intuitive modeling.

Here are some example applications which utilize the technique:

https://www.womp.com/ https://github.com/fogleman/sdf https://blenderartists.org/t/geometry-nodes-in-3-3-sdf-presets/1387929 http://ephtracy.github.io/index.html?page=magicacsg

Relevant issues

Related:

2234

Metaballs are somewhat related, however I would consider generalized SDFs to be a better alternative due to their flexibility.

Describe the solution you'd like

I am mainly basing my approach to this by what I've used so far.

What would be nice is if there were a sort of "SDF domain" component which is a procedural mesh that defines the area where SDFs are generated into mesh. You specify the resolution (x,y,z steps) and dimensions of the domain (bounds) and any other SDF primitives you place within those boundaries are computed and turned into a final mesh.

Some basic SDF primitives:

Some basic SDF operations:

Additional SDF operations:

With each of the combine operations (Union/Difference/Intersection), you can also specify the "softness" of that operation, effectively allowing for smooth transitions. Some implementation details: https://iquilezles.org/articles/distfunctions/

Smooth Combination

The individual primitives could be additionally colored and the colors blended via the smoothing functions, applying those colors per vertex in the final mesh.

What might be difficult is determining the grouping of operations which would require some sort of hierarchical data structure exposed to the user (or alternatively, possibly a lot of stacked slots). In Blender's geometry nodes for example, the SDF operations only operate on 2 SDFs at a time, and are chained linearly in a graph. In other editing software, SDFs are organized into groups or layers which operate on other layers.

Describe alternatives you've considered

There are no in-game solutions to this at the moment. Current in-game modeling is limited to primitives which do not smoothly transition between each other, limiting modeling to fairly blocky shapes that are additive only in nature. SDFs would alleviate this, allowing for Union, Difference, and Intersection, smoothing or creasing of edges to go from organic shapes to sharp hard surface models.

Additional context

No response

EIA485 commented 1 year ago

once #63 is complete we can implement this ourselves

Geenz commented 1 year ago

You can create procedural meshes with Logic and components. Custom shaders would be a help here though - which will take a good bit.