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\$
  • \$\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 Jul 23 '12 at 2:06
  • \$\begingroup\$ @bobobobo: I have added the GL_NEAREST image. \$\endgroup\$ – GameCoder Jul 23 '12 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 Jul 23 '12 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 Jul 23 '12 at 16:27
  • \$\begingroup\$ @bo Should be an answer. \$\endgroup\$ – Anko Mar 12 '13 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.