Hi
First of all, it's hard to express such complicated stuff like I am about to do. Especially if you do it in a foreign language. So please let me know if you don't get my problems or if there are any other inaccuracies in my description.
I'm working on a mesh terrain engine, right now I'm at the decal code. Decals are supposed to be 2d textures that are put on the terrain and fit the terrain's shape.
The terrain consists of tiles that are each .5 x .5 blitz units large. All vertex points' heights can be changed.
As I wrote before the decals should fit the shape of the terrain. In order to assure this everywhere where
a) the decal is on a crosspoint of the tiles
b) the connections of the edges of the decal overlap a terrain's line
must be a vertex point of the decal. Yes I know, noone knows what I'm talking about right now. But please have a closer look at the graphic and think a bit about it:

(the green thingy is the decal, the red circles mark cutting points)
If I had a plane instead of this and the terrain mesh would be a little higher at this point, the decal would not be visible at all.
So I'm getting to my first problem at least ;)
How would you try to get the cutting points described in b) ? I've got the ones described in a). Hint: The coordinates of the 4 edges are given.
Now for my second problem:
Let's say all the cutpoints are given. I first thought to connect the edges of the decal with 2 triangles, then go for each cutpoint, clip the triangle it is in and create three new triangles so that the cutting point would be a 'real' vertex point of the decal.
This was the result (wframe):

(note that the only the cutting points described in a) as well as the edges are in this screen)
Looks OK at first. But imagine if you lifted some of the terrain points - exactly, the terrain would be over the the decal again. Why? Because the grey lines (decal) overlap the brown lines (terrain). This is a result of the rather random clipped triangles. How to fix that? Well, I thought about the same procedure I've just described but for each single tile.
Now we've got a new situation:

Given are the cutpoints of this single tile. But how do I know how to add the tiles without adding too many but still covering the whole area restricted by the cutpoints? This is easy of course with three or four cutpoints. But with a bit of luck I will have to do this with up to 8 of them.
Now that you're completely confused 8) I want to thank you just for reading till the end. I would very very much appreciate if you told me whether you have understood the text or not. And it would be absolutely perfet if you had any ideas for solutions of the problems.
First of all, it's hard to express such complicated stuff like I am about to do. Especially if you do it in a foreign language. So please let me know if you don't get my problems or if there are any other inaccuracies in my description.
I'm working on a mesh terrain engine, right now I'm at the decal code. Decals are supposed to be 2d textures that are put on the terrain and fit the terrain's shape.
The terrain consists of tiles that are each .5 x .5 blitz units large. All vertex points' heights can be changed.
As I wrote before the decals should fit the shape of the terrain. In order to assure this everywhere where
a) the decal is on a crosspoint of the tiles
b) the connections of the edges of the decal overlap a terrain's line
must be a vertex point of the decal. Yes I know, noone knows what I'm talking about right now. But please have a closer look at the graphic and think a bit about it:

(the green thingy is the decal, the red circles mark cutting points)
If I had a plane instead of this and the terrain mesh would be a little higher at this point, the decal would not be visible at all.
So I'm getting to my first problem at least ;)
How would you try to get the cutting points described in b) ? I've got the ones described in a). Hint: The coordinates of the 4 edges are given.
Now for my second problem:
Let's say all the cutpoints are given. I first thought to connect the edges of the decal with 2 triangles, then go for each cutpoint, clip the triangle it is in and create three new triangles so that the cutting point would be a 'real' vertex point of the decal.
This was the result (wframe):

(note that the only the cutting points described in a) as well as the edges are in this screen)
Looks OK at first. But imagine if you lifted some of the terrain points - exactly, the terrain would be over the the decal again. Why? Because the grey lines (decal) overlap the brown lines (terrain). This is a result of the rather random clipped triangles. How to fix that? Well, I thought about the same procedure I've just described but for each single tile.
Now we've got a new situation:

Given are the cutpoints of this single tile. But how do I know how to add the tiles without adding too many but still covering the whole area restricted by the cutpoints? This is easy of course with three or four cutpoints. But with a bit of luck I will have to do this with up to 8 of them.
Now that you're completely confused 8) I want to thank you just for reading till the end. I would very very much appreciate if you told me whether you have understood the text or not. And it would be absolutely perfet if you had any ideas for solutions of the problems.
