Colorkey and map tiles

#1
I spent much of the morning today trying to figure out why the little triangles you sometimes see around map tiles in som_db.exe were showing up in DarkDestiny with Ex in some modes.

It turns out whether intentional or accidental, under som_db.exe colorkey is disabled for map tile textures, even though the textures themselves are colorkeyed. But in a som_rt.exe game (built game) colorkey is enabled.

Sometimes there are little triangles embedded in map tiles, either intentionally or accidentally. They may work like control points, or just be visual cues. I thought sometimes they were yellow, but they seem to be black... at least in a som_rt.exe game. They may well have a yellow texture under som_db.exe.

Anyway, what this means is when you're working on your project (normally) if you make a map tile and wanted to knockout some texels like the way you can with objects by making them black, that would not work. But after you build your game, the texels will be knocked out. And in fact if they are not there are many map tiles which have those little triangles which if visible in a final game would be bad.

Anyway, what this means is you should be able to use transparent texels just fine with your custom map tiles, even though I'm not sure any that come with Som do so (probably not)

With Ex I'm tempted to just always apply the colorkey even under som_db, but may just add a do_colorkey option so you can get the same effect while working on your project until we can figure out if there is any significance to the way Som handles this. If the little triangles are indeed yellow under som_db.exe then colorkey would probably not apply to them anyway (not being black)

Another thing to keep in mind is the colorkeying under Ex actually looks really great, because it is filtered (smoothed / not jagged) when your texture is done correctly.
Reply

#2
I've never been able to have inivisble textels on any map pieces so far.

Could you explain how to get them on maps?

I know how to do it on objects.

Cheers
Reply

#3
Should work the same way with map tiles. The thing is they won't be invisible until after you build your game (from what I can tell)

With Ex you can have them invisible from the map editor or whatever. Without you'll have to use your imagination.
Reply

#4
PS: I gotta warn you against using the texel knockout technique without discretion. Even with Ex you really want your texels to be not much larger than a few pixels on screen. If the player can get too close they will appear jagged / unnatural. Square without Ex. Bumpy with Ex.

With Ex the player can get a lot closer without things looking weird. And at least with Ex everything is passed thru a linear filter. It just looks strange when some things are filtered and others are not.

Multisampling might help... I'm not sure. But that's a pretty expensive technique / not always available. It's something I plan to add to Ex eventually.

If you are not trying to obtain fine detail, you might be better off using a flat polygon based cutout instead.

Colorkey is great for grass and tree limbs that the player can't get too close to. They don't scale up well.
Reply

#5
Another thought,

It may be colorkey was disabled for map tiles in som_db.exe mainly because by some process Som optimizes the map tiles, so like if it thinks there is a solid wall the player can't see thru, it won't draw the tiles on the other side (sometimes) and most likely Som does not take into account colorkey texels when making such judgments.

You can uncheck the "optimize map" box I think, but generally speaking that really slows things down, and may not help in all cases (if my memory serves me)

So anyway, I don't recommend integrating transparent texels into walls and such. But it should be pretty safe for object like things baked into the map tile. If you do it with a wall, make sure there are other polygon based windows going thru that wall.
Reply

#6
I may have spoken too soon, I'm not really sure...

I noticed after turning on colorkey for map tiles in som_db.exe at least one set (the dragon temple kind) had holes in it...

So I fired up Dark Destiny and went looking around for holes, but I did not find any. I was able to find a similar set if not the same in DD and it did not have holes. It was definitely leveled so not to have holes.

So at this point I'm wondering how / at what point the map sets are/were leveled...

It could be either A) som_rt.exe levels map textures at runtime... not likely, somewhat wasteful of load time depending on how things are loaded. B) the map textures are leveled before being copied into your final game folder. Seems plausible but an odd decision. C) these map textures were merely patched at some point either by From' or by game authors (if any of you remember doing that, it would be good to know)

