Avatar pixelation

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Post Reply
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Avatar pixelation

Post by warhell »

Hi, I'm creating an avatar from bitmapdata and inputting it into openspace. Everything works out great, except that when the user zooms in or out from the default zoom, the avatar gets destorted/pixelated. Is there an easy workaround for this? Because of the way our app is structured we have to use bitmaps for performance reasons.
SmartFoxServer and OpenSpace developer
www.edgarmiranda.net
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Of course if you use bitmap avatars, when zooming they will pixellate. I don't think there's a workaround to this. It is the way Flash works.
Paolo Bax
The SmartFoxServer Team
laxersaz
Posts: 50
Joined: 30 Nov 2009, 16:19
Contact:

Post by laxersaz »

Enable smoothing in the properties of the avatar images in flash.
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Post by warhell »

How does resizing work when you load a bitmap into OpenSpace? By what factor is the bitmap resized?
SmartFoxServer and OpenSpace developer
www.edgarmiranda.net
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

When you use the OpenSpace.zoomView method, you choose the resizing factor. This is applied to the whole map container, which is scaled (using DisplayObjects scaleX and scaleY properties) accordingly.
Bitmaps on the map follow the scaling of their container.
Paolo Bax
The SmartFoxServer Team
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Post by warhell »

Is there anyway to not apply scaling to the avatar? We would like to just change the avatar to a different bitmap (which is scaled before runtime). We are trying to avoid scaling the avatar (since it's a bitmap) so we avoid pixelation all together.
SmartFoxServer and OpenSpace developer
www.edgarmiranda.net
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

warhell wrote:Is there anyway to not apply scaling to the avatar? We would like to just change the avatar to a different bitmap (which is scaled before runtime). We are trying to avoid scaling the avatar (since it's a bitmap) so we avoid pixelation all together.
No, this is not possible. Avatars are nested sprites inside the map container, which is being scaled.
Paolo Bax
The SmartFoxServer Team
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Post by warhell »

Is the scaling applied via setting the scale properties or multiplying the existing scale properties?

e.g.

obj.scaleX = newScale;
obj.scaleY = newScale;

or

obj.scaleX *= newScale;
obj.scaleY *= newScale;

I'm assuming it's applied the first way, I'm asking because if it's done the second way I can modify the scaling factor in the constructor, such that the scaleX and scaleY properties are 1.
SmartFoxServer and OpenSpace developer
www.edgarmiranda.net
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

The scaling is applied in the first way. Also, the scaling is not applied to each movieclip (tiles, avatars, etc) independently, but to the overall container.
Paolo Bax
The SmartFoxServer Team
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Post by warhell »

bax wrote:The scaling is applied in the first way. Also, the scaling is not applied to each movieclip (tiles, avatars, etc) independently, but to the overall container.
Ahh, so I guess a nice hack would be to stick my avatar bitmap inside a movieclip, and scale that movieclip by a factor such that when openspace scales (when zooming) the scaling of the bitmap is 1?
SmartFoxServer and OpenSpace developer
www.edgarmiranda.net
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Not sure I've understood... anyway yo can give it a try.
Paolo Bax
The SmartFoxServer Team
warhell
Posts: 199
Joined: 18 Aug 2007, 16:49
Location: Silicon Valley, CA
Contact:

Post by warhell »

For example, say that I set the zoom value of openspace to be .5. This means that every object's xscale and yscale property (that is located inside openspace) will be changed to .5. So, if I stick my bitmap in a movieclip who's xscale and yscale is 2, once openspace resizes everything, the original bitmaps scale will be the equivalent of 1.
SmartFoxServer and OpenSpace developer
www.edgarmiranda.net
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Yes, but when zooming we don't set the xScale/yScale properties on all the movieclips, but only on the main container.
Paolo Bax
The SmartFoxServer Team
Post Reply