Amuthan

11-19-2010, 04:53 AM

I have 30X30 matrix data to plot. If I use polygons to draw the 3D surface, it is not smooth. Is there any inbuilt mechanism in opengl to smoothen the surface?

View Full Version : Getting smooth surface from fewer points

Amuthan

11-19-2010, 04:53 AM

I have 30X30 matrix data to plot. If I use polygons to draw the 3D surface, it is not smooth. Is there any inbuilt mechanism in opengl to smoothen the surface?

nickels

11-19-2010, 11:59 AM

I'm assuming your data is regularly spaced, i.e. defined on a grid?

I don't think ogl can help you necessarily, but you can use your data points as control points and define interpolated polygons using a smoother interpolant such as bicubic, or even quadratic langrange (use 9 points for each cell)...

Opengl splines might help, but they don't interpolate all of the control points....

I've done something similiar to what you want using patch based interpolation (least squares fit to a poly around each node and average)--bit of overkill for a regular grid, though...

I don't think ogl can help you necessarily, but you can use your data points as control points and define interpolated polygons using a smoother interpolant such as bicubic, or even quadratic langrange (use 9 points for each cell)...

Opengl splines might help, but they don't interpolate all of the control points....

I've done something similiar to what you want using patch based interpolation (least squares fit to a poly around each node and average)--bit of overkill for a regular grid, though...

MaxH

11-19-2010, 05:37 PM

I have 30X30 matrix data to plot. If I use polygons to draw the 3D surface, it is not smooth. Is there any inbuilt mechanism in opengl to smoothen the surface? Do you have a wireframe or solid surface? Either could be made up of 'polygons'? If it's a solid surface: are you using simple coloring, or lighting? To use lighting you must compute normals for each polygon (easy to do). If you specify one normal per polygon you'll get a faceted surface. To get smooth shading, you have to specify a normal for each vertex of every poly. You can compute vertex normals by averaging the polygon normals that share that vertex. It would help if you showed us a picture of what you have now.

ugluk

11-21-2010, 01:49 PM

I think you can use a geometry shader to interpolate, but otherwise you need to interpolate at design time.

Otherwise, you can smooth out the edges a bit by averaging normals of neighboring faces. You can also add some fake surface detail with bump mapping to make your surface look more detailed.

Otherwise, you can smooth out the edges a bit by averaging normals of neighboring faces. You can also add some fake surface detail with bump mapping to make your surface look more detailed.

Amuthan

11-21-2010, 10:29 PM

Yes it is regularly spaced.

i want all the points to be exactly mapped on the surface.

Thanks.

i want all the points to be exactly mapped on the surface.

Thanks.

ZbuffeR

11-21-2010, 11:50 PM

What about http://en.wikipedia.org/wiki/Bicubic_interpolation ?

Do this for the geometry, with smooth normal interpolation between faces as said ugluk.

Do this for the geometry, with smooth normal interpolation between faces as said ugluk.

Amuthan

11-22-2010, 02:36 AM

Thank you MaxH. I specified a normal for each vertex, surface became very smooth.

MaxH

11-22-2010, 10:28 AM

Thank you MaxH. I specified a normal for each vertex, surface became very smooth. Congrats. Thanks for the visual feedback.

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.