stephomi / sculptgl

DEVELOPMENT STOPPED I'm now working on Nomad Sculpt instead
https://stephaneginier.com/sculptgl/
MIT License
1.39k stars 360 forks source link

special request #102

Closed nesquik011 closed 4 years ago

nesquik011 commented 4 years ago

hello , i want you to help me to add new tool or modifies old one with option ( talking about masking tool ) I want to function like put dot by dot on on the 3D model then once I close the dots it select area , like lasso tool in photoshop

stephomi commented 4 years ago

Sorry I don't maintain sculptgl anymore!

nesquik011 commented 4 years ago

@stephomi ok thank you , if you don't want to work anymore with the project , so kindly can you give me hints how to add that option ?

stephomi commented 4 years ago

I don't mind answering specific question but this one is too general/complex. User input (interaction), rendering (the lasso), etc...

However, I can answer for the polygon/lasso thing:

nesquik011 commented 4 years ago

@stephomi great thank you a lot for respond , how to finding shortest path using two points on mesh ? cos expect any librabry or good algorithm, otherwise browser will crash with high cpu

stephomi commented 4 years ago

For that problem, you should probably look into A* algorithm. It shouldn't be that expensive, but it depends of the mesh topology and polycount.

By the way you should proably ignore my previous message on the lasso/polygon thing. I though you wanted to draw the lasso in screenspace independently of the mesh (for example like the blender selection tool).

In that case you indeed need to know the shortest points between 2 vertices. Once you got these paths, and if your path is closed (important), simply tags all the vertices, and flood fill all the vertices inside. It's a bit similar to this part https://github.com/stephomi/sculptgl/blob/605a58cb9e3ddcea35ce8c3d02e3b6a45034be36/src/math3d/Picking.js#L344-L372