Author Topic: Flickering planes  (Read 1876 times)

Offline chupakabra

  • byte
  • *
  • Posts: 7
    • View Profile
Flickering planes
« on: June 10, 2013, 10:30:56 am »
Hello,

I am trying to draw squares on the ground. Currently I am drawing small planes on a big plane.

When I move camera around, litle planes starts flickering. I pasted two images as good and bad example.

How can I resolve this issue? Is this because camera is too far?

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Flickering planes
« Reply #1 on: June 10, 2013, 05:53:02 pm »
That's z-fighting. Your small planes are too close to the larger one for the zbuffer to distinguish. Which renderer is that?

Offline chupakabra

  • byte
  • *
  • Posts: 7
    • View Profile
Re: Flickering planes
« Reply #2 on: June 11, 2013, 08:48:55 am »
Thank you for quick answer.

I tried to increase the distance. Now "little planes" are 40 units higher than ground. Before they were 20 units higher.
I still get flickering. I added an example picture with forklift roof flickering.

I am using:
      buffer = new FrameBuffer(resWidth, resHeight, FrameBuffer.SAMPLINGMODE_GL_AA_4X);
      buffer.enableRenderer(IRenderer.RENDERER_OPENGL, IRenderer.MODE_OPENGL);
      buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);

[attachment deleted by admin]

Offline chupakabra

  • byte
  • *
  • Posts: 7
    • View Profile
Re: Flickering planes
« Reply #3 on: June 11, 2013, 09:08:38 am »
I increased the distance to 1000 and now it works great. Thanks :)

I'll try to minimize the distance, but it won't be such a problem if they hover a little.

Can you advise me, what to do with forklift, to resolve the flickering?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Flickering planes
« Reply #4 on: June 11, 2013, 02:22:54 pm »
If the ground is always below everything else, you might want to put it into another instance of World, render that one, clear the zbuffer and render the rest (you could also do it in one world by altering the visibility between render passes). Anyway, how far away is that? moving the blue boxes 1000 units away sounds like as if this is very far away from the camera...