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 / Texturing a Matrix

Author
Message
Jackdaw11
21
Years of Service
User Offline
Joined: 29th Sep 2003
Location:
Posted: 29th Sep 2003 17:27
This is what I have...

a 64x64 pixel bitmap
a 6400x6400 matrix with 64x64 tiles

This is what I want...

apply that bitmap to that matrix in such a way that the entire bitmap fits over the entire matrix

This is what happened...

First, I tried without splitting it into different tiles and every tile had the entire bitmap.

Second, I tried to split the bitmap into 64x64 tiles and applying each tile from the bitmap to the tile on the matrix. This worked, however, it doesn't look good. The edges are very pronounced.

Any ideas?

Thanks.
skovron
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 29th Sep 2003 18:30
Yeah I know the problem. It happens due to pixel filtering algorithm which takes for processing neighboring pixels. It looks good along entire texture except the edges, where it have to take pixels from neighboring tiles or from out of texture.
You need to use command SET MATRIX TRIM matrix, trimx, trimy. It moves texture border by offset (trimx, trimy)
But you must experiment with values and find that suits your program. I used 0.24, 0.24
I hope it'll help
Jackdaw11
21
Years of Service
User Offline
Joined: 29th Sep 2003
Location:
Posted: 29th Sep 2003 18:55
I am using DB Classic, and I think SET MATRIX TRIM is only available on DB Pro.

Can anyone confirm that DBC doesn't support SET MATRIX TRIM or anything like that?

Thanks.
skovron
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 29th Sep 2003 19:23
If so then sorry! I have used this command only once with DBP ofcourse (I dont use matrix anymore, I am trying to replace matrix with meshes) and i didnt know its missing in DBC.
Sorry but in this situation I dont know how to solve your problem.
ReD_eYe
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 29th Sep 2003 22:14
try playing with the set matrix command, i think setting the filter to 2 might make the edges blur or something similar, so it might look at bit better


TDK_Man
21
Years of Service
User Offline
Joined: 24th Aug 2003
Location: Tenerife, Spain
Posted: 4th Oct 2003 16:51
The problem is quite simple to solve - increase the size of your texture bitmap.

64x64 pixels is not enough data so DB does it's best to stretch onto the matrix. Try with a 1024x1024 texture and you'll notice the difference.

DB's Prepare Matrix Texture is all that is needed to create the tiles from the texture bitmap and there's an example program demonstrating this on the Source Library board at the MatEdit forum (http://www.matedit.com/forums). You will have to register (free) to access all of the boards though.

TDK

MatEdit Pro Info & Progress Reports: http://www.matedit.com

Login to post a reply

Server time is: 2025-05-20 14:17:15
Your offset time is: 2025-05-20 14:17:15