• Content Count

  • Joined

  • Last visited

Everything posted by alextewpin

  1. To summarise: Issue has nothing to do with resolution, it's roundPixels settings which is not working for meshes in v4: Similar code in v5 works fine:
  2. I've investigated a bit further, tried different setups and resolutions. Issue is reproduced even when resolution is 1. Reproduced with basic Mesh too. CSS seems fine and screen is less than 4096. Both Sprite and Mesh use correct step when animating (one logical pixel), so none of them are actually missing grid, but they are kinda out of sync. It's interesting that Graphics (green bar) moves in sync with sprite, even when hierarchy is AnimatedSpriteContainer -> Mesh -> Graphics. It's like Mesh positioned properly as container, but rendering is off for some reason. Will try to research more.
  3. There are two sequential frames from animation, where dragon sprite and attached piece of UI moves from up to down. Left one is normal and right one is bit broken. Sprite itself (PIXI.extras.AnimatedSprite) and number 8 (PIXI.extras.BitmapText) looks perfectly fine through all animation, but HP bar background (PIXI.mesh.NineSlicePlane), HP bar itself (PIXI.Graphics) and number background are not hitting pixels perfectly sometimes and animation looks jaggy. PIXI.settings.SCALE_MODE is PIXI.SCALE_MODES.NEAREST. PIXI.settings.MIPMAP_TEXTURES is false. roundPixels is true. As I said, I have retina screen, so resolution is 2. I'm not sure if issue is reproduced on regular screen. I've searched through the docs but couldn't find any special settings for PIXI.mesh. I can make same UI from basic sprites of course, but NineSlicePlane is so much more convenient.
  4. @xerver thank you, I've already figured it out. However, your example is still really useful, and I will defiantly use parts of it in my code.
  5. @ivan.popelyshev got it! Owe you a beer.
  6. Ivan, thank you so much for your help! I've made a demo illustrating the issue: I think I'm missing the point here. What is purpose of filters in PIXI anyway? Isn't it a go-to way to apply shaders to sprites, like materials in other engines? “Renderer plugin” sounds a bit scary, but I'm ready to do whatever it takes.
  7. @ivan.popelyshev thank you, but all suggested solutions didn't worked. Mipmaps didn't affected anything, proper scaleMode is already set. Not sure what are you trying to achieve here. There should be no point in flipping Y axis, because palette is 1px tall. I'm pretty sure wrong coord is the problem, because if I changing Y coord colors are changed too, which shouldn't be the case with 4x1 texture. I'll provide online demo tomorrow.
  8. My goal is to make palette-applying filter. I have grayscale sprite where colors are set on equal distances (eg. 0, 0.33, 0.66, 1) and palette as 4x1 pixel texture. Idea is taking red channel from sprite and using it as x coord on palette texture. I've made this with Unity some time before no problem. All of my sprites and palettes are placed on spritesheets. Problem is I can't get proper coords in shader. If I use default shader, everything works fine, sprites renders as is. gl_FragColor = texture2D(uTexture, vTextureCoord); Now with my shader: uniform sampler2D uTexture; uniform sampler2D uPalette; varying vec2 vTextureCoord; void main() { vec4 color = texture2D(uTexture, vTextureCoord); gl_FragColor = texture2D(uPalette, vec2(color.r, 0.5)); } It's kinda works, but colors are mangled. I believe the reason it wrong texture coords. I've already read everything I could find here and on Github, but still can't figure it out. Extra question 1 How Pixi determines main uniform texture name? It look like I can give it any name and it's just works. Extra question 2 Why gl_FragColor = texture2D(uTexture, vTextureCoord); works just fine, but if I pass exact same texture in uniform param it renders the whole spritesheet in a weird way?