Surface smoothing

I am writing a terrain program. I have some research
data and render it as a surface. But the surface looks very triangular because of the lack of data points for my mesh. So it would be much better to smooth my surface.
I tried to smoothing by lighting effects, but it was insufficient.
Now I would like to try a spatial interpolation and cannot find any algorithm for OpenGl or at least math equations. Could anybody help me?
Are there other ways to solve such kind of tasks?
Any help will be appreciate.

There are a few options you could try.

  • Gouraud shading
  • per pixel lighting (eg. Phong)
  • bumpmapping
  • use evaluators, they use the vertices of your mesh as control points for bezier-like curvatures (Nurbs)

Nico

Thanks a lot -NiCo-

Unfortunately I am not good at using of NURBS, so could anybody help to find information on, especially samples&

Moreover, are there any ways to compute the volume of a closed surface?

Alex Sychov

I only have a tutorail on evaluators in hardcopy form, but a google search should give you some hits.

If your closed volumes are made up of triangles and your normals are consistent you can use the folowwing trick.

  1. Choose a fixed random point, eg. (0.0,0.0,0.0).
  2. Initialize totalvolume to zero;
  3. For every triangle, compute the volume of the tetraeder constructed by the triangle and the fixed random point.
  4. If the normal of the triangle points to the side of the triangle in which the fixed point lies, subtract the volume from the totalvolume, otherwise add it.

Greetz,

Nico

Thanks Nico again

NURBS is a great thing? But could it be used when the set of points is unsorted for such tasks.

If I am not mistaken for ising NURBS in OpenGl the array of control points must be sorted and of course rectangular.

How can a arbitrary set of points transform to creat (or render) the closed surface.

Alex Sychov

Here is a possible solution for terrains.

  1. Initialize a floating point pbuffer.

  2. Set your projection to an orthographic view from above, looking down.

  3. Set the modelviewmatrix to identity and specify automatic eye linear texcoord generation.

  4. Use a fragment program with
    “MOV result.color, fragment.texcoord[0]”

  5. Draw the geometry. ( the colors will now correspond to the 3d positions of what you are drawing in the coordinate frame of your camera.
    x=red y=green z=blue

  6. Read out the floating point pixeldata. This gives you your terraindata in a grid.

P.S.: Another solution to your problem is using pn-triangles on Ati cards.

Greetz,

Nico

You basically have an interpolation problem, and there are many solutions. One simple one is distance based interpolation, i.e. lay down a grid of points where you want vertices then set the value equal to a sum of neighbor values weighted by distance. Look at
web page
for a paper on this.

To make the scenery more intersting you might add some random heights to each point…

Originally posted by -NiCo-:
[b]There are a few options you could try.

  • Gouraud shading
  • per pixel lighting (eg. Phong)
  • bumpmapping
  • use evaluators, they use the vertices of your mesh as control points for bezier-like curvatures (Nurbs)

Nico[/b]
Yes Nico the Gourand shading in openGL please tell me about this what the function to build gourand shading…

Per pixel lighting — Is this normal per vertex? but in standard opengl is not smooth shading.

Do you have idea about this?