1

hopefully a sensible question this time...

See in the picture how the top half has the textures looking ok, but then the bottom half (after it rotated a little more)the texture is breaking up, and you can see the inside of the shape? the polygons have dissappaered?

What is this problem called? I need to know so I know what to look for when fixing it!

Incidentally, I'm doing this in Papervision. If you per chance know the fix (or if it is possible), I will give you permission to feel extra good about yourself if you can point me in the right direction.

What is this called?

Thanks heaps!

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Assembler
  • 794
  • 1
  • 8
  • 24

5 Answers5

8

We called it "z-fighting" - but a more common term is z-ordering or z-buffer problems.

I'll try and explain the problem without diagrams 1st.

3D renderers work by drawing the polygons from back to front. It does this by assigning each polygon to one of a discrete number of positions. This works for most scenes.

You get a problem when there aren't enough slots to be able to decide which polygon is in front of another.

To solve it - it will depend on your application, but there are a number of things which should be common to all:

  1. Make sure the bounding box of the world is as small as possible.
  2. Increase the colour depth of your display. Both OpenGL and Direct3D can tie the number of z slots to the resolution of the display.
  3. Increase the number/decrease the size of your triangles. Smaller triangles are going to be less affected by this - but will decrease the performance as there are more to draw.

If you are running on Windows you should set the desktop to the highest colour resolution. You application might pick that up as the default to use.

Can you switch between OpenGL and Direct3D rendering? If so then try both, one might give better results than the other.

ChrisF
  • 134,786
  • 31
  • 255
  • 325
  • z-fighting! Sounds like something to play after F-Zero! I can't/haven't yet found the way to do 1&2 in Papervision, but 3 did help. I took a performance hit, but I'll figure out something on the way. Thanks heaps! – Assembler Apr 22 '09 at 10:02
  • A better term is z-buffer problems. 2 might be independent of your modelling system - are you running on Windows? If so set it at the desktop level and see if that helps. – ChrisF Apr 22 '09 at 11:26
  • I don't follow the talk about back to front at all ... If actually using a Z Buffer, there's no need to sort the polygons. The Z buffer will resolve for each pixel which polygon should be in front. Except when the difference between two polygons is too small, which is when you get Z fighting. – unwind Apr 22 '09 at 11:35
  • 1
    The back to front drawing is how the z-buffer actually works. Nowadays this is all hidden in the graphics drivers, but when I started you had to know about these things. – ChrisF Apr 22 '09 at 11:40
  • 1
    ChrisF answers this question as if PV3D uses hardware renderer, which is not the case. PV3D is a software renderer which exploits flash's architecture. There is no Z buffer, hence there is no Z fighting. Option 3 helped because it's a way to hide linear tex-mapping interpolation. See my answer to see it in action. – LiraNuna Apr 22 '09 at 21:15
  • @LiraNuna - Fair enough - though as all other software renderers I've come across have used Z-buffers, I thought I was safe making that assumption – ChrisF Apr 22 '09 at 21:19
1

Seems to be a Z buffer problem, somehow. I'm not familiar with what you're using there, though, so I probably can't really help.

Joey
  • 344,408
  • 85
  • 689
  • 683
1

It's called linear mapping, it's a way to map the textures on the polygon. But this method is not perspective corrected, which leads to broken textures at extreme angles.

Linear Mapping Perspective Corrected texture mapping

Linear texture mapping (up) and perspective corrected texture mapping (down).

The only workaround is to add more polygons, which will hit performance (See this demo).

Community
  • 1
  • 1
LiraNuna
  • 64,916
  • 15
  • 117
  • 140
  • Thanks! it's not quite actually the issue though, I think... with PV3D the materials have a precise:Boolean setting to work around this... I tried turning it on and off but the problem persisted. – Assembler Apr 22 '09 at 09:36
  • You can see a demo of how to overcome this here: http://www.papervision3d.org/demos/LinearMapping/ – LiraNuna Apr 22 '09 at 21:09
  • Yeah this is a different issue, but also an important one when dealing with papervision. – Matt Rix Aug 11 '09 at 15:50
1

Looks to me more like a decal that went wrong rather than z-fighting. Z-fighting usually has some jagged edges. The projection matrix for that particular triangle might be wrong (considering that the extent of the problem depend on the camera position).

grivei
  • 61
  • 2
  • 8
0

Do you have multiple overlayed textures and/or polygons?

From here it looks like the problem you get when you have exactly coincident surfaces, but floating point errors mean that you don't consistently see the right one.

Alnitak
  • 334,560
  • 70
  • 407
  • 495