overviewer/Minecraft-Overviewer — Issue #516: Discussion: textures.py
Author: Fenixin
Created: 2011-10-19 06:43:44+00:00
State: open
Labels: Discussions

The file textures.py is a mess, and is getting messier every new block added, it needs a clean-up. I'm usually the maintainer of textures.py and I'll be glad to code new stuff, but first I'd like to ask/discuss some things, so it's made in the best way possible. Here are some stuff I have in my head about this (ideas, worries and other stuff):

**1.** The generate_texture_tuple function still splits the alpha channel of the texture. I *think* this was needed to use PIL paste function, because we don't use it we don't need it, and it can be simplified in textures.py and in iterate.c.

Another thing about the texture tuple is that we have a lighting mask that seems a bit stupid. Why is this needed? I'll try to explain...

If overviewer is shading a, for example, fence block it doesn't want to shade the block below it, so it needs to know which pixels are shaded and which not. The alpha channel! Yes, but if you use as a mask you will have two alpha channels for the compositing, the one of the block texture and the one used by the black color, and when in a border of the fence and the alpha channel of the texture has got a value less than 255 the shading here is significantly less than in a full alpha pixel. The effect is a glowing aura around the fence. This is a problem with "soft borders" in textures, and this started to be a problem when we changed the filter from NEAREST to ANTIALIAS.

If there is a good way to fix this without a lighting mask I don't konw it. Any suggestions?

**2.** In the start blockmap was big and specialblockmap small, at the moment they are both pretty big. Why not move everything to one list or to one dictionary? This would simplify the generation process and the chunk_render in iterate.c. As an idea we can store all the textures in a dictionary with tuple keys (blockID, ancildata). In iterate.c the process to choose a texture can be:

blockid = getArrayByte3D...
ancildata = getArrayByte3D...
if pseudo_data {
ancildata = generate_pseudo_data(blockid, ancildata)
}
t = PyDict_GetItem...

Which would be faster? list or dictionary?

**3.** generate_special_texture is a big mess of "if block == ??", agrif and eminence said they have a good solution for this... but I don't remember what it was...

**4.** There are to many functions to render a block. generate_block, generate_full_block, and insie of them there are a blockid special cases. Would be better to have a generate_block, and geerate_sprite (or whatever).

**5.** Blocks textures overlap a little bit, and this is why the water has small squares on it, would be cool to have truly tiselable textures. Any ideas how to achieve this?

**6.** Move the sets of transparent_blocks, solid_blocks, etc... in chunk.py to textures.py, I think this will help to mantain the block info together. Maybe the list can be generated when the textures are created, so every small function that generate the texture also adds the block number to the proper set.

Please, feel free to add anything or give your opinion in any of the points.