The mystery of the missing quad.

I’m encountering an odd issue, and seem to have run out of ideas in attempting to fix it.

I have a very simple model – containing a single mesh, I believe – that is only partially showing up in my game, despite being fully visible in PView. The missing polygon is a single, horizontal quad; visible in both cases are vertical quads attached to the near and far ends of the horizontal quad. I note that the mesh is much closer to the camera in my game than in PView, I believe – but then the nearer vertical quad should be just as near as the near end of the missing quad.

This is what I see in PView: (Note the horizontal section between the two verticals.)

While this is what I see in-game:

Does anyone have any ideas? :confused:

Have you tried to rotate the camera and look at the underside of that model? The quad might be facing the wrong direction.

Looks simple, maybe post the egg file? Hard to say what’s wrong just from the screenshot. If it’s not a flipped normal maybe there’s some other/wrong version of the geometry cached? If it’s really close to the camera maybe it got cut by the near clip plane?

I seem to recall that I tried flipping the quad’s normals before I added the vertical quads, to no apparent effect; in any case, it’s perfectly visible in PView, which seems to imply that the normal is fine.

My camera setup is, perhaps, a little awkward. Nevertheless, I hacked in a quick rotation command… and found that if I pitch the camera by more than a very small amount the entire thing seems to disappear! o_0

Gah, I’d forgotten about the model-cache – thank you for mentioning it. Alas, neither clearing it out nor adding “noCache=True” to the loadModel command that should be responsible for the model seem to have any apparent effect.

As for the clip plane, note that the near vertical quad should be starting from the nearer edge of the missing quad, and is nevertheless still visible.

This should be the correct egg file:

<CoordinateSystem> { Z-up } 
<Material> "blue water" {
  <Scalar> diffr { 0.012946 }
  <Scalar> diffg { 0.030052 }
  <Scalar> diffb { 0.261094 }
  <Scalar> specr { 1.000000 }
  <Scalar> specg { 1.000000 }
  <Scalar> specb { 1.000000 }
  <Scalar> shininess { 27.25 }
  <Scalar> emitr { 0.000000 }
  <Scalar> emitg { 0.000000 }
  <Scalar> emitb { 0.000000 }
}

<Texture> Texture.001 {
  "/home/ian/Documents/My Game Projects/Moon/working files/../Data/Misc/water_top.png"
  <Scalar> envtype { MODULATE }
  <Scalar> minfilter { LINEAR_MIPMAP_LINEAR }
  <Scalar> magfilter { LINEAR_MIPMAP_LINEAR }
  <Scalar> wrap { REPEAT }
}

  <Group> water {
    <Transform> {
      <Matrix4> {
        1.000000 0.000000 0.000000 0.000000 
        0.000000 1.000000 0.000000 0.000000 
        0.000000 0.000000 1.000000 0.000000 
        0.000000 0.000000 0.000000 1.000000 
      }
    }
    
    <VertexPool> water {
    
      <Vertex> 0 {
        5.585286617279053 -1.0 0.0
        <Normal> { 0.000000 -0.707083 0.707083 }
        
        <UV>  {
          0.168141 0.000077
        }
      }
      <Vertex> 1 {
        5.585286617279053 11.96037483215332 0.0
        <Normal> { 0.000000 -0.707083 0.707083 }
        
        <UV>  {
          0.863127 0.000077
        }
      }
      <Vertex> 2 {
        -5.585286617279053 11.96037483215332 0.0
        <Normal> { 0.000000 -0.707083 0.707083 }
        
        <UV>  {
          0.863127 0.599088
        }
      }
      <Vertex> 3 {
        -5.585286617279053 -1.0 0.0
        <Normal> { 0.000000 -0.707083 0.707083 }
        
        <UV>  {
          0.168141 0.599088
        }
      }
      <Vertex> 4 {
        -5.585286617279053 11.96037483215332 0.0
        <Normal> { 0.000000 -0.707083 0.707083 }
        
        <UV>  {
          0.863127 0.599088
        }
      }
      <Vertex> 5 {
        5.585286617279053 11.96037483215332 0.0
        <Normal> { 0.000000 -0.707083 0.707083 }
        
        <UV>  {
          0.863127 0.000077
        }
      }
      <Vertex> 6 {
        5.585286617279053 11.96037483215332 2.5510175228118896
        <Normal> { 0.000000 -1.000000 0.000000 }
        
        <UV>  {
          0.999923 0.000077
        }
      }
      <Vertex> 7 {
        -5.585286617279053 11.96037483215332 2.5510175228118896
        <Normal> { 0.000000 -1.000000 0.000000 }
        
        <UV>  {
          0.999923 0.599088
        }
      }
      <Vertex> 8 {
        5.585286617279053 -1.0 0.0
        <Normal> { 0.000000 -0.707083 0.707083 }
        
        <UV>  {
          0.168141 0.000077
        }
      }
      <Vertex> 9 {
        -5.585286617279053 -1.0 0.0
        <Normal> { 0.000000 -0.707083 0.707083 }
        
        <UV>  {
          0.168141 0.599088
        }
      }
      <Vertex> 10 {
        -5.585286617279053 -1.0 -3.1341068744659424
        <Normal> { 0.000000 -1.000000 0.000000 }
        
        <UV>  {
          0.000077 0.599088
        }
      }
      <Vertex> 11 {
        5.585286617279053 -1.0 -3.1341068744659424
        <Normal> { 0.000000 -1.000000 0.000000 }
        
        <UV>  {
          0.000077 0.000077
        }
      }}
    
    
    <Polygon> {
      <TRef> { Texture.001 }
      <MRef> { "blue water" }
      <Normal> {0.000000 0.000000 1.000000}
      <VertexRef> { 0 1 2 3 <Ref> { water }}
    }
    <Polygon> {
      <TRef> { Texture.001 }
      <MRef> { "blue water" }
      <Normal> {0.000000 -1.000000 0.000000}
      <VertexRef> { 4 5 6 7 <Ref> { water }}
    }
    <Polygon> {
      <TRef> { Texture.001 }
      <MRef> { "blue water" }
      <Normal> {0.000000 -1.000000 0.000000}
      <VertexRef> { 8 9 10 11 <Ref> { water }}
    }
  }

