New Textures and Site Updates

No More Stretching

Brick Texture ComparisonSince early in this game's development, I've had an issue with textures stretching on the bricks. The problem was, a small brick and a large brick would have the exact amount of texture image mapped on them. On larger bricks, the effect looked rather ugly, you could see the stretched out pixels over the surface of each block. The problem was especially bad for the sides faces of each brick.

Following some advice from my friend Itay, I explored several options that would allow me to reduce or remove stretching. I spent all Saturday researching and testing this before I came up with a solution.

Basically, rather than have an atlas of side faces and texture types, I created one 2048 x 2048 grey rock texture image that is seamless at the edges (so that it can tile). Each brick face draws from a portion of this image proportional to its size, that is, an 8 x 8 meter brick will take up the whole image, while a 1 x 1 meter brick will only draw a small corner of the image. Overlayed over this is the fake shading that goes around the border of each brick that lets us distinguish one brick from another. Finally, there is another overlay of a "detail" map that makes the texture look good when the player presses the camera directly against a brick (something that happens often in this game).

New Brick TexturesAs you can see from the image above, the result is that we have more even lighting over the brick surfaces, the larger bricks no longer look pixelated and stretched-out, and we have maintained the shadowing at the edge of each brick.

In the second image we get more of a side view. The side faces of each brick were especially noticeable for their stretching, as the narrower bricks would contain an equal amount of texture data  as the large ones, the whole texture looked flattened in along one dimension. Load the alpha demo for a better understanding of how this looked before. Ugly, huh?

The new textures still need more work. The shading should be a different texture for the side bricks, and I need to somehow implement texture variation for the different brick types. The way you map a texture onto a mesh is via UV coordinates. Unfortunately, the Unity engine only supports two UV sets per mesh, when I need three. There is no easy way around this. I may include the variations with the edge shadows and put them into an atlas.

Anyway, it works, it looks good, and it's fast. Will be concentrating more on content generation in the coming days.

New Site Theme

Following the suggestions sent to me by a fan Philippe, I retooled the a website a bit. The site is now responsive, meaning it will auto-adjust its appearance to fit on mobile devices and such. Also, the news section of the site has been moved onto its own page, I've replaced the editor for comments, and I've added a sidebar to most pages. Fun stuff, I know. Will be adding a press kit to the deal in a little while.

Threading Progress

Yesterday I solved a major issue related to threading. It boils down to this: when loading data for the "chunks" that the wall is made out of, the program would occasionally load two files at the exact same moment. This was causing severe conflicts, but I had no indication as to the source of these problems. I spent a day just tracking down and stamping out this particular bug, which of course amounted to a couple lines of code. (if you want to know, I put a Lock() on the loading function and made sure that all the related fields were thread-safe).

The bug manifested as chunks generating bricks that overlapped each other, or chunks with large holes in them, or chunks that would not load at all. When the beta goes up, I'll need everyone's help in finding bugs similar to this one.

That's it for now!

Posted in Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *