SolveSpace Logo SOLVESPACE -- parametric 2d/3d CAD
Examples
Tutorials
Features
Download
Reference
Technology
Library
Forum
Contact
USER FORUM

(you are viewing a thread; or go back to list of threads)

Expose hidden line removal (by Vicky)
I have searched extensively over the internet and could not find a single solution that is free for use for hidden line removal, except open cascade. I am making a CAD application in unity (for cross-platform development), and while I have been successful in most parts of it so far, I need some solution that can help in hidden line removal. For example, passing a list of 3d object parameters to a function and getting in returns only those line information that can be drawn/exported to Dxf. Can you suggest some solution to it?
Fri May 20 2022, 01:55:42
(no subject) (by Paul)
@Vicky,

Is your CAD open source? Can I have a look?

If you can comply with the GPLv3 license, you can use that stuff out of Solvespace. It's not really meant as a library though, so you will need to figure it out. It might be easier to absorb the "how" of it and do your own implementation. The main triangle mesh code is here:
https://github.com/solvespace/solvespace/blob/master/src/mesh.cpp

There is also code to load an STL into this structure here:
https://github.com/solvespace/...blob/master/src/importmesh.cpp

I don't fully understand how the edge classifier works - it uses some acceleration structures - but it is also not as fast as I'd like it to be. How edges are rendered along with the mesh is also a mystery to me (offsets?) but it usually works well enough. We also support occluded lines with stipple patterns.
Fri May 20 2022, 09:40:31
(no subject) (by Vicky)
I haven't decided on the type of licence yet as the product is yet under development.
I did try mesh import feature and I am facing problem described in
https://github.com/solvespace/solvespace/issues/1085

Not all edges are detected.
Sat May 21 2022, 09:33:17, download attachment Screenshot_20220521-185544__01__01.jpg
(no subject) (by Paul)
Why are there red lines in the screenshot? Are those edges that only belong to one triangle, or did you highlight them?

Those red edges should appear the same as the facets on the cylinder on top. They should have no highlight or white line. When you look at the front of the cube you think "3 surfaces" but when you look at the cylinder on top you think "one flat circle and one curved surface". Why wouldn't you think of the cylinder as a lot of small rectangular surfaces? Because you and I are too smart, we know those are all one surface and don't expect to see any edges. We don't see a diagonal line across the square faces either, but they are composed of 2 triangles. STL does not encode any information about surfaces, it's just a bunch of triangles. That is why the Solvespace issue you linked to was closed as "won't fix".

It may not be too difficult to find co-planar triangles and assign an arbitrary surface ID to them, but then you have to be sure not to create many rectangles for the cylinder.

To correctly partition triangles into separate surfaces is a fairly hard problem. It's one I'd like to work on some day, but for now there are many more important things to do.

BTW if your project is commercial (you're getting paid to work on it) I could be convinced to work on surface reconstruction code IFF I could get paid *and* incorporate it into Solvespace under GPLv3+ (in addition to whatever X company does with it). If this is of interest use my github ID at gmail.
Sat May 21 2022, 12:45:55
(no subject) (by Vicky)
Red line was for illustration purpose. I have attached one more pic. So what I wanted to say was that not all edges are detected. Middle three edges are missing. Front part of cylinder is missing.
I understand it's difficult to get shape information from stl file.
https://assetstore.unity.com/p...-effects/outline-toolkit-98020
This link I shared does detect inner edges, but i guess this solution is shader based. I'll see if i can come up with a same solution.

This project that I am doing is not funded, i am itself working on it by contributing some time of my own.
Sat May 21 2022, 17:00:24, download attachment Screenshot_20220522-021552__01.jpg
(no subject) (by Vicky)
Red line was for illustration purpose. I have attached one more pic. So what I wanted to say was that not all edges are detected. Middle three edges are missing. Front part of cylinder is missing.
I understand it's difficult to get shape information from stl file.
https://assetstore.unity.com/p...-effects/outline-toolkit-98020
This link I shared does detect inner edges, but i guess this solution is shader based. I'll see if i can come up with a same solution.

This project that I am doing is not funded, i am itself working on it by contributing some time of my own.
Sat May 21 2022, 17:00:49, download attachment Screenshot_20220522-021552__01.jpg
(no subject) (by Vicky)
Hi Paul,
I guess i dont need to rely on STL. I can simply make my parts in Solvespace with .slvs extension. This way i dont have to worry about edges.

So my plan now is to build this library with a wrapper for C# with following features.
1)Create new file
2)Import .slvs parts
3)Control matrix of parts for rotation/translation
4)Control field view (Camera)
5)Get current view with Hidden line removal(HLR)
6)Generate data by drawing lines obtained from HLR

Optionally instead of importing .slvs parts, i can think of creating .slvs part by scripting.

Do you have any suggestion on this?
Tue May 24 2022, 14:32:58
(no subject) (by Paul)
@Vicky,

It's not clear to me what your goals are. What is the C# wrapper going to be used for? What are you doing in unity? So many questions ;-)
Thu May 26 2022, 09:57:17
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):
© 2008-2022 SolveSpace contributors. Most recent update June 2 2022.