terminal-recall
terminal-recall copied to clipboard
Textures are not filtered across edges
I notice with the current setup, textures are not filtered/blended between their edges, so a very noticeable "seam" effect occurs. Is there a potential workaround for this in the future?
Not in the near future; it's a design quirk in the original game, particularly when they mixed high and low res textures together on the same map. You probably also noticed the sharp transition of a blurry ground texture meeting up with a hi-res ground texture. It's definitely not impossible to fix but I don't know how to do it at this time. Likely someone would have to create replacements or a very clever algorithm to generate new textures by guessing what's trying to be portrayed. That borders on PhD-level bayesian AI pattern recognition stuff...
I'm more talking about areas that consistently have the exact same texture across one another. Ie. same image/raw file. (Rather than different and/or high and low-res textures. Those are naturally going to have seams, obviously.)
I've personally seen this achieved in several terrain-based engines, and games that allow terrain, and/or displacements.
Looking at TV\DESERT.LVL I think I see what you mean. The tiles almost line up but not quite. (not to be confused with the seams which recently formed between all triangles due to a rendering bug) This might be tied to a U/V padding issue in the texture atlas. I am going to leave this be until the new texturing system is in place and if it persists then I'll look into what is causing it.
It is looking more and more like a U/V issue on the atlas causing the textures to not line up. I took a look at the generated atlas and everything looks fine, including the up-front text font, yet the rendering of said font has the top chopped off, which is also pointing to this.
If I correct the alignment bug the repeating textures will depend on how well the textures were made. I can't reasonably smooth between them since they are cell-based and not splatted.
A possible solution might be to make the tiles slightly oversized such that they overlap and then smooth the alpha channel on the edges. This may give the desired effect.
It would precipitate extra overdraw, yes. It wouldn't affect the texture storage as the textures wouldn't change, rather the U/V coordinates in the atlas would change.
But yes, an adverse side effect would be a 5x increase in terrain vertices and there would be processing overhead for blending. Currently, the initial rendering pass has blending off for a performance improvement.
I can see two ways to blend the textures: alpha blend one primitive over the other, which, assuming the blending is additive, is commutative (doesn't matter which order). This causes the 5x increase in vertex count. An alternative would be to perform the blending in the shader and pass two sets of UV coordinates for each vertex, pass per-vertex the mix between the U/Vs, have the shader fetch texels for each U/V set, and use the mix to mix the color results of the two fetches.
Non negligible overhead, particularly considering I've been fighting fill-rate issues at high resolutions on low-end hardware lately.
A side-note: The seaming issue with the sky texture is my fault and not TRI.