Pixi.js: Image - Mipmapping, Quality

Created on 12 Apr 2018  路  12Comments  路  Source: pixijs/pixi.js

Hello Pixi,
please would someone explain me: how Fabric JS did it.. Fabric always has good quality of image (when i am resizing image) unlike pixi which still losing quality? i was trying turn on mipmapping in order to get best quality.
So i tried changed the scale mode to LINEAR (small images look smudgy) and then to NEAREST (some sizes were okay but most of them looks really bad).
I want to let people manually resize image but dont want to offer them ugly pictures.

I tried your another similiar issues (http://www.html5gamedevs.com/topic/24558-down-scaling-quality-loss/?_fromLogin=1) but any help me.

Thank you all

Expected Behavior

Original:
screen shot 2018-04-12 at 16 37 42

Fabric:
screen shot 2018-04-12 at 16 38 11

Current Behavior

Pixi js -> mipmapping linear
screen shot 2018-04-12 at 16 37 16

Pixi js -> mipmapping nearest
screen shot 2018-04-12 at 16 57 40

Steps to Reproduce

  • Take big image scale him down.

Environment

  • pixi.js version: _e.g. 4.7.1_
  • Browser: _e.g. Chrome 67_ (mac)
  • Device: _e.g. Desktop_

Most helpful comment

FYI check it now.

screen

All 12 comments

i was trying turn on mipmapping in order to get best quality.

For WebGL1, mipmapping works only for textures that have power-of-two size (256x512 or so)

Yes sorry, i forget, texture is 2048x2048 in example. ( so it is power-of-two ). And mipmapping is definitely turned on otherwise it's look more pixelated.

Original:
image

Can you make a fiddle of it, please? :)

Yes, thank you for help.
Pixi JS: https://jsfiddle.net/de2o3c5s/22/ ( ver 4.7.1 )
Fabric JS: https://jsfiddle.net/bokos/954hwedm/4/ (ver 1.7.7 )

https://jsfiddle.net/de2o3c5s/27/

Changes:

  1. sprite doesnt have mipmap, baseTexture has it
  2. we have to set it to false to get same picture as fabric :) or make texture non-pow-2

Just a note: There's no antialiasing parameter, the name is antialias in both pixi and webgl, in your case it doesnt matter

Thanks but if you can notice there is still big difference on my pc (retina).
Fabric ( https://jsfiddle.net/bokos/954hwedm/4/ ):
screen shot 2018-04-12 at 18 31 27
Pixi ( https://jsfiddle.net/de2o3c5s/27/ ):
screen shot 2018-04-12 at 18 31 39

So it doesnt solve a problem :/.
-- i tried it on another pc with lower resolution and there images look same.

Nearest: https://jsfiddle.net/de2o3c5s/32/

Both fiddles show upper picture for me. Any ideas?

image

If you want to make better quality for resize for particular purpose, you have to use sequence of rendertextures with filters applied, and i dont know which filters are suited for it.

@Bokos-
You have to set resolution manually by your displays pixel ratio for pixi.js.
I updated your example https://jsfiddle.net/de2o3c5s/40/

Good Job! Thanks.

FYI check it now.

screen

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SebastienFPRousseau picture SebastienFPRousseau  路  3Comments

gigamesh picture gigamesh  路  3Comments

MRVDH picture MRVDH  路  3Comments

lucap86 picture lucap86  路  3Comments

YuryKuvetski picture YuryKuvetski  路  3Comments