PDA

View Full Version : Smoothing



Swiftless
07-16-2005, 01:03 AM
I have created a terrain, it loads from a simple RAW file. The porblem is that I am getting straight lines going from one vertex to the other. I want it to smooth out so:
Instead of this:
_/
_/
/
I get this:
/
/
/
Or in a case like this:

_______/
/
I want it to be rounded and go from the first vertex to the last in sort of like a rounded slope.

I would be fine with the first way, as I know it would be easier, but I would prefer a way to round the slopes.

I don't want any "sharp edges".

How can I achieve this? I have thought of subdividing the triangles in my strip(although I don't know how to do this) and I have thought of a bezier surface instead of a triangle strip(don't know how these work either).

ZbuffeR
07-16-2005, 01:44 AM
To smooth surfaces I personnaly really like Catmull-Clark subdivisions surfaces. Simple to implement and works with any topology.
http://symbolcraft.com/graphics/subdivision/

There is a lot of other way to smooth surfaces (bezier, spline, nurbs, ...) it all depends on what your want : surface passing through control points, very smooth surface, locality, etc...

Is you terrain a regular grid ?

Swiftless
07-16-2005, 03:14 AM
I believe it is a regular grid.

The Catmull-Clark method looks like it would be perfect, but how would I implement it into my code? It gives no code to go by, not even some psuedo-code. I get the theory behind it, but implementing it would be a different matter. One problem I see with it though, is that I am making large terrains. I have them in display lists, and are getting 60 frames per second max, this is generating more triangles and that is not something I want, I acctually want less. I guess I will have to look more into LOD before I do something like this.

Anyway, any help would be apprectiated.

07-17-2005, 08:31 AM
The Catmull-Clark method looks like it would be perfect, but how would I implement it into my code? It gives no code to go by, not even some psuedo-code. www.google.com (http://www.google.com)

There many websites dedicated to this stuff, not to mention several full blown implementations...

Swiftless
07-20-2005, 06:54 PM
I have tried googling that stuff, and I am getting absolutely nothing.

I am going to try bezier surfaces and maybe nurbs.

But before I go into that, I want to know how I would add a vertex at a point between 2 other vertices. I am reading all my current vertices from an array: map[768][768]; and was just wondering how I could call them with others inbetween, so between map[1][1] and map[2][2] I work out the average, which is 1.5, and then add a vertex at the point (1.5, map[1][1] + 0.5, 1.5)

I am using triangle strips and calling it through a display list.

07-21-2005, 07:29 AM
I have tried googling that stuff, and I am getting absolutely nothing.You need to press enter after you type in the search phrase...

Swiftless
07-22-2005, 10:33 PM
Haha, very funny.

Anyone with a serious answer, the only things I am finding in google are in other languages or just talk about the theory behind the catmull clark method.

ZbuffeR
07-23-2005, 12:03 AM
- We don't even know which programming langage you use
- The catmull clark is one of the simplest subdivision algorithm

took me 4 seconds :
http://www.multires.caltech.edu/pubs/fastsubd.pdf
http://en.wikipedia.org/wiki/Subdivision_surface
http://www.math.hu-berlin.de/~hakenber/subdiv/ccds.htm

EDIT: ok I am in a good mood today :
http://www.cs.rice.edu/~sschaefe/research/tutorial.pdf

Swiftless
07-23-2005, 05:56 AM
Oh, lol, I use C++.

ZbuffeR, I don't even get them in my google searches :(