question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Artifacts in filter using texture as uniform

See original GitHub issue

I’m running into an issue with a simple custom filter that maps the colors in a grayscale image to a 256x1 gradient texture. There are strange artifacts throughout the filtered result. Could it be an issue with sampling pixels in the fragment shader?

Behavior

image

Steps to Reproduce

https://codepen.io/bryan_d/pen/JjbXrQJ

Environment

  • pixi.js 5.3.7
  • Browser: Chrome 88
  • OS: Windows 10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ivanpopelyshevcommented, Mar 5, 2021

By default in v5 and v6 texture is mipmapped if its dimensions are powers of two.

For any color maps you have to use something like new PIXI.BaseTexture(document.querySelector(selector), { mipmap: 0, scaleMode: 0 });

color.r is not actually a good coord. (coord.r * 255.0 + 0.5) / 256.0 is the center of pixel in gradient texture, either use it in formulae either use scaleMode 0 (NEAREST)

mipmap 0 means POW2 , scaleMode 0 means NEAREST in pixi constants.

0reactions
bryan-dcommented, Mar 5, 2021

Confirmed, thanks for taking a look (and for the additional tip).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Artifacts in filter using texture as uniform #7234 - GitHub
I'm running into an issue with a simple custom filter that maps the colors in a grayscale image to a 256x1 gradient texture....
Read more >
Bilinear texture filtering – artifacts, alternatives, and frequency ...
Bilinear filtering is a texture (or more generally, signal) interpolation filter that is separable – it is a linear filter applied on the...
Read more >
Artifacts from linear filtering a floating point texture in the ...
The built-in linear filtering works on both GPUs, but I still need the manual filtering as a fallback for GPUs that don't support...
Read more >
Textures - LearnOpenGL
Try to set the texture filtering method to GL_NEAREST to see the pixels more clearly: solution. Use a uniform variable as the mix...
Read more >
Texture sampling artifacts and floor() - Khronos Forums
Hello, I have a strange texture sampling artifact when using a binary ramp (constructed with the floor() function) to access a texture.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found