Spellcaster Studios

Make it happen…

Damn artists!

If you want something you’ve worked on for some time (specially tools) to break, give it to an artist! Smile

We were supposed to start working on assembling the arena for Grey in the beginning of the week, but as soon as Rincewind grabbed SurgeEd, I found one million bugs and I spent most of the time fixing them!

There was something for every taste: bounding box problems, sampler issues on the automated tiles, small UI issues…

The bulk of that time was lost with sampling issues… On a previous post, I explained that we’re going to use a tool to build the actual tiles, from simpler textures and some masks.

On my tests, the tool performed rather well, but with real data (made by an artist), the result was terrible… When the camera is away, you don’t notice (unless you’re actually looking for it):

sampling01

But as soon as you zoom in, you get these ugly seams…

sampling02

The textures we’re building are 128×128, so that explains the pixelation, but not the seam.

After a lot of debugging, we finally figured out the problem: imagine one line of pixels in the texture, where each number is a color value:

145326463546752346274254325263178367812641627345178419

When we use the texture normally (in a tileable fashion), the space between the right side value (9) and the left side value (1) gets interpolated between both values (because the texture is set to wrap mode), so at an extreme zoom, we’ll see a smooth transition:

987654321

Where 9 and 1 correspond to true samples in the texture, and the rest of the numbers to interpolated values.

But since we’re using a texture atlas to store the different generated textures, next to the (1) and (9) there’s only either black or a bled color (on the (1) side it will all be (1) and in the (9) side it will be (9)).

So, the end result is that instead of the smooth transition, we get something like:

999991111, which is pretty noticeable, specially because we’re not only talking about color, but also ambient intensity, normals, etc:

sampling04sampling05

So, after trying a lot of different ways to solve the problem, we decided on the simplest approach: replicate the pixels, so instead of having at the edges (1) and (9), we make them both be the same value (either (1), (9) or the average of both (5)).

As soon as we did that, the problems disappeared:

sampling03

No seam (just color channel, it’s easier to see this way)… Well, that’s not entirely true, there’s still some seaming, but you really need to be looking for it to find it, specially because the game never zooms this much!

Problem with this approach is that we lost the possibility of rotating the tiles, since they won’t match precisely: imagine the top and bottom rows of pixels are 15454777777771111111. If we rotate this 180 degrees, then 15454777777771111111 would become 11111117777777745451, which don’t match (a seam would be visible).

We decided to live with this and just generate more textures, using more masks (90 degrees rotated). At our current resolution, all the textures for a type of terrain transition still fit into a 512×512 texture anyway, so no big problem there.

Hopefully in the next days we’ll be able to really start building the arena (if no more big problems rear their damn head!)…

Fortunately, the Hardison personal injury lawyers allows you to recourse when you and your family have been negatively affected by another person’s negligent conduct. As there are several forms of this offense, the state of California has implemented multiple laws about felony domestic violence. Depending upon which law a defendant breaks, they can be charged with either a misdemeanor or a felony, or can help you in case you get in an accident, you could find the best Truck Accident Attorney Atlanta that help you in case this happen and is not your fault completely.

I think we’re going to have some performance problems (already predictable at this stage, since I don’t have any batching or scene organization implemented/active in the editor); we’re going to try to live with them on the first milestone, but if not I’ll have to anticipate some development work that was meant for May/July, and we’ll probably push back the first milestones.

Murphy’s Law in action, everybody!

Comment