I used the "artist hack" using the GIMP and it worked. Thank you, Brian!

On Sat, Aug 20, 2011 at 2:17 PM, Brian Fisher <[email protected]> wrote:

> Oh, and if you send the original source image for the sprite, it would
> help in confirming the source of the problem and I could give you an
> example of the workaround
>
> On Sat, Aug 20, 2011 at 10:47 AM, Brian Fisher <[email protected]>
> wrote:
> > Having quality drop with rotation is perfectly normal - it's expected
> > it would get a little blurry.
> >
> > Maybe you are referring to the white halo you are getting around the
> > character (which perceptually makes the character appear darker)?
> >
> > I think you're getting that because the "transparent" pixels around
> > the outside of the character are colored white. You should get the
> > same problem if you did sub-pixel positioning or scaling. White halos
> > on transforms is an artifact of bilinear filtering with RGBA as color
> > & opacity and white transparent pixels with a blend mode of:
> >
> >  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
> >
> > Basically it needs to resample pixels in order to rotate, and when it
> > resamples the values at the edge:
> >
> > (YourRGB, 1 alpha)
> > (White, 0 alpha)
> >
> > for a 50% split, the bilinear filter math produces a color value of:
> >
> > ((YourRGB + White)/2, .5 alpha)
> >
> > and then when that is rendered, it renders it as your color averaged
> > with white at 50% opacity, which is why you see a white halo.
> >
> >
> > The artist hack fix for the problem is to bleed out the color channel
> > over the transparent area - so like if the players shirt is red,
> > they'd paint a bunch of red transparent pixels out from the shirt. If
> > you have an editor that lets you edit RGB seperate from alpha, then go
> > into RGB mode with the art for this sprite, and you should see all the
> > surrounding white. If you then paint out the player color around it,
> > and use that image, you should see the halo disappear.
> >
> >
> > The correct programmer fix for this however is to switch to having
> > textures use premultiplied alpha (basically RGB is replaced with
> > RGB*Alpha), and also changing blend mode to:
> >
> > glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
> >
> > that is the correct way to render textures using bilinear filtering,
> > and it's immune to this effect. But your textures and blend mode need
> > to match, and I don't know how to do this with pyglet.
> >
> > On Sat, Aug 20, 2011 at 10:07 AM, [email protected] <[email protected]>
> wrote:
> >> Every time I rotate a sprite by 45 degrees, it looses quality. Click
> here
> >> for a screenshot.
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "pyglet-users" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected].
> >> For more options, visit this group at
> >> http://groups.google.com/group/pyglet-users?hl=en.
> >>
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/pyglet-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to