Archived

This topic is now archived and is closed to further replies.

NeXius

Bezier-patch terrain

Recommended Posts

Hi I''m making an terrain editor. The terrain is stored as a map of Catmull-Rom patches and the user moves around control points to edit the terrain. It works fine at the moment, but something I''ve wanted to do from the beginning is not just overhangs, and not just caves, but caves that go under the ground and pop up somewhere else on the terrain. I''m trying really hard to figure out how to do this, but I just can''t visualize how this is possible. Anyone ever attempt anything like this? Also post if you have a question about the editor...
MSN: stupidbackup@hotmail.com (don''t both e-mailing) ICQ: 26469254 (my site)

Share this post


Link to post
Share on other sites
Let me explain some more.

The problem is that while you can easily make a cylinder of catmull-rom patches that connects to four control points on each end, you can't connect this with a terrain of patches

Here's a picture:





Now, all I want to do is continue building the little mound there up into the sky while maintaining continuity with the terrain, but I can't get it to do this because when choosing a corner point on the terrain, there is two to choose from (1 and 2, assuming we're talking about the closest patch) and therefore I cannot maintain continuity...

Any bright ideas?

EDIT: clarified a bit more

[edited by - nexius on May 6, 2003 7:18:10 AM]

Share this post


Link to post
Share on other sites
it seems you have a rigid grid of spline patches: that way youll never be able to even make overhangs i believe, let alone caves that will connect two part of the map. in order to archieve that, youll need a moer dynamic structure i think.

Share this post


Link to post
Share on other sites
I don''t have the patches stored as a two-dimensional array or anything... It''s just a vector of patches. You can easily add patches, delete patches, and modify

Share this post


Link to post
Share on other sites
well, the thing is, the x and y positions of your patches seem to be fixed, only the z position is variable. if you were able to drag the controllpoints freely in all three dimensions, that would make overhangs a piece of cake.

if you want interconnecting tunnels though.. hmm that would be kinda hard i suppose. maybe if there was no array or vector, but some sort of linked structure? ie each spline has a pointer to its four neighboring splines, and you would be able to add patches freely in an editor, it would be possible i suppose, but that would be quite hard i think.

Share this post


Link to post
Share on other sites
Yes! That''s exactly the way it''s set up.

The patches can be modified in three dimensions (the way it works is that if you just hold down the left mouse button, the point goes up, and if you hold down the right button too, it can go up but also right, and if you''re just holding the right button, it goes forward and back).

And each patch has links to its four neighbouring nodes and also 16 references to control points that make up the 2D grid.

Overhangs are a piece of cake, and even caves, but this tunnel thing is where I hit a snag.

Share this post


Link to post
Share on other sites
Is there not some method of using trimming you could use, to somehow cut a hole through the terrain?

I''ve not really started to learn curved surfaces though, so I wouldn''t really know.

Share this post


Link to post
Share on other sites
quote:
Original post by OklyDokly
Is there not some method of using trimming you could use, to somehow cut a hole through the terrain?



Yes, but it wouldn''t be continuous, so it would look really bad.

quote:
Original post by Thunder_Hawk
How about two patches connected along a "seam"?



I''m not sure what you mean. Could you explain a bit more?

I appreciate the help!

Share this post


Link to post
Share on other sites
ok, your screenshot didnt show that, but if thats already in, thats great.
yet if you want those tunnels... not connected tunnels should already be easy to do, right? just mold a hole.

now if you want a cave with two entrances, or maybe even more, imagine this:
you make two tunnels in your landscape, and you bend the endpoints together. if you have this picure in your mind, its obvious youre going to need to knit these two tubes together by, in the i think easiest way, taking away the patch at the very end of both tubes, and connecting the four open edges with those on the other side.
but i dont know if this way of working will go along with your other routines, like the rendering. it will surely ask a little more from your gui to get such a thing working in an editor...

Share this post


Link to post
Share on other sites
Yes, and this is what I assumed I could do all along.

I get to the stage where I have two deep caves that end at the same four points, and then delete the two patches made from those four points, but the problem occurs when I try to make it continuous.

It's hard to explain, and hard to visualize (which is why I mistakenly assumed I could do this) but consider this diagram:



Say each intersection of two lines makes a control point. Using these sixteen control points we can draw a catmull-rom patch in the middle square. Also assume that there are more control points around the drawn box that determine the structure of the remaining 8 patches.

Say we delete the middle patch, and we want to build a tunnel around the edges of the patch (going up out-of-the-monitor).
So we add four more points above the points [1][1], [1][2], [2][1] and [2][2] that define the basic area of the new patches and four more points above these.

To build the bottom side (the patch spanning across points [2][1] - [2][2]), it would have points [3][1] and [3][2] as it's bottom points. The top points would be made from the new points added above its basic points.
The point [1][1] and the new point above that as it's left points. The point [1][2] and the new point above that as it's right points.

But what about the corner points?

What the heck do I assign for these?

Sorry like I said it's hard to explain

It doesn't seem possible to maintain continuity


EDIT: made the diagram an image cuz my ascii picture didn't work


[edited by - nexius on May 6, 2003 6:23:35 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
rather than have the caves end at the same points, can you just delete the end patches and make new patches to connect them?

if not, switch to a different subdivision scheme maybe? i know for a fact that fitting cubics with slope constraints across the patches will work.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
rather than have the caves end at the same points, can you just delete the end patches and make new patches to connect them?



This simplifies things, but it still appears impossible to make continuous.

quote:

if not, switch to a different subdivision scheme maybe? i know for a fact that fitting cubics with slope constraints across the patches will work.


Ya, it appears this is the only way. What do you mean slope constraints? Something like N-Patches? Please elaborate, as I would really like to achieve this effect!

Share this post


Link to post
Share on other sites