Posted: 25th May 2003 20:20
Are you fed up with your lovely seamless textures looking rubbish when applied to a matrix where the edges of some tiles 'bleed' into the next?

What you need is the following:

Stick this after you create matrix:

filter=1
set matrix 1,0,0,1,filter,1,1,1

Have put filter as a variable as this MUST stay at 1 to work and it is easier to show you. You can change the other parameters to suit.

Tried EVERY other combination of loading images, filtering, texturing, e.t.c. and only this answer fixes problem (in P4.1 anyway!)

No doubt P5 will change everything again though.
Posted: 25th May 2003 20:43
here's an example .. work for db too if you load an image, and delete the create bitmap and others 2d commands :


+ Code Snippet
set display mode 1024,768,32
sync on
sync rate 50
randomize timer()
create bitmap 1,128,128
hide mouse
set current bitmap 1
box 1,1,64,64,rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
box 64,1,128,64,rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
box 1,64,64,128,rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
box 64,64,128,128,rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
get image 1,1,1,128,128
set current bitmap 0
make matrix 1,1000,1000,50,50
randomize matrix 1,20
prepare matrix texture 1,1,2,2
for x=1 to 49
   for z=1 to 49
      set matrix tile 1,x,z,rnd(3)+1
   next z
next x
update matrix 1
position camera 500,0,500
do
set cursor 0,0
print "Screen fps > ",screen fps()
print "Filter number ",filter
print "Press the keys 1 or 2 to change it."
   if upkey()=1 then move camera 0.3
   if downkey()=1 then move camera -0.25
   if leftkey()=1 then turn camera left 5
   if rightkey()=1 then turn camera right 5
   position camera camera position x(),get ground height(1,camera position x(),camera position z())+4,camera position z()
   sync
if inkey$()="1" then filter = 1
if inkey$()="2" then filter = 2
if inkey$()="1" or inkey$()="2"
   set matrix 1,0,0,1,filter,1,1,1
   update matrix 1
endif
loop
Posted: 25th May 2003 20:44
Alternatively you could just use memblock matrices
Posted: 25th May 2003 21:21
Slightly modified version of Attreid's code as some of the commands are 1 pixel out. (hope you don't mind)

I do notice that on in this example the textures go a bit blocky close up but that is only because of the colouful gradients. Most textures are not this detailed.

+ Code Snippet
set display mode 1024,768,32
sync on
sync rate 50
randomize timer()
create bitmap 1,128,128
hide mouse
set current bitmap 1
box 0,0,64,64,rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
box 64,0,128,64,rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
box 0,64,64,128,rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
box 64,64,128,128,rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
get image 1,0,0,128,128
set current bitmap 0
make matrix 1,1000,1000,50,50
randomize matrix 1,20
prepare matrix texture 1,1,2,2
for x=0 to 49
   for z=0 to 49
      set matrix tile 1,x,z,rnd(3)+1
   next z
next x
update matrix 1
position camera 500,0,500
filter=1
set matrix 1,0,0,1,filter,1,1,1
do
   set cursor 0,0
   print "Screen fps > ",screen fps()
   print "Filter number ",filter
   print "Press the keys 0, 1 or 2 to change it."
   if upkey()=1 then move camera 0.3
   if downkey()=1 then move camera -0.25
   if leftkey()=1 then turn camera left 5
   if rightkey()=1 then turn camera right 5
   position camera camera position x(),get ground height(1,camera position x(),camera position z())+4,camera position z()
   sync
   i$=inkey$()
   if i$="0" or i$="1" or i$="2"
      filter=asc(i$)-48
      set matrix 1,0,0,1,filter,1,1,1
      update matrix 1
   endif
loop
Posted: 26th May 2003 2:49
hurrah finally it works in the latest patch!

yay thanks I tried filtering it in previous tests but now it seems fine