Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Is it possible to blend textures in DBC

Author
Message
pictionaryjr
16
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 20th May 2009 01:47
Is it possible to put to blend two textures into each other on a matrix so they don't look so jagged.

I went and got this off the internet real quick, but something like this how the textures blend into each other and aren't just squares.

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th May 2009 10:53
Yes.

There are a couple ways of doing it. One way is blending individual tiles/textures together to get transitioning versions.

Another way is to create a terrain image whose texture colors are influenced by the height of the terrain. Let's say you had a black and white height map. The closer to white the pixels are, the higher the elevation, the closer to black, the lower the elevation. Within the grey scale, you may match colors that also represent elevation. In terms of color values of 0 to 255 of the grey scale, perhaps 0 to 20 represent the color blue for water, 20 to 30 might be sand, 30 to 40 might be grass, etc. all the way to 255 which might be snow. You create a terrain color bitmap based on the height map. You could also create the color map from a randomized matrix. The height of the points would represent the colors of the color map.

Once the color map is created, you divide it into as many tiles as there are matrix squares. Each matrix square is textured with a single tile from the color map so you essentially texture the entire matrix with a single image of the terrain. Because the matrix tends to be large when used for a landscape, the texures will stretch and blend over the lines making it more seamless than tiling the same texture over and over. If you make the color image correctly with colors subtly transitioning, you can get a similar effect to what you posted. Take a look at the height map example in the attachment from
http://forum.thegamecreators.com/?m=forum_view&t=117150&b=10
I made a very basic colorizor that only uses 6 or so colors for a height map. It looks a little blocky, but it gets the idea across. If I had used more colors, the gradations would be more subtle.

If you want to go the way of blending multiple textures together, check out these great alpha blend routines:

Matrix tile blending

Enjoy your day.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 20th May 2009 12:55
I used to have nice big matrix tile sheets, with transitioning textures. Using a program I wrote ages ago called VanTrans, I'd get 2 128x128 textures, and use my program to generate all the transitions I'd need on a 4x4 grid. I'd have 4 different textures, so end up with a big matrix tile sheet of 8x8 textures.

If you transition between textures in sequence you can really get it smooth. For instance I'd transition from water to sand, then from sand to grass, then from grass to rock. There's even space left over for detail textures.

The tricky part is then deciding what tile goes where, which could be automated - in fact it should be automated because it's so tedious.


Health, Ammo, and bacon and eggs!

Login to post a reply

Server time is: 2025-06-08 09:41:21
Your offset time is: 2025-06-08 09:41:21