Terrain texturing - multi pass or multi texturing?

Started by
3 comments, last by JL4453 15 years, 8 months ago
Hi, I'm working on an OpenGL implementation of Texture Splatting to dynamically handle the tile transitions in my tiled terrain. I am really just learning how blending & multi-texturing work, and am fairly confused. I have four terrain tile textures, and for those who aren't familiar with texture splatting it means I have basically four alpha-maps, one to mask each terrain type on top of whatever is already textured there (to create a gradual transition between textures on the border of the tile). Basically for each terrain square I have to apply as many as four tile textures, and three or four mask textures. I also have road tiles, rivers and other overlays that I want to be able to just paste on top once the base tile is textured. I know how to do each of these steps individually with glBlendFunc, but I'm concerned about the proper way to combine all the steps. Thats a total of more than 10 textures. I was wondering if it is common to do 10 separate passes in a terrain rendering, I suppose just using glBlendFunc to blend each texture in one at a time while repeating the calls to the vertex array/buffer each time just with a different texture loaded and different set of texcoords. I suppose it would be better to use multi-texturing to do a lot of it in one pass - I seem to gather that multi-texturing does NOT use glBlendFunc (?). But then how exactly does the multi-texturing decide how to mix the multiple textures? The various tutorials I've found don't seem to go into much detail. Also, it seems to be that video cards vary on how many textures they can multitexture at once, I've heard that 8 is the maximum on at least some cards. Should/could I do perhaps 2 passes, one for the terrain splatting and one for the overlays (roads etc.)? Any advice or help would be much appreciated.
Advertisement
Doing those 2 passes sounds like a good idea. Just remember to use a GL_EQUALS depth test for the second pass.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
"I seem to gather that multi-texturing does NOT use glBlendFunc (?). But then how exactly does the multi-texturing decide how to mix the multiple textures?"

glBlendFunc is used to control how each final pixel (after being textured/shaded) is transferred into the destination buffer. This is why glBlendFunc() makes sense to be used in a "multiple pass" solution.

In multi-texturing you are combining multiple textures in the same pass *before* they are transferred to the destination buffer. This is why glBlendFunc() isn't used for this.

If you are using the fixed function pipeline, then multi-texturing needs to be performed via glTexEnv / texture combiner setup. If you are using shaders, then you manually perform the sampling and blending of textures in the pixel shader.
Thanks for the replies.

After wrestling with this all day, it seems I have indeed been ignorant of the concept of texture combining made possible by the OGL multitexturing extensions. There doesn't seem to be very good documentation on these, I'm trying to piece together what the various combine modes do from various sources like this terrain tutorial:

http://www.cs.auckland.ac.nz/~jvan006/multitex/multitex.html

It is slow going but I think I may be able to combine all of my tile masks, tile textures and overlay textures for multitexturing in one pass using only one or a few texturing units.
Found it - documentation for texenv combine modes:

http://www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml

This topic is closed to new replies.

Advertisement