weird lines show in texture when camera move

Started by peter, March 30, 2016, 09:53:10 PM

Previous topic - Next topic

peter

weird lines show in texture when camera zoom out. went away when zoom in. any idea why this happened?
the 3d objects are load from .obj and .mtl file

EgonOlsen

Looks strange. It might be z-fighting issue, but it's hard to tell from just a screen shot. Which device are you using?

peter

I am using Samsung Galaxy note 4, android version 5.1.1

peter

if camera is close enough, those lines go away

EgonOlsen

What's your render calls looks like (the clear/renderScene/draw sequence)?
You might want to try the NVDepthConfigChooser in the util package to make sure that it's not a depth buffer related issue. You have to use OpenGL ES 2.0 for this to work if you aren't doing this already.
If that doesn't help, can you provide with me a simple test case that shows the problem?

peter

#5
my render calls are almost the same with hello world example
onSurfaceChanged(GL10 gl, int width, int height)
        fb = new FrameBuffer(width, height);
        world = new World();
        world.setAmbientLight(85,85,85);
        world.setClippingPlanes(10,1000);
        world.setObjectsVisibility(true);
        create Lights
        world.addObjects(objects);//objects loads from obj and mtl
        world.getCamera().setPosition(0,0, 800);
        MemoryHelper.compact();

onDrawFrame(GL10 gl)
        fb.clear(background);
        world.renderScene(fb);
        world.draw(fb);
        fb.display();

I will try NVDepthConfigChooser see if that helps.
thank you!!!

peter

NVDepthConfigChooser actually fix the problem!!!
thank you very much!!!
so that is a depth buffer related issue?

EgonOlsen

Yes, somehow. Is there anything behind these textured parts? Like an all white solid body or something similar?

peter

the whole thing is load from obj and mtl, according to what is showing in the screen I guess it happened when there are two objects overlapped.

EgonOlsen

Most likely. If that can happen in this case, then it's no wonder that there are depth buffer issues. The default depth buffer setting on Adreno GPUs is 16bit, this is quite low. That config chooser tries to increase it if possible. It was first created for nVidia GPUs (hence the name), which have a similar issue, but it works for Adreno as well.

peter

is there a way to increase depth buffer? because those weird line shows after zooming out. NVDepthConfigChooser's depth buffer is not large enough.

EgonOlsen

#11
No, that's it. You can't increase depth buffer precision beyond that. You can try to set a new near clipping plane by doing something like:


Config.glIgnoreNearPlane=false;
world.setClippingPlanes(<near > 1, maybe 10>, <far plane>);
world.getCamera().adjustFovToNearPlane();


In theory, this will increase the depth buffer's accuracy, because it spreads on a smaller range. In practice, I've never seen that this helps as much as it would have to to fix such issues. The only real option is to create a model that doesn't suffer from this.

peter

the z-fighting problem could be solve by shrink all vertices by 100 times, so I can move camera distance from 5000 to around 50. don't know why shrink 3D object's vertices effect the z-fighting, I think it has something to do with the camera distance. could this be a bug?

EgonOlsen

No, it's not a bug. It depends on the device's rendering accuracy. Using very large polygons usually isn't a good idea as is using very small ones.