X3d - When using the same vertice in IndexedTriangleSet, it appears black

33 Views Asked by At

I've a simple page (HTML + X3D) with two boxes.

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv='Content-Type' content='text/html;charset=utf-8'></meta>
    <link rel='stylesheet' type='text/css' href='http://www.x3dom.org/x3dom/release/x3dom.css'></link>
    <script type='text/javascript' src='http://www.x3dom.org/x3dom/release/x3dom.js'></script>
  </head>
  <body>
    <X3D profile="Interchange" version="3.2"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
         xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.2.xsd">
<Scene>
<Transform translation="0.0 0.0 0.0">
<Shape>
<Appearance>
<Material diffuseColor="0.99609375 0.0 0.0"/>
</Appearance>
<IndexedTriangleSet index="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17">
<Coordinate point="0.0 0.0 0.0 0.0 2.0 0.0 1.0 0.0 0.0 1.0 2.0 3.0 0.0 2.0 3.0 1.0 0.0 3.0 0.0 0.0 0.0 0.0 0.0 3.0 0.0 2.0 0.0 1.0 2.0 3.0 1.0 0.0 3.0 1.0 2.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 3.0 1.0 2.0 3.0 1.0 2.0 0.0 0.0 2.0 3.0"/>
</IndexedTriangleSet>
</Shape>
<Shape>
<Appearance>
<Material diffuseColor="0.99609375 0.99609375 0.0"/>
</Appearance>
<IndexedTriangleSet index="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17">
<Coordinate point="1.0 2.0 0.0 1.0 0.0 0.0 0.0 2.0 0.0 0.0 0.0 3.0 1.0 0.0 3.0 0.0 2.0 3.0 0.0 2.0 3.0 0.0 2.0 0.0 0.0 0.0 3.0 1.0 0.0 0.0 1.0 2.0 0.0 1.0 0.0 3.0 1.0 0.0 3.0 0.0 0.0 3.0 1.0 0.0 0.0 0.0 2.0 0.0 0.0 2.0 3.0 1.0 2.0 0.0"/>
</IndexedTriangleSet>
</Shape>

<Shape>
<Appearance>
<Material diffuseColor="0.99609375 0.0 0.0"/>
</Appearance>
<IndexedTriangleSet index="0 2 1 7 6 5 0 4 2 7 5 3 0 1 4 7 3 6">
<Coordinate point="3.0 0.0 0.0 4.0 0.0 0.0 3.0 2.0 0.0 4.0 2.0 0.0 3.0 0.0 3.0 4.0 0.0 3.0 3.0 2.0 3.0 4.0 2.0 3.0"/>
</IndexedTriangleSet>
</Shape>
<Shape>
<Appearance>
<Material diffuseColor="0.99609375 0.99609375 0.0"/>
</Appearance>
<IndexedTriangleSet index="3 1 2 4 5 6 6 2 4 1 3 5 5 4 1 2 6 3">
<Coordinate point="3.0 0.0 0.0 4.0 0.0 0.0 3.0 2.0 0.0 4.0 2.0 0.0 3.0 0.0 3.0 4.0 0.0 3.0 3.0 2.0 3.0 4.0 2.0 3.0"/>
</IndexedTriangleSet>
</Shape>
</Transform>
</Scene>
    </X3D>  
  </body>
</html>

The first box shows normal colors, the second shows some black shadows on the faces. The difference between two boxes is that first one uses non connected points whereas second one uses same points several times.

Can somebody explain me how to get the same rendering for both ? Thanks.

(I've used x3d-viewer extension on chromium.)

0

There are 0 best solutions below