Anyway, it will take some time to get to the bottom of this. I'd be interested in hearing about anyone's attempts to make colorkeyed map tiles work with your game. Especially if say you have the colorkey working in your project, but after building the game it is lost (because your knocked out texels are leveled away)

I'm going to leave things as is for now since it doesn't seem to break release builds.
Reply

#7
I've spotted at least a few textures coming out of my Som install folders which have holes, where their counterparts from Todd's Dark Destiny folders don't seem to. So I'm thinking my files are not up to date with From's patches.

Either because the installer I used was not patched as well as it could be, or because I may have overwritten some stuff with a copy of Tom's repository from his DoM project, which might've been unpatched.

Anyway, I'm kind of interested in trying to update my repository, but I also worry about breaking stuff. I figure the best move would be to just take whatever mega download you guys can recommend and overwrite the stuff I have with it (after I first back everything up)

Reply

#8
I'm working on cobbling together an anti-aliasing filter for the colorkey-ed textures which I think will mean perfectly smooth outlines along the knocked out texels.

Websearches led to few leads, but I think I lucked out and stumbled over a very pertinent discussion on the same board I was posting in for charity Evil

https://www.gamedev.net/community/forums..._id=586188
https://www.gamedev.net/community/forums..._id=583531

PS: The current outlines are technically perfectly smooth, but they are also lumpy Doh

Still better than square / look quite nice if the texels are not too large on screen.
Reply

#9
Tracked down the code for GIMP's antialias filter, but it turned out to not be real antialiasing. Found the code's home (https://icculus.org/~aspirin/gimp/auntiealias/) on the web later today too.

Anyway adapted that for Som. It definitely helps, but a real antialiasing algorithm would be a lot better. The pseudo-aa code GIMP uses only operates over 3x3 pixels and isn't really aa at all. I'm not sure it would make sense to expand it to like 5x5 pixels, but doing that would help if so. I will probably email the author and ask / see if they know of any better aa code lying around (though usually at least 3 out of 5 emails poached off the web are no longer of any good)

Ultimately I don't think the colorkey AA will be integrated directly into the mix. I'm thinking it's best to dirty mipmap the textures as they are so they can be quickly swapped out for higher quality versions to be generated / cached on the fly. I'm also thinking if a 1 pixel border was filled in over the bordering black pixels (combined with the black to alpha conversion / antialiasing) then there is a good chance even DirectX7 could be adapted to use the much improved colorkey (for some reason DX7's colorkey seems worse than just knocking out the black texels) techniques... except when blending is involved the edge would have to be fuzzy.
Reply

#10
So I begun looking into that map piece with holes...

I could not seem to do anything to make it go away. The "SomInstaller.zip" archive I had did not seem to help.

So I built a runtime for project with the problem. And the holes were still there...

Then I copied the map/texture folder from DD into the runtime folders, and that fixed it for the runtime.

I made backups of everything except one thing, and can't seem to get the holes to come back.

What I did not backup is I noticed there was a map/texture folder that was not empty in the project folder. So I looked in other projects to see if there was anything in that folder in other projects and there wasn't. So I just deleted the stuff in that folder to save space more or less.

I did not think until after I was done with all the testing that deleting the files in that folder could've been the remedy.

I can't really get the files back other than restoring them from the "Recycling Bin" to be sure. But I'm pretty sure the problem texture was actually in that folder.

I'm not sure how that folder came to have files in it. But assuming that's the case, it would seem to mean that you can override the files in your Som install data folder, by sticking a file with the same path/name in your project data folder.

My guess is the texture files I had in there were from the (unpatched) Som disc image, and they were overriding the files in the install folder.


Anyway the good news seems to be there is no problem using colorkey with map tiles as far as I can tell. Just need to use Ex if you want to preview the textures correctly via the debug executable.

Also, we learned it seems to be possible to override the files per project as described above (though not 100% confirmed)
Reply





Users browsing this thread:
2 Guest(s)