Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow refine to do negative values and custom edge lengths for remeshing #133

Closed
fire opened this issue Jun 4, 2022 · 6 comments
Closed

Comments

@fire
Copy link
Contributor

fire commented Jun 4, 2022

The expected workflow is to subdivide by 2 and then refine by -2 with a constraint of modified edge length sizes.

I believe this is a possible operator.

What do you think?

@fire fire changed the title Allow refine to do negative values. Allow refine to do negative values for remeshing Jun 4, 2022
@fire fire changed the title Allow refine to do negative values for remeshing Allow refine to do negative values and custom edge lengths for remeshing Jun 4, 2022
@elalish
Copy link
Owner

elalish commented Jun 5, 2022

Splitting edges is much easier than collapsing them, but we do already have an internal edge collapse method. Right now it's only for removing degenerates, but it may be modifiable to general decimation.

Making Refine take a maximum edge length as input should be quite a bit simpler, or even a curvature tolerance.

@fire
Copy link
Contributor Author

fire commented Jun 13, 2022

@elalish Can I persuade you to merge this first before SDFs?

@elalish
Copy link
Owner

elalish commented Jun 14, 2022

Well, I'm already in the middle of SDFs. Really what you should be asking is when can I dedicate more time to Manifold? I'm trying to work something out, hopefully I'll have more soon.

Can I have some more detail about how you plan to use this feature and the use cases? That'll help me with building a good API.

@fire
Copy link
Contributor Author

fire commented Jun 14, 2022

We've hammered out a workflow using mesh optimizer. https://github.com/zeux/meshoptimizer So I'd like to match the api.

@JFonS

meshoptimizer gives you a relative error and a way to convert it to an absolute value

That's because it internally rescales the mesh, making the largest AABB axis be 1.0

static SimplifyFunc simplify_func;
typedef size_t (*SimplifyWithAttribFunc)(unsigned int *destination, const unsigned int *indices, size_t index_count, const float *vertex_data, size_t vertex_count, size_t vertex_stride, size_t target_index_count, float target_error, float *result_error, const float *attributes, const float *attribute_weights, size_t attribute_count);
static SimplifyScaleFunc simplify_scale_func;
typedef float (*SimplifyScaleFunc)(const float *vertex_positions, size_t vertex_count, size_t vertex_positions_stride);

https://github.com/godotengine/godot/blob/d6e7dcbea9c297253e05a75691d5707aa0a749b3/scene/resources/importer_mesh.cpp#L257

See also https://github.com/godotengine/godot/blob/ba1024f42d9ba279b13eee0cbe3286089dc39ffb/scene/resources/surface_tool.h#L77

@fire
Copy link
Contributor Author

fire commented Jun 15, 2022

I was hoping to use this for constructing a csg edit tree and then sampling the sdfs to make a mesh. (citation Sony Media Molecule Dreams).

The idea is once constructed the resulting mesh is a mesh like any other lod'd mesh.

reference

https://www.youtube.com/watch?v=Pi3r18ld-S8

@elalish
Copy link
Owner

elalish commented Mar 3, 2024

Fixed by #741 (well, not the negative part, but that's a different kind of feature).

@elalish elalish closed this as completed Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants