texturing quads

I have a mesh built from quads. Panda divides all quads into triangles. Problem is when I put textures on quads which are not rectangles - Panda put textures on both triangles differently:

Problem does not exist when quad is a rectangle.
Here are egg file and code fragments for that particular quad:

    <Vertex> 60 {
      4.000000 -5.000000 5.000000
      <UV> { 0.000000 0.000000 }
    }
    <Vertex> 61 {
      -4.000000 -5.000000 5.000000
      <UV> { 1.000000 0.000000 }
    }
    <Vertex> 62 {
      -1.000000 -2.000000 8.000000
      <UV> { 1.000000 1.000000 }
    }
    <Vertex> 63 {
      1.000000 -2.000000 8.000000
      <UV> { 0.000000 1.000000 }
    }

  <Group> groofs {
    <Polygon> {
      <MRef> { roof1 }
      <BFace> { 1 }
      <Normal> { 0.000000 0.707107 -0.707107 }
      <VertexRef> { 60 61 62 63 <Ref> { Room } }
    }
  }

  self.troof = loader.loadTexture("roof.png")
  self.groofs = self.room.find("**/groofs")
  self.groofs.setTexScale(self.ts, 2, 2)
  self.groofs.setTexture(self.troof)

How to put texture on that quad that the triangles won’t be visible ?

panda did not do any thing wrong it did what that data told it. Its our model program error of making texture uv’s like this. This is some thing you see some time from people trying to code uvs by hand humans are bad at that sort of thing. What model program did you use?

If the scope is only a quad (4 vertices), there shouldn’t be anything like this. But since that quad is part of larger geometry (it’s index start at 60), it’s another story.
I could only blame panda’s auto-triangulation. I’ve seen enough broken triangles result, even worse than your case. There is nothing wrong with the original UV’s, it’s just flipped horisontally, and squeezed for the top 2 vertices. But the resulting UV for the top right vertex seems to be scaled up more than 10 times.
To get around this, I used to triangulate my geometry in the modeling program before export it.

ynjh_jo, i never seen panda3d mess up triangulations - i i’ve seen it mess up on every thing else though. I am pretty sure some thing else is going on like broken exporter/converter. The stuff we use blender chicken and max exporter never does this.

I’m using Blender with Chicken export. Now I realized what is wrong - UV values were wrong, top two vertices of that quad should have fractional U values. I recalculated them manually, entered correct values and voila - teksture now looks like I wanted. Thanks for the tip.

Really ? Try this egg :

<CoordinateSystem> { Z-Up }

<Group> squareHole {
  <VertexPool> square.vert {
    <Vertex> 0 {
      1 0 -1
      <Normal> { 0 -1 0 }
      <RGBA> { 1 1 1 1 }
    }
    <Vertex> 1 {
      1 0 1
      <Normal> { 0 -1 0 }
      <RGBA> { 1 1 1 1 }
    }
    <Vertex> 2 {
      -1 0 1
      <Normal> { 0 -1 0 }
      <RGBA> { 1 1 1 1 }
    }
    <Vertex> 3 {
      -1 0 -1
      <Normal> { 0 -1 0 }
      <RGBA> { 1 1 1 1 }
    }
    <Vertex> 4 {
      -0.5 0 0.5
      <Normal> { 0 -1 0 }
      <RGBA> { 1 1 1 1 }
    }
    <Vertex> 5 {
      0.5 0 0.5
      <Normal> { 0 -1 0 }
      <RGBA> { 1 1 1 1 }
    }
    <Vertex> 6 {
      0.5 0 -0.5
      <Normal> { 0 -1 0 }
      <RGBA> { 1 1 1 1 }
    }
    <Vertex> 7 {
      -0.5 0 -0.5
      <Normal> { 0 -1 0 }
      <RGBA> { 1 1 1 1 }
    }
  }
  <Polygon> {
    <Normal> { 0 -1 0 }
    <VertexRef> { 0 1 2 3 4 5 6 7 <Ref> { square.vert } }
  }
}

It should be a square with square hole.

Panda’s egg loader has never claimed to support polygons with holes. If you really want a polygon with a hole, you have to cut your polygon in half, something like this:

  <Polygon> {
    <Normal> { 0 -1 0 }
    <VertexRef> { 0 1 2 4 5 6 <Ref> { square.vert } }
  }
  <Polygon> {
    <Normal> { 0 -1 0 }
    <VertexRef> { 2 3 0 6 7 4 <Ref> { square.vert } }
  }

David

No, I never need 3d polygon with holes. But it’s good to know that it’s not already supported.