• Advertisement
Sign in to follow this  

Calculating thickness of 3d object

This topic is 3488 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I'm looking for a good way to calculate the thickness of a 3d object at any given vertex. It would not need to be fast enough to use in realtime but preferrably something pretty accurate. I would appreciate some ideas on ways to approach this or if you have any example. Simply doing a ray intersection to the backfacing side would not be accurate since for example the tip of a long tentacle/rod or something would have a long way to the backfacing faces. I was thinking of shooting several rays in a hemisphere manner but it would get quite slow and even then would not be very accurate. Another idea would be to somewhow peel off layers from the object until nothing more can be peeled off so you have a center line that you can compare the distance to. Not quite sure how to implement something like that though. Perhaps a massive voxel grid of boxes that are either inside or outside the mesh, then remove the outermost boxes until no more can be removed. ..but I'm looking for other alternatives. Thanks edit: Maybe this thread would fit better in Graphics Programming and Theory. A mod can move it if so.

Share this post


Link to post
Share on other sites
Advertisement
If you don't need to be realtime then I'd just cast a whole bunch of rays from each vertex back through the model like you describe until you hit a back face. If you shoot a whole bunch of rays in a cone instead of just a single ray that should produce good results even for long thin rods. And you can scale the number of rays for a speed/accuracy tradeoff.

Share this post


Link to post
Share on other sites
OrangyTang, thanks for the reply. I do think that will be too slow though. I will be working with meshes with often up to a million triangles so that is something like 500000 vertices. Intersecting from all of those would take several minutes and then multiply that by number of rays from each vertex and it will not be a workable solution. For comparison I ran my intersection code 60000 times on a mesh with 60000 triangles. That took about a minute and my code is very optimized. If it was only for myself I could take that hit in time but not others that would use my system.

Share this post


Link to post
Share on other sites
How static are the models? If they're that detailed then you should probably be looking into some kind of spatial tree (like an octree) and either maintain it as the model is edited or rebuild it before doing the raycasting. That would yield substantial speed increases.

Share this post


Link to post
Share on other sites
What is thickness?

Thickness in general would be intersection of an object by a plane, then finding min/max points on the resulting shape.

What is the thickness of a donut from left to right side if viewed from above (intersection will contain a hole)? How to you handle the hole?

How is your geometry defined? Using CSG, you can get perfectly accurate results.

Share this post


Link to post
Share on other sites
Why not generate a bounding box? That should tell you how thick the object is in each dimension.

Share this post


Link to post
Share on other sites
Quote:
Original post by stonemetal
Why not generate a bounding box? That should tell you how thick the object is in each dimension.


Again, how thick is a donut? In that particular case, donut has very strictly define thickness, which is determined by diameter of the loop. And while it's possible to determine that by looking at donut exactly from the side, what would the thickness be of two interlinked donuts (like two chain links)?

Thickness is a subjective measure that requires some context.

So rather than finding an algorithm, one must first determine definition of thickness. After that, the problem is trivial.

Share this post


Link to post
Share on other sites
Quote:
Original post by OrangyTang
How static are the models? If they're that detailed then you should probably be looking into some kind of spatial tree (like an octree) and either maintain it as the model is edited or rebuild it before doing the raycasting. That would yield substantial speed increases.
The model would be completely static so something like that would probably be a good idea and also to calculate the backfacing faces one time only for each vertex and reuse that for each ray. Might be interesting to try to see how fast it could get.

Quote:
Original post by AntheusWhat is thickness?

Thickness in general would be intersection of an object by a plane, then finding min/max points on the resulting shape.

What is the thickness of a donut from left to right side if viewed from above (intersection will contain a hole)? How to you handle the hole?

How is your geometry defined? Using CSG, you can get perfectly accurate results.
Thickness in this case would be the "real" thickness and mass of each part and account for holes and complex shapes. The thicker the surface is at a given point the more light would be able to pass through it as an example.

I'm not using CSG, the info I have to work with is a basic mesh with vertices, faces and edges.

Share this post


Link to post
Share on other sites
Well I created an octree for use with the intersection now and the test for 60000 triangles intersected 60000 times now takes 4.1 seconds compared to about a minute before.:) Pretty cool. That is 3 600 000 000 intersections... hehe. I think I'll go with the option to shoot several rays in a cone/hemisphere then.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement