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.

Newcomers DBPro Corner / any suggestions on this one

Author
Message
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 17th Aug 2004 20:52
ok so what i have a matrix in my level, very big, nice looking, except the tiling

i want a way that i can create on the fly transition textures so that it doesnt all look so blocky

creating the textures beforehand isnt really an option since i create the level on the fly and i never know which way a texture needs to be facing...

i know theres a program that does this to make nice textures but all i really need is the algorithm, maybe a snippet

thanks guys
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th Aug 2004 21:27
The easiest way to do it is with a distance check, like if you have a block of 4 tiles, 2x2 - and say the mid point is your texture hot-spot. Now if you step through all the pixels in your 2x2 grid of tiles, and check the distance to the hot-spot - you can calculate a smooth transition quite easily.

Ideally you'd have access to both textures, it's a matter of deciding how much of each pixel from each texture to use on your new texture. If your tiles are 128x128, then your hotspot distance should be between 0 and 127, divide by 128 to get a real number - and use this to balance the colours.

Remember the RGB, RGBR, RGBG, and RGBB commands, you need to seperate the colour values and treat them seperately, but really - you could use a function like this:



Using this, you need to know both pixel colours from each texture, and the amount to adjust the balance by - which you can get from a distance check. You'd end up with 4 corner pieces, but from there the rest is easy - just vary the hot spot, for straight edges - simply move the hotspot to the relevant location, like horizontally, you'd move the hotspot to the same X location, but keeping the Y location static.


Van-B


Muhahahahaha.
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 17th Aug 2004 21:39 Edited at: 18th Aug 2004 00:49
ok so pretty much i just build a bitmap in memory to handle the new texture eh

EDIT: nm

btw thats a fantastic idea man thanks
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 18th Aug 2004 00:49
is there a way of changing a single tile's texture at a time without retexturing the whole matrix?
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 18th Aug 2004 02:11
I already did this in your other post with the line:

set matrix tile 1,f,g,rnd(3)+1

this updates tile f,g with a random tile (1-4) from your 2*2 texture

You may need to do an UPDATE MATRIX for things to take effect.


Boo!
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 18th Aug 2004 02:54
yea the thing is, i have a texture map right, now i want to be able to change it when i am applying the texture, how am i gonna match the colors if i havent put them on yet

what i was gonna do is go through the whole matrix first and build the image into memory with a tile index table, then just apply all the tiles

its tricky though because i need to know what all the tiles around the current one are

set matrix tile only works if you alrady have the tile loaded
but i want to create new ones from the ones i start with
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 18th Aug 2004 10:21 Edited at: 18th Aug 2004 12:08
hey van

im working on my testbed for the interpolation thing and i was wondering what you would recommend for choosing the tile and getting new color points

as it is right now im looping through each tile and checking the one in front of it to get the new color points

this is a pretty horrible method as you can imagine. i was wondering what your thoughts were on this

also the color seems to always be grayscale on the function you hooked me up with

but im sure i can fix that

EDIT: heres the gist of my code
matt rochon
21
Years of Service
User Offline
Joined: 15th Mar 2003
Location: Canada
Posted: 19th Aug 2004 23:24
anyone got a suggestion?

Login to post a reply

Server time is: 2024-09-22 21:25:08
Your offset time is: 2024-09-22 21:25:08