Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Brett Gillick, posted on January 25, 2002

Image Description, by Brett Gillick

This is the current version of my bezier patch landscape renderer, it is not optimized at all e.g. no visibility tests, tri strips for rendering, no LOD etc. The stats for the landscape shown in the image are
  • Tris per strip - 14
  • Strips per patch - 8
  • Patches in landscape - 7225
  • For a grand total of 809200 tris
  • As you can see in the bumpier parts of the landscape, I have not enforced continuity between the patches for smooth lighting, although the flatter parts do look reasonably good (IMHO :)

    In this version, every patch is tesselated to the same level and the vertices for each patch are calculated at load time using forward differencing (a big thanks to Adrian Perez's - Advanced 3D Game Programming in DX7 ), and are then drawn as strips every frame.

    The landscape is just a raw greyscale image, I use the values from the image as the z-offset for each patch's control points (16 pixels per patch, shared edges), rotate the thing 90 degrees when drawing to make it horizontal instead of vertical, and voila! instant terrain.

    I've just been putting code together to try to do the things I want as i've gone along learning OpenGL, and this is the result so far.

    Brett Gillick
    - Shabadoo-

    Image of the Day Gallery


    Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
    Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
    Flying Wombat

    January 25, 2002, 02:48 PM

    Awesome looking IOTD. Do you have any plans for it? Nice work.


    January 25, 2002, 02:52 PM

    Moonscape, mercury flow, molten metal sea - cool.

    Mike Taylor

    January 25, 2002, 03:20 PM

    Quick question: why does everyone insist on Beziers? I use Catmull-Rom patches for my landscape and would never look back. The performance difference in calculating them is minimal, there is a good way to do central differencing if that's your bag, and I'm sure forward differencing wouldn't be tough either. On the purely plus side, they are always C1 continuous (but a little sloppy if you have lots of big changes in height). They hit all the control points, which is a huge help when you try to actually modify and control where the terrain is. And they don't require any extra work or preprocessing to get the C1 continuity mentioned earlier. I found that I had VERY little control over the placement of verts when I did it in Bezier, since you have to move around half of the control points around to preserve continuity.

    -Mike Taylor


    January 25, 2002, 03:45 PM

    I'm no math genious but to generate the same line as a bezier spline you'd need n+2
    points compared to the number of points a bezier spline needs. This really wouldn't be a
    factor, but there's another factor to consider. It looks like you would not be able to use the
    points that shape the Catmull-Rom spline as a convex hull for coarse collision detection
    with an object made of catmull-rom patches.



    January 25, 2002, 03:57 PM

    You can do a conversion between them at will, so you could just model with Catmull-Rom and convert to bezier for rendering/collision detection.


    January 25, 2002, 04:00 PM

    Dx8 doesn't support Catmull-Rom patches....thats enough of a reason for me. :)

    Colin Howe

    January 25, 2002, 04:09 PM

    ooooh, weird... nice screenshot, but I just noticed that when you have it in thumbnailed view, it kinda looks like a war ruined metal sheet, ripped in the lower left corner sort of... well, that's what I think anyway


    January 25, 2002, 04:16 PM

    because beziers are in hardware on gf3?

    Mike Taylor

    January 25, 2002, 04:26 PM

    The hardware reasons aren't bad, but the cost of tesselation shouldn't be paid every frame. You can just tesselate before you use and either throw out every other point or use a VIPM based technique to alter detail per frame. The convex hull property of Beziers is nice, but it isn't hard to calc the max and min of a Catmull-Rom patch beforehand, and that's all you need if you are doing a terrain. I may type up a quick little ditty on Catmull-Roms and their uses in my engine soon. I think that would make it all much more clear.

    (BTW, I have no problem with Beziers, and I like other types (Hermite, Cardinal, TCB... even more. I just like Catmull-Roms for terrain the best)

    -Mike Taylor

    John Schultz

    January 25, 2002, 04:48 PM

    My curve-based terrain system can use any basis. My favorites are b-spline (non-interpolating, C2), Catmull-Rom (interpolating, C1), and Bezier (depends: sometimes I *don't* want continuity). I can export an entire scene from 3DSMax using Bezier patches and immediately begin testing. Automated continuity processing for Beziers is easy.

    In summary it depends on how you are going to use the patches as to which basis to pick.



    January 25, 2002, 06:17 PM

    Holy crap. massive polygon pushing there. What are your system specs to get 6.53fps?


    January 25, 2002, 10:20 PM

    because beziers are in hardware on gf3?

    The GeForce3 supports both Bezier, Catmull-Rom and B-spline tensor product patches according to the official GeForce3 FAQ on NVidia's developer site. Quote:

    19. What types of higher order surfaces are supported by GeForce3?
    B-Splines, Bezier patches, and Catmull-Rom splines are all supported in hardware.

    20. Are these tessellated by the driver or by the hardware?
    GeForce3 has hardware support for curved surface tessellation. It is not done in the driver.

    Luke Philpot

    January 25, 2002, 10:52 PM

    Looks pretty good!


    January 26, 2002, 01:47 AM

    Machine specs are:
    AMD 1.2Ghz
    448 Mb RAM
    GF2MX 64Mb

    Everyone else:
    I used bezier patches because that's what i had the code to do :)



    January 26, 2002, 09:41 AM

    Good work, but FPS isn't so good;)...


    January 26, 2002, 11:40 AM

    well, thats good coding and all, but for a 1.2Ghz and GF2MX, 5.2 million (untextured) tris/second is kinda slow. I noticed that you said you draw 8 strips/patch, this is one of those cases where strips dont help, simply because of the function overhead, just think of it thats 57800 glDrawElements calls(the only reason youre even getting this framerate is the high processor speed). Try using tri lists, and one draw call, might help, probably get rid of those patch edge artifacts too.


    January 26, 2002, 01:53 PM

    mmm.. Nice textures :D

    It looks pretty much like the landscape where Cap. Kirk met V'ger in Star Trek I, all those prisms poping out of the ground.. But hey, they've managed to keep making sequals, Star Treck II, III, and so on..
    I think, That looks great and promissing for a fisrt-brute-force approach!.. I remember my
    "first_brute_force_terrain_trinagle_displayer" :D hehe, nice shiny white background with a brown-something (terrain) rotating!..

    Good Work!


    January 26, 2002, 06:03 PM

    In a nutshell, the answer to your question is that general-case Hermite and Bezier are better known. A lot of people have never heard of Catmull-Rom or Kochanek-Bartols, so when they look for information on how to implement parametric surfaces, they look for Bezier.


    January 26, 2002, 08:51 PM

    I think it is cool that you are making a terrain renderer at all. I love to see this stuff.

    Too bad I didn't study biology more though. It seems that no matter how complex the terrain, the frame rate of my eyes never seems to go down... (hehe)

    Keep up the good work, and never stop learning.


    January 27, 2002, 11:19 AM

    There are a number of nice features of bezier patches. They are guaranteed to be fully contained by their control points, making collision detection simple. Using deCasteljau's algorithm, calculating points on the patch is simple and quick. finding normals is equally trivial. Using the hermite variation on bezier patches, it is easy to create splines that have C1 or C2 continuity, although then you can lose the bounding vertex property. I don't really know anything about the Catmull-Rom patches, but I do know that beziers are pretty nice...


    January 27, 2002, 11:32 AM

    > I have not enforced continuity between the patches for smooth lighting

    Well, I truly believe that you should try.



    January 27, 2002, 12:26 PM

    Since terrain demos seem to be so common, and a lot of games use them.. does anyone know of a LOD library we could drop in once we generate our terrain? I have a tiled ocean that I need to add LOD to, but I'm sure it's been done countless times before.


    January 27, 2002, 08:19 PM

    New rule: for something to be called terrain, it must look like terrain. For code to be called a terrain engine, it must generate terrain.

    This is a very good bezier patch demo.

    Simon Wetterlind

    February 20, 2002, 01:23 PM

    Well, actually...

    nuff said.

    This thread contains 24 messages.
    Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.