Multitexturing

Hi!

I would like to know if the following problem can be implemented with ogl or some shader.

I have a primitiv like a quad and I applied a grass texture to this quad. Now I would like to map onto the same quad some river texture, but I would like to apply this texture to a part of this quad.

|-------|
|| ||this is the grass textured quad
|-------|

Now i have a simple blue texture and I would like to map it onto the quad above but just in the range [0.3,0.6] of the quad so I can see a blue line on the quad.

|-------|2
|| |`| ||1|`|
|-------|

1 = the river texture
2 = this is the grass textured quad

thanx

Just a little bit of multitexture should be enough, you will need a texture with alpha that is white where you want river, and black for grass.

Have a look at this tutorial, it is more advanced than what you need, but should help :
http://www.delphi3d.net/articles/viewarticle.php?article=terraintex.htm

This is not really advanced, and please fix your poste with [ code ] tags, so that your ascci art is understandable :stuck_out_tongue:

thanx for the link
but how can I solve this problem on a CLOD Terrain?

Imagine you have a high resolution mesh near to the eye point and low resolution far away. so I could have just two traingle for the terrain far away from me but I still want to map a river texture on those
triangles? But I want my river texture to cover just a part of the triangles ground texture because of the perspective view the river appears thiner far away. Do I need to create new texture coordinates on the fly for my river texture in a manner that it does just cover the aimed area of the triangle. This application should run in real time. Do you have any suggestion for this problem.

thanx
nicolas

Please, fix first your ascii art.

For texture coords on lower geometry lods, just keep the ones you already have for detailed lods. The vertices at the same ‘place’ have both the same object coordinates and texture coordinates.

I don’t really see a problem here, maybe I missed something in your explanations.

Imagine the following situation:

near the view point I have high res mesh, so I have sufficient geometry info to texture some primitives with grass and some with water. But far from the distance the terrain has still the same width but is represented just by two primitives(triangles) if I would use the same texture coordinates I would first texture the two triangles with grass texture and then with a water texture.

But I just want to see a river becoming thiner. One possible way to solve this is to force the mesh to be high res where the river is flowing. I want keeping this low res terrain and using some fragment shader to shade the river part within the texture space of the gras texture. So I would need to create a new texture space for the river texture within the gras texture space. you got my idea?

Grass Texture Space ranges from [0,1] in two dimensions.

in the range [0.4,0.6] in x and [0,1]in y I want to map my river texture.

If I couldn t explain my idea well, you are french ?, so I will try to explain it french which is far better than my english I think

nicolas

So, what about using texcoords beyond the [0,1] range ?

'|' and '-' are edges
. delimits the texture on low detail mesh.

High res : 
|--------|
|  | |   |
|  | |   |
|  | |   |
|--------|
   0 1 (texcoords for x-axis)

Low res :
|--------|
|  . .   |
|  . .   |
|  . .   |
|--------|
-1       2 (texcoords for x-axis)

With proper texture wrap mode, it should be okay.
See the bottom of this page :
http://www.flipcode.com/tutorials/tut_atmap.shtml

For discussion in french, send me a private message (icon with two peoples and the letter).