Skip to main content
GameDev.net gamedev.net
🔒 Locked

Tiled Texture Blending

Started by fyhuang May 2, 2004 at 6:47 AM 5 replies 1.1k views
Original Post
fyhuang
fyhuang
If I were to draw a terrain with different tiles on it, how could I smmothly blend from one tile to another, without creating additional ''inbetween'' tiles?
- fyhuang [ site ]
_DarkWIng_
_DarkWIng_
Tiling Textures on the Plane part 1 & 2 by Paul Bourke: Clicky.

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
fyhuang
fyhuang
Well, what I meant more was that, if you had, say a dirt texture and a grass texture, without creating a ''transitional'' tile that blender dirt and grass together, could you use the hardware to smoothly blend the two tiles (kind of like a gradient)?
- fyhuang [ site ]
JTippetts
JTippetts
You can use multi-texturing and multi-pass rendering. The method I use is to draw the base type of texture (grass, dirt, or whatever) as normal (no multi-texturing), then layer a blend texture on top of it using multi-texturing.

Texture stage 0 is set to the terrain texture I am blending in, and stage 1 is set to a greyscale alpha map texture (8 bit) representing the blend pattern. Stage 0 is set to modulate (the default) and stage 1 is set to replace. This has the effect of taking color info from the terrain texture, alpha info from the alpha map, and blending it on top of the base texture.

If your card supports more than two texture stages, you could perform the base and overlay blending at once in a single pass. Also, blend layers can be layered on top of one another to generate complex, multi-type blends that would require a lot of memory usage if they were pre-generated transitions. In my 3D engine, I use up to 8 terrain type layers.


World of Golem
Doolwind
Doolwind
The best technique to use at the moment is called "Texture Splatting". Charles Bloom has written a great tutorial, which you can find here.

Doolwind

---------------------------------------------------------
Who of you by worrying can add a single hour to his life.
Matthew 6:27
JTippetts
JTippetts
quote:
Original post by Doolwind
The best technique to use at the moment is called "Texture Splatting". Charles Bloom has written a great tutorial, which you can find here.

Doolwind

---------------------------------------------------------
Who of you by worrying can add a single hour to his life.
Matthew 6:27


Texture splatting is a good technique, but I would hesitate at calling it "the best"; I''ve found that it doesn''t work so well when I want sharper, more defined boundaries between terrain types, such as edgings of lawns or sharply defined gravel paths and the like. Splatting tends toward blurry transitions, and gradual fades across the terrain.

With pre-generated sets of alpha masks, I can use similar techniques for geometry handling, but I don''t have to calculate the alpha blend texture on the fly, and I can use masks tailored to the transition I am trying to create, whether it be sharply defined or less so.

The downside, of course, is the tendency for the tile-based appearance to show up, but here some random noise can be useful just as with splatting.


World of Golem
de_matt
de_matt
I''m using texture splatting at the moment. It''s pretty good for medium detail terrain. You can use large, detaled tile textures. You may want to do an extra pass with extra details like roads or edges of lawns or things like that.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.