1

如何为多边形面着色-例如,仅将颜色 1 面全为红色。当我继续为相邻面着色时,我不希望发生线性插值。我可以使用以下代码对其进行着色,但颜色会合并。当我将 colorPerVertex 设置为 false 时,颜色看起来很奇怪。请指教。谢谢你。

<X3D>
<Scene>
<Shape>

    <IndexedFaceSet solid="false" colorPerVertex="true"
        coordIndex="0 3 4 1 -1
                    1 4 5 2 -1
                    3 6 7 4 -1
                    4 7 8 5 -1">
    <Coordinate
        point= "0 0 0, 1 0 0, 2 0 0
                0 0 1, 1 3 1, 2 0 1
                0 0 2, 1 0 2, 2 0 2" />

        <Color color= "0 0 0, 1 0 0, 2 0 0
                0 0 1, 1 3 1, 2 0 1
                0 0 2, 1 0 2, 2 0 2" />

    </IndexedFaceSet>

    <Appearance>
        <Material diffuseColor='1 0 0' />
    </Appearance>

</Shape>
</Scene>
</X3D>
4

1 回答 1

2

如果 colorPerVertex 为 FALSE 并且 colorIndex 字段不为空,则为 IndexedFaceSet 的每个面应用一种颜色。

因此,如果您在示例中将 colorPerVertex 设置为 FALSE,则不应在面之间进行颜色插值(已测试)。

于 2013-11-25T00:26:39.460 回答