0 Members and 4 Guests are viewing this topic.
I tried to fix the depth issues and had to use floats (or int_fast64_t which is equally slow to divide somehow) which is slower (depends on vertex count)Which version is better? Or should I keep both?
You are using fixed-points, right? Well, then you can kinda cheat a bit by setting the coordinates to e.g. 0.1 and 15.9 instead of 0 and 16. It's just as fast as the previous code, but after experimenting a bit with the values, you can get rid of the lines witouth visuall distorting the texture.
Since these textures are repeated, it would actually make more sense to wrap the texture coordinates. It would have to be tested per-pixel, however it should be fairly fast (as long as textures are a power of two size), just a bitwise AND on each coordinate value. For a minecraft engine, this would also open up the ability to simplify meshes in large, flat areas of the same block.
I'd say go for the fastest. It' only disturbing when blocks are really far.
I'd say that you should include both mode (with and without textures) in the final version so that we can make beautiful screenshots with textures and build quickly too (not that it is slow with textures, but it is faster without so if we want to make quick changes, we might want a quick way).
QuoteSince these textures are repeated, it would actually make more sense to wrap the texture coordinates. It would have to be tested per-pixel, however it should be fairly fast (as long as textures are a power of two size), just a bitwise AND on each coordinate value. For a minecraft engine, this would also open up the ability to simplify meshes in large, flat areas of the same block.The problem here is that I'm using a texture atlas.As I preprocess every Chunk and basically just have to iterate over a array of vertices, I'd have to determine which texture to bind for every triangle.That'd be horribly slow.The problem is rather a rounding issue, as with fixed-point x / y = z can be true, but z * y = x doesn't have to be.Or maybe I'm just completely wrong. Who knows. I'll have to fix those bugs anyway...
It avoids all the problems of texture atlases
You bind to one texture, and then because the format and size of the different textures in the array are the same, you only need to select the appropriate location for the texture data, which can be done by storing an integer ID with every triangle.
All the pixels from one texture will be together, increasing cache coherency as well.