samples on multiple texture mapped terrain?

Started by
14 comments, last by GekkoCube 22 years, 1 month ago
are there any tutorials/samples on how to do multi-texturing on terrain landscapes? for example: i want the valleys to have a grass texture, the hills to have a very lush grass texture, and mountains to have a rocky/snowy texture. and i want the texture transition (i.e. valley to mountain) to be very smooth. I have seen this as a demo. but I am unsure how they did it. some theory would be great! thanks. ~ I am a DirectX to OpenGL convert! ~
Advertisement
Dunno if this would work, but you could render the terrain 3 times. Once for each texture. On each render you then set the alpha values and blen it all. For example when you render it with the grass texture, you have the alpha value in the valies high, and low in the mountains and hills.


Edited by - reverse_gecko on February 22, 2002 10:16:38 AM
Jeff Bland (Reverse_Gecko)reversegecko@gmail.com
There are plenty of ways...

Rendering the terrain 3 times is not the wya as it is slow...

What you do is you pregenerate the texture map using the height map... There was posting on here 1-2 weeks back check around...
i found an article over at flipcode about pregenerating the texture, the downloadable program produces a great texture, but i am not sure how to apply it to my terrain,

http://www.flipcode.com/tutorials/tut_proctext.shtml

check it out, pretty interesting, later-



what we do in life... echoes in eternity...
The "pregen the composite texture" technique is ok but keep in mind it cannot repeat, so it will be a bit coarse, as it is a one to one mapping (one texture to one mesh or subportion).

It can look good though if you multi-pass it with other textures with higher scaling for some better detail.

Currently I am playing with a small terrain on a small 30x30 mesh (adj. 10-100), it has 4 layers: a repeating 30x scale vertex-shadowed ground texture, a blended repeating 2x scale texture for patchy color, a blended repeating very high 750x scale texture for detail, and a blended repeating 6x scale scrolling texture for a rolling mist/cloud shadow effect. (for my Physics contest entry)

I am not using the multitexture extension but am doing it in small culled strips. Along with quite a few other elements (several cloud and water meshes, several spheres, several billboards, and several fullscreen quads for noise/dimming lightmaps, and am getting 50-100 fps on my 1 gig athlon w/ geforce2. And that w/ an unoptimized detail layer.

Whether or not you use the multitexture extension, multipass is the only way to get nice terrains. Look at several commercial games w/ good terrain and you will see many scales of texture employed.

I should also employ reverse_geckos techniques of multipassing different zoned textures, I did that in my EruptionZ app, 4 layer multipass (small 20x20 mesh!) in 180 fps, check it out. But that means 8 layers if I don''t drop 1 or 2.

zin

zintel.com - 3d graphics & more or less
zintel.com - 3d graphics & more or less
180fps!

I ran Nehe''s first few demos and I only get 80fps max!
I have a PII-350, 197 ram, and a geforce2 mx 200 (which can theoretically o about 25 million triangles per sec).

What am i doing wrong?
what can i do to improve my fps for Nehe''s demos?

~ I am a DirectX to OpenGL convert! ~
disable vsync
-eldee;another space monkey;[ Forced Evolution Studios ]
You could draw each tile once for every texture that needs to be applied on it.
Here''s how i do it:
First texture, you disable blending and draw the first one, with glColor3f setting the needed percentage (0,0,0 or 1,1,1) of the current texture for each vertex.
Then, for the second or third texture if they need to be drawn, you set blending to (GL_ONE, GL_ONE) which is additive blending and you draw the triangle again, with the new texture, and for each vertex you set the glColor3f to the percentage needed.
This way you can have three textures fading into each other at the three vertexes of a triangle.
Note: the total sum of the glColor3f at any vertex should not exceed (1,1,1) and not be below (0,0,0), except if you do lighting yourself.
Ok, doing multi-pass texturing will definitely make my terrain look better...but thats not exactly what im trying to do right now.

Here is what i mean...for example:
I have a landscape representing the Grand Canyon.
On the surface ground level, I want a grass texture.
On the cliffs of the trenched I want a dirt texture.
And on the very bottom of the canyon I want a mud texture.

So now I have 3 textures to work with.
But within my loop I call

SetTexture(0,&texture); // directx code.
terrain->Render();
SetTexture(0,NULL);

which basically updates my quadtree and then renders it!
But notice that I apply the texture to the whole mesh!

Should I just simply call different SetTexture() calls within the terrain->Render() function? This way I can apply textures to different areas of the mesh...although it would require more coding to get the texture coordinates right.

Now I''m more curious then ever!! How do "they" apply multiple textures on a terrain mesh?!?!
Argh!


~ I am a DirectX to OpenGL convert! ~
THe way i did it, was pregenerating the textures. I take 5 diff, textures, snow, rock, grass, beach, and then water. This is how the article i mentioned earlier does it and their is code to download too that shows you how to do it. It blends the five textures, depending on the height value, into one texture which i then apply to my mesh. The end result is very nice, and is what i think you are looking for, i could post a pic of my textured terrain if you want to see it. Give it a try and if you need help with the code let me know, later-

what we do in life... echoes in eternity...

This topic is closed to new replies.

Advertisement