J. K. Sleepling

Changing image resolution for mipmapping

Recommended Posts

Hi there,

I'm working on an app showing user uploaded maps (bitmaps). These maps can be of any resolution and often they are very large. Now down-scaling these images they become ugly and crunched, so I need to use mipmapping (Working in WebGL).

I know mipmapping only works with "powered by two" resolutions, but is there any way I can resample my odd-sized maps, to fit into a "pb2" resolutioned baseTexture, and still know the original specs. Or how would you work around it?




Share this post

Link to post
Share on other sites

First idea - put it on pow2 canvas and use "Texture.fromCanvas", then create texture regions (new PIXI.Texture(myBaseTexture, myFrame)) out of it.

Second - do it automatically, when you upload the texture. That's not easy way, it requires understanding of TextureManager hacks.

The part that corresponds to your mipmapping issue is the same: texture uploader. Its possible. Its not available at high-level API yet. It exists in a plugin that makes atlases out of things.

However, maybe you just have to use this plugin: https://github.com/gameofbombs/pixi-super-atlas/ . I'm sorry, there are no examples except https://github.com/gameofbombs/pixi-super-atlas/blob/master/test/checkpack.ts . It also has "addTexture" method , but you have to look at sources anyway, dont assume that its magic that works for everyone, its a bleeding edge plugin.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.