Posted By: Rackscha
Strange texture scaling problem - 08/16/12 19:57
Hi,
Just encountered a new problem, i absolutely dont know why this happens.
SMall flashback:
For my project, i have a texture(1024*1024) which is seperated into 64px sized tiles, making a 16*16 texturegrid.
When i need to retexture a surface, i shift its skinning setup to match the required textures.
i defined a float which holds the Skin size of one tile(since its normalized between 0-1, the value is 1.0/16.0) to set the skin setup accordingly.
However, this resulted in filter problems, as the closest pixel of the nearest tileneighbour was filtered into the required tile. An unacceptable mixup.
SO i go tthis idea:
i load my texture and move the tiles into a new, slightly bigger texture. This creates a 1px sized border around each tile, which allows me to do 1pixel tiling. So filtering will use a correct pixel of the same texture.
Examples:
each tile has a size of 64pixel and is centered in a 66px sized tile on the new texture(new texture is 1056*1056)
this allows me to fill the gaps with a row/line of 1 pixel width, which is taken from the oposite of the tile(so its 1 pixel tiling).
as i didnt change anything else in my sourcecode, i expected tiny blackborders on each blocksurface. I had my 1/16 factor in mind and that its procedual and not fixed due to the normalisation.
But instead i got this:
as if i scaled down by 0.25, 4 tiles fit one surface. The factor doesnt fit anymore.
The texture is applied to a material skin. The material uses its skin1 and the UV setup of the entity to paint the texture.
Why does this happen? because 1056 is an odd number? How do i handle this?
Greetings
Rackscha
Just encountered a new problem, i absolutely dont know why this happens.
SMall flashback:
For my project, i have a texture(1024*1024) which is seperated into 64px sized tiles, making a 16*16 texturegrid.
When i need to retexture a surface, i shift its skinning setup to match the required textures.
i defined a float which holds the Skin size of one tile(since its normalized between 0-1, the value is 1.0/16.0) to set the skin setup accordingly.
However, this resulted in filter problems, as the closest pixel of the nearest tileneighbour was filtered into the required tile. An unacceptable mixup.
SO i go tthis idea:
i load my texture and move the tiles into a new, slightly bigger texture. This creates a 1px sized border around each tile, which allows me to do 1pixel tiling. So filtering will use a correct pixel of the same texture.
Examples:
each tile has a size of 64pixel and is centered in a 66px sized tile on the new texture(new texture is 1056*1056)
this allows me to fill the gaps with a row/line of 1 pixel width, which is taken from the oposite of the tile(so its 1 pixel tiling).
as i didnt change anything else in my sourcecode, i expected tiny blackborders on each blocksurface. I had my 1/16 factor in mind and that its procedual and not fixed due to the normalisation.
But instead i got this:
as if i scaled down by 0.25, 4 tiles fit one surface. The factor doesnt fit anymore.
The texture is applied to a material skin. The material uses its skin1 and the UV setup of the entity to paint the texture.
Why does this happen? because 1056 is an odd number? How do i handle this?
Greetings
Rackscha