PDA

View Full Version : Problem with transparent tiles



Diaboli
29-08-2007, 02:15 PM
System: Dell M1710 (Intel Centrino Duo 2,16Ghz | 2048mb RAM | GeForce Go 7950 GTX 512mb)
Compiler/IDE: Delphi 2006
Library: UndelphiX

i've hit a snag:

I use TBackgroundSprites, and load entire tilesets in as the Images.
the tiles are 32x32 and are not spaced.

When i make the tileset transparent, with clFuchsia as the transparentcolor, many of the tiles get ruined.

It looks like the transparentcolor is not correct, but it IS set to clFuchsia, and the ruined tiles does not contain any clFuchsia...

http://thorins.net/prob.jpg

As u might guess, the left part is when i set the tileset to transparent, the right part is when it is NOT transparent...

its really frustrating...

FNX
29-08-2007, 03:16 PM
I use TBackgroundSprites, and load entire tilesets in as the Images.
the tiles are 32x32 and are not spaced.

If the tiles are not spaced i can't understand why you want to set the
transparent color :? :?:

Diaboli
29-08-2007, 05:35 PM
because some tiles does not fill an entire 32x32pixels, like some small flowers, small windows, etc.

User137
29-08-2007, 08:04 PM
I don't understand the problem. Left and right side tiles seem full and same, except for pixel wide spacing on other green tiles... Can you show example on base image you use on tiles?

WILL
30-08-2007, 12:54 AM
So what you are saying is that some will be background tiles and others will be a second layer of tiles that will be seen over the background tiles, yes?

Diaboli
30-08-2007, 07:03 AM
Will: exactly!

User137: well, they arent supposed to be spaced at all! they are supposed to look like the ones on the right part of the pic.

If i only had tiles that filled the entire 32x32 pixels, i would not have to use transparent (wich causes this error), but i need to be able to draw up to 5 layers of tiles...

OK, new pic:
http://thorins.net/prob2.jpg

these are in essential the same map, without and with transparent.

you can clearly see that there is some problem with the grass-tile when the tileset is set to transparent. it is as if the transparentsolor is not correct, right? but the transparentcolor is OK according to the settings. so there has to be an error in unDelphiX, or what?

Huehnerschaender
30-08-2007, 08:21 AM
I guess its an anitaliasing problem...

Try turning off antialiasing...

Diaboli
30-08-2007, 08:53 AM
tried to deactivate anti-aliasing, but it made no difference

Huehnerschaender
30-08-2007, 10:27 AM
Can you switch mipmapping off, too?

Diaboli
30-08-2007, 11:30 AM
Dont know how i do that.... :P

i can just upload the mapeditor + source, and u can see if it works for you?

http://thorins.net/mapedit.rar

Huehnerschaender
30-08-2007, 01:08 PM
sorry, but I don't have (un)DelphiX installed, so I can't test anything here...

But the problem you have seems familiar to me. I had same problems with other frameworks.

In DanJetX the problem can be avoided by setting


SamplerStates.AddressU[0] := D3DTADDRESS_CLAMP;
SamplerStates.AddressV[0] := D3DTADDRESS_CLAMP;
SamplerStates.AddressW[0] := D3DTADDRESS_CLAMP;

With this the rendering of transparent images shows no artifacts anymore. But I don't know how to set it in UnDelphiX... maybe someone else can help here...

User137
30-08-2007, 01:10 PM
Have you tried with different PatternWidth, PatternSkipWidth etc, also backgroundsprite's tile width has effect.

So if main image has 1 pixel wide bordering on tiles (black lines), and each tile is 31x31, then these settings would do:
PatternWidth: 31
PatternSkipWidth: 1
TileWidth: 31

Haven't used DelphiX for long time so unsure what exactly the variables are called... But it could also be small bug in unDelphiX where you would need to try 1 pixel larger approach to fill the gaps.

Huehnerschaender
30-08-2007, 01:56 PM
I really wonder why only the grass shows the artifacts... the palm does not! Or is the palm one big pattern? I guess its made out of many small patterns, isn't it? If so, then it should also show the black lines at the borders.

Paizo
30-08-2007, 04:06 PM
maybe is stupid but... images are in jpeg format or was originally in that formatt? ;)

jdarling
30-08-2007, 05:14 PM
Make sure you have a clFuscia reference pixel in your tiles images. If nothing else put a FULL 32x32 clFuscia tile in the set. Some times there is a problem with not creating a proper reference and instead it fails to the bottom right pixel color to select transparency. Then again it may be top left, bottom left, top right, it just depends on the mood :). Including a pixel of the color should fix the problem.

User137
30-08-2007, 06:10 PM
Dont know how i do that.... :P

i can just upload the mapeditor + source, and u can see if it works for you?

http://thorins.net/mapedit.rar
I tried opening the project in Delphi 7, waited 1 minute until i used taskmanager to shutdown hanged delphi... Checked mapedit folder to see the horrible truth: 36Mb big form file and 15Mb exe! Please make them load dynamically on startup :shock: Now that this part is known, i may suspect you are starting to run out of memory and program starts doing unsuspected things.

More so, tested exe that you compiled and didn't see problems:
http://i2.tinypic.com/66vmvkg.jpg

Loodziek
31-08-2007, 02:30 PM
Something is wrong with some sprites:

http://img77.imageshack.us/img77/8076/beztytuuvw4.png

Can u put your sprites here?

Diaboli
01-09-2007, 01:04 AM
Dont know how i do that.... :P

i can just upload the mapeditor + source, and u can see if it works for you?

http://thorins.net/mapedit.rar
I tried opening the project in Delphi 7, waited 1 minute until i used taskmanager to shutdown hanged delphi... Checked mapedit folder to see the horrible truth: 36Mb big form file and 15Mb exe! Please make them load dynamically on startup :shock: Now that this part is known, i may suspect you are starting to run out of memory and program starts doing unsuspected things.

More so, tested exe that you compiled and didn't see problems:
http://i2.tinypic.com/66vmvkg.jpg

hmmm i doubt i 'm running out of memory ( as i have 2048 mb of it), but dynamic loading is definitively something i should've thought of :P

i dont understand how it can work on your somputer, but not on mine, though..... could it have something to do with Vista?? what system are you running?

Huehnerschaender
01-09-2007, 07:30 AM
I tried it on my Laptop (DELL Latitude D820)

Core Duo T2400 CPU @ 1.83 GHz, 667MHz front side bus, 2MB L2 cache
15.4" WSXGA+ display running at 1680x1050
2048 MB DDR2-667 RAM (2x1024MB DIMMS)
NVIDIA Quadro NVS 120 graphics solution with 512MB TurboCache
120GB hard disk @ 7200RPM

WindowsXP Professional SP2

No problem here. I can use the editor as intended, no black lines.

But I also suggest that you think about separating the graphics from your exe :) That makes no sense!

User137
01-09-2007, 08:39 AM
what system are you running?
I am using Windows XP Pro, P3 933Mhz, 512Mb SDRAM, Radeon 9200.

Diaboli
01-09-2007, 09:57 AM
then i guess this is a Vista-problem.. .ARGH! :evil:

its probably something to do with the d3drm.dll, wich is not included in vista or something... (i get an error about that when i run any game/program i make with unDeplhiX)

does openGL work properly in Vista, and is it easy to convert from unDelphiX?

Huehnerschaender
01-09-2007, 11:04 AM
Maybe you just have to update your video driver if there is a new version available. I've heard of video card driver problems on Vista many times before....

Diaboli
01-09-2007, 11:32 AM
I got the newest available driver... there arent many drivers available for Geforce Go 7950GTX...