Advertisement

how to remove moire?

Started by June 26, 2019 05:52 AM
5 comments, last by vinterberg 5 years, 7 months ago

I create 3D texture and display it.

When I zoom in it, a moire appeared.

how to remove this moire?

 

1111.thumb.png.d873bac2bc367b0eaa39cbb259988bad.png 

2222.png

 

 

this is my code.

    // init the 3D texture 
    glEnable(GL_TEXTURE_3D_EXT); 
    glGenTextures(1, &_tex_glid); 
    glBindTexture(GL_TEXTURE_3D_EXT, _tex_glid);

    // texture environment setup 
    glTexParameteri( GL_TEXTURE_3D_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); 
    glTexParameteri( GL_TEXTURE_3D_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); 
    glTexParameteri( GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE ); 
    glTexParameteri( GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); 
    glTexParameteri( GL_TEXTURE_3D_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );


    // load the texture image
    ::glTexImage3DEXT(GL_TEXTURE_3D,    // target
        0,                                // level
        GL_RGBA,                        // internal format
        (int)tex_ni(),                    // width
        (int)tex_nj(),                    // height
        (int)tex_nk(),                    // depth
        0,                                // border
        GL_COLOR_INDEX,                    // format
        GL_BYTE,                        // type
        _texture);                        // buffer

    ::glPixelTransferi(GL_MAP_COLOR, GL_FALSE);

Since no one's replied yet I'll ask some questions:

- Can you post the source image? I realize it's 3-d, but maybe you could post a representative 2-d sample or something.

- When you say 'zoom in it', do you mean zoom in? In other words, does the effect appear or become more noticeable when you zoom in, or when you zoom out?

- On a possibly related note, what are the two images intended to show? (It may be obvious just from looking, but clarification probably couldn't hurt.)

- Have you tried it with mipmaps?

Advertisement

I tried to avoid this topic, but well...

It seems guy has no shaders involved here so theres aint much help from me,

I really cant remember any of filtering functions that would help, with shader usage one would try make few leas detailed 3d textures, and sample them by distance, all to be handmade....

Thanks for your reply. And I'm sorry to my english is bad.

- It is hard to post source image. It's data file has data header and 3-d raw data. Sample data has 512*512*1000 of 8-bit data.

- Yes, it is become more noticeable when i zoom in. And moire is easily appear in curved object. (sample object is converging lenses) 

- I want show more noticeable when you zoom in display. You can see circular moire in below image.

- I tried mipmaps, but failed to improve it.

 

If you would render the image with points, i would say add a random offset to get rid of moire.

But it's not clear how the rendring is done. Result looks like scanlines on a CRT monitor.

So you need to provide more info / shader code.

Advertisement

What is the resolution of the texture? Have you tried downscaling it?

.:vinterberg:.

This topic is closed to new replies.

Advertisement