1
\$\begingroup\$

I have 2D array of floats. Using the floats, I generate image by doing proportional selection of color from between COLOR_MIN, COLOR_MAX – for maximal float value at given (x,y), I choose COLOR_MAX and put pixel at (x,y), for minimum float value – I choose COLOR_MIN.

Resulting 128x128 image (created from 128x128 float array) is then used as texture, which is then scaled to about 500x500 size. Image displayed this way has "dot-noise", like if the image would be printed from needle printer (example image/screenshot attached below).

How to avoid the noise? I could scale the image myself to 512x512, but I probably need some filtering? Or will be setting some OpenGL (ES) options for the texture sufficient?

Distorted image

PS.: The image is result of GL_LINEAR magnifying filter. Using GL_NEAREST results in large pixels being clearly visible (green below). So apparently, I need programmatic filter to run on CPU.

enter image description here

\$\endgroup\$
5
  • \$\begingroup\$ Well it appears the colors values themselves are wobbling, or oscillating. If that's the case then this is the expected result. Can you post the GL_NEAREST results so we can look at it? \$\endgroup\$
    – bobobobo
    Commented Jul 23, 2012 at 2:06
  • \$\begingroup\$ @bobobobo: I have added the GL_NEAREST image. \$\endgroup\$
    – GameCoder
    Commented Jul 23, 2012 at 2:51
  • \$\begingroup\$ How come your uploaded images are neither 128x128 nor 512x512? You should post the original sized images, otherwise it's really hard to judge. \$\endgroup\$
    – bummzack
    Commented Jul 23, 2012 at 7:36
  • 3
    \$\begingroup\$ So yeah. The issue is the underlying data is bumpy. You need to first smooth the data before generating the texture, just by averaging or low pass filtering. \$\endgroup\$
    – bobobobo
    Commented Jul 23, 2012 at 16:27
  • \$\begingroup\$ @bo Should be an answer. \$\endgroup\$
    – Anko
    Commented Mar 12, 2013 at 22:43

0

You must log in to answer this question.

Browse other questions tagged .