Sign in to follow this  
JL4453

Terrain texturing - multi pass or multi texturing?

Recommended Posts

JL4453    122
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.

Share this post


Link to post
Share on other sites
Digitalfragment    1504
"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.

Share this post


Link to post
Share on other sites
JL4453    122
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this