Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About hellgasm

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello, I have a question about premultiplied alpha images, texture atlas and texture filter (minification with bilinear filter). (I use correct blending function for PMA and all my images are in premultiplied alpha format.) Suppose that there are 3 different versions of a plain square image: 1. In a separate file, by itself. No padding (padding means alpha 0 pixels in my case). 2. In an atlas in which the subtexture's top left corner(0, 0) is positioned on top left corner(0, 0) of atlas. There are padding on right and bottom but not on left and top. 3. In an atlas, in which there are padding in each of the 4 directions of the subtexture. Do these 3 give the same result when texture is minified using Bilinear filter? If not I assume this means premultiplied alpha distorts images since alpha 0 pixels are included in interpolation. If so why do we use something that distorts our images? And even if we don't use premultiplied alpha and use "normal" blending, alpha 0 pixels are still used in interpolation. We add bleeding to overcome problems caused by this (don't know if it causes exact true pixel rendering though). So the question is: Does every texture atlas cause distortion in contained images even if we use bilinear (without mipmaps)? If so why does everyone use atlas if it's something that's so bad? I tried to test this with a simple scenario but don't know if my test method is right. I made a yellow square image with red border. The entire square (border included) is 116x116 px. The entire image is 128x128. I made two versions of this image. Both images are in premultiplied alpha format. 1st version: square starts at 0, 0 and there are 12 pixels padding on bottom and right. 2nd version: square is centered both horizontally and vertically so there are 6px padding on top, left, bottom and right. I scaled them to 32x32 (scaled entire image without removing padding) using Bilinear filter. And when rendered, they both give very very different results. One is exact while the other one is blurry. I need to know if this is caused by the problem I mentioned in the question. Here are the images I used in this test: Image (topleft): Image (mid): Render result: I try to use x, y and width, height values for sprite which match integers so subpixel rendering is not intended.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!