Jump to content
  • Advertisement
Sign in to follow this  
nysb

OpenGL How to turn triangles from isosurface into smooth surfaces?

This topic is 4420 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

Hi, I have been able to generate triangles from an isosurface algorithm, and the triangles can be displayed correctly, with color filled inside each triangle. The problem is that I don't know how to turn the triangles into a smooth surface, for example, like the shapes of a human head. Can somebody tell me what I need to do to achieve that? Thanks a lot. BTW, I am pretty new to 3D programming and I just ported the isosurface algo, and I am using OpenGL. Thanks. PS. If you go to http://nysb.photosite.com/, you will see what I currently have. Thanks a lot. [Edited by - nysb on July 7, 2006 10:21:30 AM]

Share this post


Link to post
Share on other sites
Advertisement
So you have a surface consisting of triangles and want to smooth it ?

Search for loop algorithm, butterfly algorithm or subdivision surfaces.

Share this post


Link to post
Share on other sites
I don't even need to really smooth it, instead, I just need to make it look like a continuous surface. Right now, in the display, I can see each triangles with the correct color filled in, but that is not supposed to happen since a smooth surface should be generated from those triangles somehow, but how? Thanks.

PS. If you go to http://nysb.photosite.com/, you will see what I currently have. Thanks a lot.

Quote:
Original post by nmi
So you have a surface consisting of triangles and want to smooth it ?

Search for loop algorithm, butterfly algorithm or subdivision surfaces.

Share this post


Link to post
Share on other sites
You might download VTK to avoid rewriting a lot of common algorithms. Just learn the basic pipeline interface and wrap what you need in some classes.

Share this post


Link to post
Share on other sites
Can you tell me what common algo, say, the name in VTK, would be needed to achieve this? I am just so lost that I don't even know what to look for. Thanks.

Quote:
Original post by slack
You might download VTK to avoid rewriting a lot of common algorithms. Just learn the basic pipeline interface and wrap what you need in some classes.


Share this post


Link to post
Share on other sites
It's kinda hard to tell exactly what you're after, but maybe you're referring to triangle shading. If you use gouraud shading on your triangles, with appropriately calculated vertex normals, the model will appear to be one smooth surface (as you described).

Just make sure lighting is enabled in OpenGL, and calculate the normals for each vertex (a normalized cross-product of the edges). Send them down the pipeline with your vertex positions, using glNormal3f() and you're good to go.

- Andrew

Share this post


Link to post
Share on other sites
if I understand correctly you currently have "flat-shading" and you want "smooth-shading". (Im not sure these are the correct terms)

"flat shading" is when you calculate a normal for the triangle and use it to choose the shade.
"smooth shading" is when you calculate the 3 normals (one for each vertex) where the vertex normal is the average of the normals of the triangles touching it. The shading of the triangle is then interpolated between the 3 normals, resulting in a smooth shading - giving the object a more round shape.

I recomend you ask in the openGL forum where they can tell you how to do it in the openGL API.

Share this post


Link to post
Share on other sites
Hi arudson and Iftah,

"gouroud" shading seems to be familiar since I have seen it referenced somewhere in the code I ported, but I didn't understand it. I will try to find out whether that is what I want.

BTW, could you take a look at the picture hosted at http://nysb.photosite.com/? I am sure you will know what I currently have and what I want right away. Thanks a lot.

Share this post


Link to post
Share on other sites
I think the previous replys may be right... something may be wrong with the normals. Maybe you're not calculating the normals. From the picture you posted, it wasnt very clear...

In vtk, look for the medical examples that show a head inside a cube. They show the main classes for isosurfacing. Basically, you either use polygons or raytracing in vtk IIRC.

By the way, i've just remembered... some isosurfaces in most volumes dont really represent a continuous surface inside the volume... for example, with noise acquired from the machine that made the volumes. Maybe you are just watching one of these bad isosurfaces?

If you want, check my blog: volume-master.blogspot.com. I have some pictures of isosurfaces there... but i'm not using triangles.

Share this post


Link to post
Share on other sites
Hi,

The normals were calculated. I will check to see if they are correct or not.

I have uploaded a new zoomed-in picture to the site (In album 2, sorry I haven't completely figured out how to use that site yet). Hopefully, you will see all those triangles and also the lighting effect. Thanks a lot.


Quote:
Original post by wolverine
I think the previous replys may be right... something may be wrong with the normals. Maybe you're not calculating the normals. From the picture you posted, it wasnt very clear...

In vtk, look for the medical examples that show a head inside a cube. They show the main classes for isosurfacing. Basically, you either use polygons or raytracing in vtk IIRC.

By the way, i've just remembered... some isosurfaces in most volumes dont really represent a continuous surface inside the volume... for example, with noise acquired from the machine that made the volumes. Maybe you are just watching one of these bad isosurfaces?

If you want, check my blog: volume-master.blogspot.com. I have some pictures of isosurfaces there... but i'm not using triangles.


Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!