The texture reference is absolute at the moment, but all three quads use the same texture, I believe, so that shouldn’t be the problem.

Thank you both for your suggestions and help thus far!

Now thats interesting… perhaps your problem lies in your, as you say, a little awkward camera setup?

Doesn’t it support directtools? (“want-directtools #t” config) That should allow you to move the camera as you wish.

I’d missed DirectTools, I believe – thank you for mentioning it, it’s a rather interesting tool.

And I believe that I’ve found the problem: a large depth offset that I fear that I’d forgotten that I’m applying to the geometry.

The geometry in question is intended as background geometry, and I want to be confident that it renders behind all other non-background geometry, so I’m applying a rather large depth offset. Until this point, my background geometry has been entirely vertical, I believe, and I haven’t been rotating the camera – and thus, I imagine, rotating its frustum – much, if at all; for some reason, the depth offset seems to be culling horizontal polygons where it doesn’t cull horizontal ones.

I’ll likely experiment with reducing my offset, but I want to be careful that background geometry doesn’t end up rendering in front of foreground geometry. That said, I think that the offset can be reduced somewhat, and I might find a solution via the fact that I started rendering my foreground geometry into a new display region more recently than I instituted the offset; perhaps I can achieve what I want by clearing the depth buffer at an appropriate point…

Thank you all for your help! :slight_smile:

I’m not sure that’s what depth offset is for. Wouldn’t this be easier achieved with render bins? Were you having trouble with it occluding foreground models before doing this?

Render bins might help, but I don’t think that they’d solve the problem of depth buffer comparisons: both background elements and foreground elements (which are here defined more by purpose than position) are intended to occlude as expected amongst themselves, but foreground elements are expected to occlude any background geometry.

I already have a separate display region for another purpose, with background geometry in one region and foreground geometry in another; I’m hoping (although I’ll admit that I don’ think that I’ve really looked yet – I’ve been largely working on a protype today) that I’ll find a way to simply clear the depth buffer between the rendering of the display region in which the background lies and the rendering of the other.

As to having experienced occlusions, I’ll confess that I don’t recall clearly – it was some time ago now that I implemented the feature, as I recall. ^^;;

I notice that the ‘missing’ quad is at a right angle from the other ones. Do you have a light enabled in-game? If so, you’re not going to see any quads that are at a right angle from the light unless you add an ambient light.

To make sure that it’s just black and not missing, you could change the background colour of your game.

I’m pretty sure that there are no lights affecting background geometry, very much intentionally; in any case, while it doesn’t seem to be visible in the screenshot (perhaps I took the screenshot with the in-game editor turned off – I forget), I have a DirectGrid visible while in “editing” mode, and I seem to recall having seen said grid through the gap.